source: trunk/src/kernel32/debug.cpp@ 3796

Last change on this file since 3796 was 3796, checked in by bird, 25 years ago

Corrected logging info on IsDebuggerPresent.

File size: 5.6 KB
Line 
1/* $Id: debug.cpp,v 1.5 2000-07-03 12:20:10 bird Exp $ */
2
3/*
4 * Win32 debug Subsystem for OS/2
5 *
6 * Copyright 1999 Edgar Buerkle
7 *
8 * Project Odin Software License can be found in LICENSE.TXT
9 *
10 */
11
12/*****************************************************************************
13 * Includes *
14 *****************************************************************************/
15#include <os2win.h>
16#include <misc.h>
17#include "oslibdebug.h"
18
19#define DBG_LOCALLOG DBG_debug
20#include "dbglocal.h"
21
22/*****************************************************************************
23 * Name : BOOL WaitForDebugEvent
24 * Purpose : The WaitForDebugEvent function waits for a debugging event to
25 * occur in a process being debugged.
26 * Parameters: LPDEBUG_EVENT lpde address of structure for event information
27 * DWORD dwTimeout number of milliseconds to wait for event
28 * Variables :
29 * Result : TRUE / FALSE
30 * Remark :
31 * Status : UNTESTED STUB
32 *
33 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
34 *****************************************************************************/
35BOOL WIN32API WaitForDebugEvent(LPDEBUG_EVENT lpde, DWORD dwTimeout)
36{
37 dprintf(("KERNEL32: WaitForDebugEvent timeout:%d\n", dwTimeout));
38
39 return OSLibWaitForDebugEvent(lpde, dwTimeout);
40}
41/*****************************************************************************
42 * Name : BOOL WIN32API ContinueDebugEvent
43 * Purpose : The ContinueDebugEvent function enables a debugger to continue
44 * a thread that previously reported a debugging event.
45 * Parameters: DWORD dwProcessId process to continue
46 * DWORD dwThreadId thread to continue
47 * DWORD dwContinueStatus continuation status
48 * Variables :
49 * Result : If the function succeeds, the return value is nonzero.
50 * If the function fails, the return value is zero.
51 * To get extended error information, call GetLastError.
52 * Remark : Only the thread that created dwProcessId with the CreateProcess
53 * function can call ContinueDebugEvent.
54 * After the ContinueDebugEvent function succeeds, the specified
55 * thread continues. Depending on the debugging event previously
56 * reported by the thread, different actions occur. If the continued
57 * thread previously reported an EXIT_THREAD_DEBUG_EVENT
58 * debugging event, ContinueDebugEvent closes the handle the
59 * debugger has to the thread. If the continued thread previously
60 * reported an EXIT_PROCESS_DEBUG_EVENT debugging event,
61 * ContinueDebugEvent closes the handles the debugger has to the
62 * process and to the thread.
63 * Status : UNTESTED STUB
64 *
65 * Author : Markus Montkowski [Thu, 1998/05/19 11:46]
66 *****************************************************************************/
67BOOL WIN32API ContinueDebugEvent( DWORD dwProcessId, DWORD dwThreadId,
68 DWORD dwContinueStatus)
69{
70
71 dprintf(("KERNEL32: ContinueDebugEvent(%08x,%08x,%08x)not correctly implemented\n",
72 dwProcessId, dwThreadId, dwContinueStatus));
73
74 return OSLibContinueDebugEvent(dwProcessId, dwThreadId, dwContinueStatus);
75}
76//******************************************************************************
77//******************************************************************************
78
79/**
80 * Query if the calling process is running under the context of a debugger.
81 * @returns TRUE (non-zero) Debugged.
82 * FALSE Not debugged.
83 * @status STUB
84 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
85 * @remark An application could use this API to determin whether or not it is
86 * being debugged, so that it can change behaviour and for example
87 * provide more debug information using functions like OutputDebugString.
88 *
89 * You could change the result of this by SET ODIN32.DEBUGGERPRESENT=1 on
90 * the commandline.
91 */
92BOOL WIN32API IsDebuggerPresent(VOID)
93{
94 BOOL fRet = getenv("ODIN32.DEBUGGERPRESENT") != NULL;
95 dprintf(("KERNEL32: IsDebuggerPresent() -> %s\n", fRet ? "TRUE" : "FALSE"));
96 return fRet;
97}
98
99
100/**
101 * Send a string to the debugger for the current application.
102 * @param lpszOutputString Pointer to the string to send to the debugger. (intput)
103 * @sketch Convert and log the string.
104 * @status STUB
105 * @author Sander van Leeuwen
106 * @remark The string is send to the system debugger if there is no
107 * debugger available for this application.
108 * If the application has not debugger and the system debugger
109 * is not active this API does nothing.
110 */
111VOID WIN32API OutputDebugStringW(LPCWSTR lpszOutputString)
112{
113 char *pszAscii = UnicodeToAsciiString((LPWSTR)lpszOutputString);
114 dprintf(("KERNEL32: OS2OutputDebugStringW %s\n", pszAscii));
115 FreeAsciiString(pszAscii);
116}
117
118
119/**
120 * Send a string to the debugger for the current application.
121 * @param lpszOutputString Pointer to the string to send to the debugger. (input)
122 * @sketch Log the string.
123 * @status STUB
124 * @author Sander van Leeuwen
125 * @remark The string is send to the system debugger if there is no
126 * debugger available for this application.
127 * If the application has not debugger and the system debugger
128 * is not active this API does nothing.
129 */
130VOID WIN32API OutputDebugStringA(LPCSTR lpszOutputString)
131{
132 dprintf(("KERNEL32: OutputDebugStringA: %s\n", lpszOutputString));
133}
134
Note: See TracBrowser for help on using the repository browser.