On Tue, Nov 21, 2017 at 3:07 PM, Mihail Abakumov <mikhail.abaku...@ispras.ru> wrote: > Added useful name arrays of some defines. Not used yet. Needs for the future. > > Signed-off-by: Mihail Abakumov <mikhail.abaku...@ispras.ru> > Signed-off-by: Pavel Dovgalyuk <dovga...@ispras.ru> > Signed-off-by: Dmitriy Koltunov <koltu...@ispras.ru> > --- > include/exec/windbgkd.h | 75 > +++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 75 insertions(+) > > diff --git a/include/exec/windbgkd.h b/include/exec/windbgkd.h > index b8f98925e7..40a23f8cd0 100755 > --- a/include/exec/windbgkd.h > +++ b/include/exec/windbgkd.h > @@ -870,4 +870,79 @@ typedef struct _DBGKD_TRACE_IO { > } u; > } DBGKD_TRACE_IO, *PDBGKD_TRACE_IO; > > +__attribute__ ((unused)) /* maybe unused */ > +static const char *kd_api_names[] = { > + "DbgKdReadVirtualMemoryApi", > + "DbgKdWriteVirtualMemoryApi", > + "DbgKdGetContextApi", > + "DbgKdSetContextApi", > + "DbgKdWriteBreakPointApi", > + "DbgKdRestoreBreakPointApi", > + "DbgKdContinueApi", > + "DbgKdReadControlSpaceApi", > + "DbgKdWriteControlSpaceApi", > + "DbgKdReadIoSpaceApi", > + "DbgKdWriteIoSpaceApi", > + "DbgKdRebootApi", > + "DbgKdContinueApi2", > + "DbgKdReadPhysicalMemoryApi", > + "DbgKdWritePhysicalMemoryApi", > + "DbgKdQuerySpecialCallsApi", > + "DbgKdSetSpecialCallApi", > + "DbgKdClearSpecialCallsApi", > + "DbgKdSetInternalBreakPointApi", > + "DbgKdGetInternalBreakPointApi", > + "DbgKdReadIoSpaceExtendedApi", > + "DbgKdWriteIoSpaceExtendedApi", > + "DbgKdGetVersionApi", > + "DbgKdWriteBreakPointExApi", > + "DbgKdRestoreBreakPointExApi", > + "DbgKdCauseBugCheckApi", > + "", > + "", > + "", > + "", > + "", > + "", > + "DbgKdSwitchProcessor", > + "DbgKdPageInApi", > + "DbgKdReadMachineSpecificRegister", > + "DbgKdWriteMachineSpecificRegister", > + "OldVlm1", > + "OldVlm2", > + "DbgKdSearchMemoryApi", > + "DbgKdGetBusDataApi", > + "DbgKdSetBusDataApi", > + "DbgKdCheckLowMemoryApi", > + "DbgKdClearAllInternalBreakpointsApi", > + "DbgKdFillMemoryApi", > + "DbgKdQueryMemoryApi", > + "DbgKdSwitchPartition", > + "DbgKdUnknownApi" > +}; > + > +__attribute__ ((unused)) /* maybe unused */ > +static const char *kd_packet_type_names[] = { > + "PACKET_TYPE_UNUSED", > + "PACKET_TYPE_KD_STATE_CHANGE32", > + "PACKET_TYPE_KD_STATE_MANIPULATE", > + "PACKET_TYPE_KD_DEBUG_IO", > + "PACKET_TYPE_KD_ACKNOWLEDGE", > + "PACKET_TYPE_KD_RESEND", > + "PACKET_TYPE_KD_RESET", > + "PACKET_TYPE_KD_STATE_CHANGE64", > + "PACKET_TYPE_KD_POLL_BREAKIN", > + "PACKET_TYPE_KD_TRACE_IO", > + "PACKET_TYPE_KD_CONTROL_REQUEST", > + "PACKET_TYPE_KD_FILE_IO", > + "PACKET_TYPE_MAX" > +}; > + > +#define KD_API_NAME(id) \ > + (id >= DbgKdMinimumManipulate && id < DbgKdMaximumManipulate) ? \ > + kd_api_names[id - DbgKdMinimumManipulate] : \ > + kd_api_names[DbgKdMaximumManipulate - DbgKdMinimumManipulate] \
nice-to-have: Build-time assert that kd_api_names has (DbgKdMaximumManipulate - DbgKdMinimumManipulate + 1) elements. > +#define KD_PKT_TYPE_NAME(id) kd_packet_type_names[id] nice-to-have: A ternary similar to what KD_API_NAME has for extra safety. > #endif >