1 | /* $Id: dbglocal.cpp,v 1.16 2001-07-20 15:33:29 sandervl Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * debug logging functions for OS/2
|
---|
5 | *
|
---|
6 | *
|
---|
7 | * Copyright 2000 Sander van Leeuwen
|
---|
8 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
9 | */
|
---|
10 | #include <os2wrap.h>
|
---|
11 | #include <stdlib.h>
|
---|
12 | #include <stdio.h>
|
---|
13 | #include <string.h>
|
---|
14 | #include "dbglocal.h"
|
---|
15 |
|
---|
16 | #ifdef DEBUG
|
---|
17 |
|
---|
18 | USHORT DbgEnabledKERNEL32[DBG_MAXFILES] = {0};
|
---|
19 | USHORT DbgEnabledLvl2KERNEL32[DBG_MAXFILES] = {0};
|
---|
20 |
|
---|
21 | static char *DbgFileNames[DBG_MAXFILES] =
|
---|
22 | {
|
---|
23 | "kernel32",
|
---|
24 | "kobjects",
|
---|
25 | "console",
|
---|
26 | "conin",
|
---|
27 | "conbuffer",
|
---|
28 | "conout",
|
---|
29 | "network",
|
---|
30 | "hmdevio",
|
---|
31 | "profile",
|
---|
32 | "thread",
|
---|
33 | "virtual",
|
---|
34 | "thunk",
|
---|
35 | "obsolete",
|
---|
36 | "comm",
|
---|
37 | "message",
|
---|
38 | "resource",
|
---|
39 | "exceptions",
|
---|
40 | "heapshared",
|
---|
41 | "cpuhlp",
|
---|
42 | "heapcode",
|
---|
43 | "lfile",
|
---|
44 | "npipe",
|
---|
45 | "oslibdos",
|
---|
46 | "oslibmisc",
|
---|
47 | "misc",
|
---|
48 | "exceptutil",
|
---|
49 | "lang",
|
---|
50 | "iccio",
|
---|
51 | "map",
|
---|
52 | "win32util",
|
---|
53 | "heap",
|
---|
54 | "heapstring",
|
---|
55 | "os2heap",
|
---|
56 | "vmutex",
|
---|
57 | "initterm",
|
---|
58 | "handlemanager",
|
---|
59 | "environ",
|
---|
60 | "initsystem",
|
---|
61 | "hmdevice",
|
---|
62 | "hmopen32",
|
---|
63 | "hmobjects",
|
---|
64 | "hmevent",
|
---|
65 | "hmmutex",
|
---|
66 | "hmcomm",
|
---|
67 | "semaphore",
|
---|
68 | "wprocess",
|
---|
69 | "conprop",
|
---|
70 | "conprop2",
|
---|
71 | "winimagelx",
|
---|
72 | "winimagebase",
|
---|
73 | "windllbase",
|
---|
74 | "winexebase",
|
---|
75 | "time",
|
---|
76 | "mmap",
|
---|
77 | "winimagepe2lx",
|
---|
78 | "winimagepeldr",
|
---|
79 | "windllpe2lx",
|
---|
80 | "windlllx",
|
---|
81 | "windllpeldr",
|
---|
82 | "winexepe2lx",
|
---|
83 | "winexelx",
|
---|
84 | "winexepeldr",
|
---|
85 | "winres",
|
---|
86 | "critsection",
|
---|
87 | "pefile",
|
---|
88 | "winimgres",
|
---|
89 | "wintls",
|
---|
90 | "async",
|
---|
91 | "fileio",
|
---|
92 | "hmtoken",
|
---|
93 | "kernelrsrc",
|
---|
94 | "atom",
|
---|
95 | "disk",
|
---|
96 | "directory",
|
---|
97 | "cvtbitmap",
|
---|
98 | "hmmmap",
|
---|
99 | "cvtaccel",
|
---|
100 | "cvticon",
|
---|
101 | "cvticongrp",
|
---|
102 | "oslibexcept",
|
---|
103 | "cpu",
|
---|
104 | "process",
|
---|
105 | "cvtcursor",
|
---|
106 | "cvtcursorgrp",
|
---|
107 | "stubs",
|
---|
108 | "interlock",
|
---|
109 | "toolhelp",
|
---|
110 | "codepage",
|
---|
111 | "debug",
|
---|
112 | "oslibdebug",
|
---|
113 | "registry",
|
---|
114 | "queue",
|
---|
115 | "hmthread",
|
---|
116 | "hmprocess",
|
---|
117 | "vsemaphore",
|
---|
118 | "exceptstackdump",
|
---|
119 | "hmfile",
|
---|
120 | "hmnpipe",
|
---|
121 | "hmdisk",
|
---|
122 | "version",
|
---|
123 | "hmstd",
|
---|
124 | "module",
|
---|
125 | "mailslot",
|
---|
126 | "hmmailslot"
|
---|
127 | };
|
---|
128 | //******************************************************************************
|
---|
129 | //******************************************************************************
|
---|
130 | void ParseLogStatusKERNEL32()
|
---|
131 | {
|
---|
132 | char *envvar = getenv(DBG_ENVNAME);
|
---|
133 | char *envvar2= getenv(DBG_ENVNAME_LVL2);
|
---|
134 | char *dbgvar;
|
---|
135 | int i;
|
---|
136 |
|
---|
137 | for(i=0;i<DBG_MAXFILES;i++) {
|
---|
138 | DbgEnabledKERNEL32[i] = 1;
|
---|
139 | }
|
---|
140 |
|
---|
141 | if(envvar) {
|
---|
142 | dbgvar = strstr(envvar, "dll");
|
---|
143 | if(dbgvar) {
|
---|
144 | if(*(dbgvar-1) == '-') {
|
---|
145 | for(i=0;i<DBG_MAXFILES;i++) {
|
---|
146 | DbgEnabledKERNEL32[i] = 0;
|
---|
147 | }
|
---|
148 | }
|
---|
149 | }
|
---|
150 | for(i=0;i<DBG_MAXFILES;i++) {
|
---|
151 | dbgvar = strstr(envvar, DbgFileNames[i]);
|
---|
152 | if(dbgvar) {
|
---|
153 | if(*(dbgvar-1) == '-') {
|
---|
154 | DbgEnabledKERNEL32[i] = 0;
|
---|
155 | }
|
---|
156 | else
|
---|
157 | if(*(dbgvar-1) == '+') {
|
---|
158 | DbgEnabledKERNEL32[i] = 1;
|
---|
159 | }
|
---|
160 | }
|
---|
161 | }
|
---|
162 | }
|
---|
163 | if(envvar2) {
|
---|
164 | dbgvar = strstr(envvar2, "dll");
|
---|
165 | if(dbgvar) {
|
---|
166 | if(*(dbgvar-1) == '+') {
|
---|
167 | for(i=0;i<DBG_MAXFILES;i++) {
|
---|
168 | DbgEnabledLvl2KERNEL32[i] = 1;
|
---|
169 | }
|
---|
170 | }
|
---|
171 | }
|
---|
172 | for(i=0;i<DBG_MAXFILES;i++) {
|
---|
173 | dbgvar = strstr(envvar2, DbgFileNames[i]);
|
---|
174 | if(dbgvar) {
|
---|
175 | if(*(dbgvar-1) == '-') {
|
---|
176 | DbgEnabledLvl2KERNEL32[i] = 0;
|
---|
177 | }
|
---|
178 | else
|
---|
179 | if(*(dbgvar-1) == '+') {
|
---|
180 | DbgEnabledLvl2KERNEL32[i] = 1;
|
---|
181 | }
|
---|
182 | }
|
---|
183 | }
|
---|
184 | }
|
---|
185 | }
|
---|
186 | //******************************************************************************
|
---|
187 | //******************************************************************************
|
---|
188 |
|
---|
189 | #endif
|
---|