test: debug3.c Source File

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# debug3.c

Go to the documentation of this file.

    00001 //++
    00002 //
    00003 // Copyright (c) 1990  Microsoft Corporation
    00004 //
    00005 // Module Name:
    00006 //
    00007 //    debug3.c
    00008 //
    00009 // Abstract:
    00010 //
    00011 //    This module implements architecture specific functions to support debugging NT.
    00012 //
    00013 // Author:
    00014 //
    00015 //    Steven R. Wood (stevewo) 3-Aug-1989
    00016 //
    00017 // Environment:
    00018 //
    00019 //    Any mode.
    00020 //
    00021 // Revision History:
    00022 //
    00023 //--
    00024
    00025 #include "stdarg.h"
    00026 #include "stdio.h"
    00027 #include "string.h"
    00028 #include "ntrtlp.h"
    00029
    00030 //
    00031 // Prototype for local procedure
    00032 //
    00033
    00034 NTSTATUS
    00035 DebugService(
    00036     ULONG   ServiceClass,
    00037     PVOID   Arg1,
    00038     PVOID   Arg2
    00039     );
    00040
    00041 VOID _fptrap() {};
    00042
    00043 NTSTATUS
    00044 DebugPrint(
    00045     IN PSTRING Output
    00046     )
    00047 {
    00048     return DebugService( BREAKPOINT_PRINT, Output, 0 );
    00049 }
    00050
    00051
    00052 ULONG
    00053 DebugPrompt(
    00054     IN PSTRING Output,
    00055     IN PSTRING Input
    00056     )
    00057 {
    00058     return DebugService( BREAKPOINT_PROMPT, Output, Input );
    00059 }
    00060
    00061 VOID
    00062 DebugLoadImageSymbols(
    00063     IN PSTRING FileName,
    00064     IN PKD_SYMBOLS_INFO SymbolInfo
    00065     )
    00066 {
    00067     DebugService( BREAKPOINT_LOAD_SYMBOLS, FileName, SymbolInfo );
    00068 }
    00069
    00070 NTSTATUS
    00071 DebugService(
    00072     ULONG   ServiceClass,
    00073     PVOID   Arg1,
    00074     PVOID   Arg2
    00075     )
    00076
    00077 //++
    00078 //
    00079 //  Routine Description:
    00080 //
    00081 //      Allocate an ExceptionRecord, fill in data to allow exception
    00082 //      dispatch code to do the right thing with the service, and
    00083 //      call RtlRaiseException (NOT ExRaiseException!!!).
    00084 //
    00085 //  Arguments:
    00086 //      ServiceClass - which call is to be performed
    00087 //      Arg1 - generic first argument
    00088 //      Arg2 - generic second argument
    00089 //
    00090 //  Returns:
    00091 //      Whatever the exception returns in eax
    00092 //
    00093 //--
    00094
    00095 {
    00096     NTSTATUS    RetValue;
    00097
    00098 #if defined(BUILD_WOW6432)
    00099
    00100     extern NTSTATUS NtWow64DebuggerCall(ULONG, PVOID, PVOID);
    00101     RetValue = NtWow64DebuggerCall(ServiceClass, Arg1, Arg2);
    00102
    00103 #else
    00104     _asm {
    00105         mov     eax, ServiceClass
    00106         mov     ecx, Arg1
    00107         mov     edx, Arg2
    00108
    00109         int     2dh                 ; Raise exception
    00110         int     3                   ; DO NOT REMOVE (See KiDebugService)
    00111
    00112         mov     RetValue, eax
    00113
    00114     }
    00115 #endif
    00116
    00117     return RetValue;
    00118 }
    00119
    00120
    00121 // DebugUnloadImageSymbols must appear after DebugSerive.  Moved
    00122 // it down below DebugService, so BBT would have a label after DebugService.
    00123 // A label after the above _asm  is necessary so BBT can treat DebugService
    00124 // as  "KnownDataRange".   Otherwise, the two  'int' instructions could get broken up
    00125 // by BBT's optimizer.
    00126 VOID
    00127 DebugUnLoadImageSymbols(
    00128     IN PSTRING FileName,
    00129     IN PKD_SYMBOLS_INFO SymbolInfo
    00130     )
    00131 {
    00132     DebugService( BREAKPOINT_UNLOAD_SYMBOLS, FileName, SymbolInfo );
    00133 }
    00134