On 11/12/2017 14:21, Mihail Abakumov 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 | 83 > +++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 83 insertions(+) > > diff --git a/include/exec/windbgkd.h b/include/exec/windbgkd.h > index b8f98925e7..5008cbb729 100755 > --- a/include/exec/windbgkd.h > +++ b/include/exec/windbgkd.h > @@ -870,4 +870,87 @@ typedef struct _DBGKD_TRACE_IO { > } u; > } DBGKD_TRACE_IO, *PDBGKD_TRACE_IO; > > +__attribute__ ((unused)) /* maybe unused */ > +static const char *kd_api_names[] = {
Please put this in windbgstub-utils.c... > + "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[] = { ... same here... > + "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) ({ \ ... and make this a function instead of a macro. Paolo > + QEMU_BUILD_BUG_ON(ARRAY_SIZE(kd_api_names) == \ > + DbgKdMaximumManipulate - DbgKdMinimumManipulate + 2); \ > + (id >= DbgKdMinimumManipulate && id < DbgKdMaximumManipulate) ? \ > + kd_api_names[id - DbgKdMinimumManipulate] : \ > + kd_api_names[DbgKdMaximumManipulate - DbgKdMinimumManipulate]; \ > +}) > + > +#define KD_PKT_TYPE_NAME(id) ({ \ > + QEMU_BUILD_BUG_ON(ARRAY_SIZE(kd_packet_type_names) == PACKET_TYPE_MAX); \ > + (id >= 0 && id < PACKET_TYPE_MAX) ? \ > + kd_packet_type_names[id] : \ > + kd_packet_type_names[PACKET_TYPE_MAX - 1]; \ > +}) > + > #endif > >