diff mbox

[v3,03/45] windbg: modified windbgkd.h

Message ID 151127325284.6888.645379954526299685.stgit@Misha-PC.lan02.inno (mailing list archive)
State New, archived
Headers show

Commit Message

Mikhail Abakumov Nov. 21, 2017, 2:07 p.m. UTC
Added useful name arrays of some defines. Not used yet. Needs for the future.

Signed-off-by: Mihail Abakumov <mikhail.abakumov@ispras.ru>
Signed-off-by: Pavel Dovgalyuk <dovgaluk@ispras.ru>
Signed-off-by: Dmitriy Koltunov <koltunov@ispras.ru>
---
 include/exec/windbgkd.h |   75 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)

Comments

Ladi Prosek Nov. 28, 2017, 12:54 p.m. UTC | #1
On Tue, Nov 21, 2017 at 3:07 PM, Mihail Abakumov
<mikhail.abakumov@ispras.ru> wrote:
> Added useful name arrays of some defines. Not used yet. Needs for the future.
>
> Signed-off-by: Mihail Abakumov <mikhail.abakumov@ispras.ru>
> Signed-off-by: Pavel Dovgalyuk <dovgaluk@ispras.ru>
> Signed-off-by: Dmitriy Koltunov <koltunov@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
>
diff mbox

Patch

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] \
+
+#define KD_PKT_TYPE_NAME(id) kd_packet_type_names[id]
+
 #endif