Use futimes() instead of utime() to implement SetFileTime, so that it
[wine.git] / programs / winedbg / debugger.h
blobc85d7f2916654913dcadc49e41ceac0554b6dadc
1 /*
2 * Debugger definitions
4 * Copyright 1995 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __WINE_DEBUGGER_H
22 #define __WINE_DEBUGGER_H
24 #include <assert.h>
25 #include <stdarg.h>
27 #include "windef.h"
28 #include "winbase.h"
29 #include "ntstatus.h"
31 #ifdef __i386__
32 #define STEP_FLAG 0x00000100 /* single step flag */
33 #define V86_FLAG 0x00020000
34 #endif
36 #define SYM_FUNC 0x0
37 #define SYM_DATA 0x1
38 #define SYM_WIN32 0x2
39 #define SYM_WINE 0x4
40 #define SYM_INVALID 0x8
41 #define SYM_TRAMPOLINE 0x10
42 #define SYM_STEP_THROUGH 0x20
44 enum debug_type {DT_BASIC, DT_POINTER, DT_ARRAY, DT_STRUCT, DT_ENUM,
45 DT_FUNC, DT_BITFIELD};
47 enum debug_type_basic {DT_BASIC_INT = 1, DT_BASIC_CHAR, DT_BASIC_LONGINT, DT_BASIC_UINT,
48 DT_BASIC_ULONGINT, DT_BASIC_LONGLONGINT, DT_BASIC_ULONGLONGINT,
49 DT_BASIC_SHORTINT, DT_BASIC_USHORTINT, DT_BASIC_SCHAR, DT_BASIC_UCHAR,
50 DT_BASIC_FLOAT, DT_BASIC_LONGDOUBLE, DT_BASIC_DOUBLE,
51 DT_BASIC_CMPLX_INT, DT_BASIC_CMPLX_FLOAT, DT_BASIC_CMPLX_DOUBLE,
52 DT_BASIC_CMPLX_LONGDOUBLE, DT_BASIC_VOID,
53 /* modifier on size isn't possible on current types definitions
54 * so we need to add more types... */
55 DT_BASIC_BOOL1, DT_BASIC_BOOL2, DT_BASIC_BOOL4,
56 /* this is not really a basic type... */
57 DT_BASIC_STRING,
58 /* this is for historical reasons... should take care of it RSN */
59 DT_BASIC_CONST_INT,
60 /* not so basic, but handy */
61 DT_BASIC_CONTEXT,
62 /* to be kept as last... sentinel entry... do not use */
63 DT_BASIC_LAST};
66 * Return values for DEBUG_CheckLinenoStatus. Used to determine
67 * what to do when the 'step' command is given.
69 #define FUNC_HAS_NO_LINES (0)
70 #define NOT_ON_LINENUMBER (1)
71 #define AT_LINENUMBER (2)
72 #define FUNC_IS_TRAMPOLINE (3)
74 typedef struct
76 DWORD seg; /* 0xffffffff means current default segment (cs or ds) */
77 DWORD off;
78 } DBG_ADDR;
80 typedef struct
82 struct datatype* type;
83 int cookie; /* DV_??? */
84 /* DV_TARGET references an address in debugger's address space, whereas DV_HOST
85 * references the debuggee address space
87 # define DV_TARGET 0xF00D
88 # define DV_HOST 0x50DA
89 # define DV_INVALID 0x0000
91 DBG_ADDR addr;
92 } DBG_VALUE;
94 struct list_id
96 char * sourcefile;
97 int line;
100 struct wine_lines {
101 unsigned long line_number;
102 DBG_ADDR pc_offset;
105 struct symbol_info
107 struct name_hash * sym;
108 struct list_id list;
111 typedef struct wine_lines WineLineNo;
114 * This structure holds information about stack variables, function
115 * parameters, and register variables, which are all local to this
116 * function.
118 struct wine_locals {
119 unsigned int regno:8; /* For register symbols */
120 signed int offset:24; /* offset from esp/ebp to symbol */
121 unsigned int pc_start; /* For RBRAC/LBRAC */
122 unsigned int pc_end; /* For RBRAC/LBRAC */
123 char * name; /* Name of symbol */
124 struct datatype * type; /* Datatype of symbol */
127 typedef struct wine_locals WineLocals;
129 enum exec_mode
131 EXEC_CONT, /* Continuous execution */
132 EXEC_STEP_OVER, /* Stepping over a call to next source line */
133 EXEC_STEP_INSTR, /* Step to next source line, stepping in if needed */
134 EXEC_STEPI_OVER, /* Stepping over a call */
135 EXEC_STEPI_INSTR, /* Single-stepping an instruction */
136 EXEC_FINISH, /* Step until we exit current frame */
137 EXEC_STEP_OVER_TRAMPOLINE, /* Step over trampoline. Requires that
138 * we dig the real return value off the stack
139 * and set breakpoint there - not at the
140 * instr just after the call.
144 enum dbg_mode
146 MODE_INVALID, MODE_16, MODE_32, MODE_VM86
149 enum exit_mode /* of exception handling */
151 EXIT_CONTINUE, /* continue execution */
152 EXIT_PASS, /* pass exception back to app (1st chance) */
153 EXIT_DETACH, /* detach debugger */
154 EXIT_QUIT, /* exit debugger and kill debuggee */
157 #define DBG_BREAK 0
158 #define DBG_WATCH 1
160 typedef struct
162 DBG_ADDR addr;
163 WORD enabled : 1,
164 type : 1,
165 is32 : 1,
166 refcount : 13;
167 WORD skipcount;
168 union {
169 struct {
170 BYTE opcode;
171 BOOL (*func)(void);
172 } b;
173 struct {
174 BYTE rw : 1,
175 len : 2;
176 BYTE reg;
177 DWORD oldval;
178 } w;
179 } u;
180 struct expr * condition;
181 } DBG_BREAKPOINT;
183 /* Wine extension; Windows doesn't have a name for this code. This is an
184 undocumented exception understood by MS VC debugger, allowing the program
185 to name a particular thread. Search google.com or deja.com for "0x406d1388"
186 for more info. */
187 #define EXCEPTION_NAME_THREAD 0x406D1388
189 /* Helper structure */
190 typedef struct tagTHREADNAME_INFO
192 DWORD dwType; /* Must be 0x1000 */
193 LPCTSTR szName; /* Pointer to name - limited to 9 bytes (8 characters + terminator) */
194 DWORD dwThreadID; /* Thread ID (-1 = caller thread) */
195 DWORD dwFlags; /* Reserved for future use. Must be zero. */
196 } THREADNAME_INFO;
198 typedef struct tagDBG_THREAD {
199 struct tagDBG_PROCESS* process;
200 HANDLE handle;
201 DWORD tid;
202 LPVOID start;
203 LPVOID teb;
204 int wait_for_first_exception;
205 enum exec_mode exec_mode; /* mode the thread is run (step/run...) */
206 int exec_count; /* count of mode operations */
207 enum dbg_mode dbg_mode; /* mode (VM86, 32bit, 16bit) */
208 DBG_BREAKPOINT stepOverBP;
209 char name[9];
210 struct tagDBG_THREAD* next;
211 struct tagDBG_THREAD* prev;
212 } DBG_THREAD;
214 typedef struct tagDBG_DELAYED_BP {
215 BOOL is_symbol;
216 union {
217 struct {
218 int lineno;
219 char* name;
220 } symbol;
221 DBG_VALUE value;
222 } u;
223 } DBG_DELAYED_BP;
225 typedef struct tagDBG_PROCESS {
226 HANDLE handle;
227 DWORD pid;
228 const char* imageName;
229 DBG_THREAD* threads;
230 int num_threads;
231 unsigned continue_on_first_exception;
232 struct tagDBG_MODULE** modules;
233 int num_modules;
234 unsigned long dbg_hdr_addr;
235 DBG_DELAYED_BP* delayed_bp;
236 int num_delayed_bp;
238 * This is an index we use to keep track of the debug information
239 * when we have multiple sources. We use the same database to also
240 * allow us to do an 'info shared' type of deal, and we use the index
241 * to eliminate duplicates.
243 int next_index;
244 struct tagDBG_PROCESS* next;
245 struct tagDBG_PROCESS* prev;
246 } DBG_PROCESS;
248 extern DBG_PROCESS* DEBUG_CurrProcess;
249 extern DBG_THREAD* DEBUG_CurrThread;
250 extern DWORD DEBUG_CurrTid;
251 extern DWORD DEBUG_CurrPid;
252 extern CONTEXT DEBUG_context;
253 extern BOOL DEBUG_InteractiveP;
254 extern enum exit_mode DEBUG_ExitMode;
255 extern HANDLE DEBUG_hParserInput;
256 extern HANDLE DEBUG_hParserOutput;
258 #define DEBUG_READ_MEM(addr, buf, len) \
259 (ReadProcessMemory(DEBUG_CurrProcess->handle, (addr), (buf), (len), NULL))
261 #define DEBUG_WRITE_MEM(addr, buf, len) \
262 (WriteProcessMemory(DEBUG_CurrProcess->handle, (addr), (buf), (len), NULL))
264 #define DEBUG_READ_MEM_VERBOSE(addr, buf, len) \
265 (DEBUG_READ_MEM((addr), (buf), (len)) || (DEBUG_InvalLinAddr( addr ),0))
267 #define DEBUG_WRITE_MEM_VERBOSE(addr, buf, len) \
268 (DEBUG_WRITE_MEM((addr), (buf), (len)) || (DEBUG_InvalLinAddr( addr ),0))
270 enum DbgInfoLoad {DIL_DEFERRED, DIL_LOADED, DIL_NOINFO, DIL_NOT_SUPPORTED, DIL_ERROR};
271 enum DbgModuleType {DMT_UNKNOWN, DMT_ELF, DMT_NE, DMT_PE};
273 typedef struct tagDBG_MODULE {
274 void* load_addr;
275 unsigned long size;
276 const char* module_name;
277 enum DbgInfoLoad dil;
278 enum DbgModuleType type;
279 unsigned short main : 1;
280 short int dbg_index;
281 HMODULE handle;
282 struct tagMSC_DBG_INFO* msc_dbg_info;
283 struct tagELF_DBG_INFO* elf_dbg_info;
284 } DBG_MODULE;
286 typedef struct {
287 DWORD val;
288 const char* name;
289 LPDWORD pval;
290 struct datatype* type;
291 } DBG_INTVAR;
293 #define OFFSET_OF(__c,__f) ((int)(((char*)&(((__c*)0)->__f))-((char*)0)))
295 enum get_sym_val {gsv_found, gsv_unknown, gsv_aborted};
297 /* from winelib.so */
298 extern void DEBUG_ExternalDebugger(void);
300 /* debugger/break.c */
301 extern void DEBUG_SetBreakpoints( BOOL set );
302 extern BOOL DEBUG_AddBreakpoint( const DBG_VALUE *addr, BOOL (*func)(void), BOOL verbose );
303 extern BOOL DEBUG_AddBreakpointFromValue( const DBG_VALUE *addr );
304 extern void DEBUG_AddBreakpointFromId( const char *name, int lineno );
305 extern void DEBUG_AddBreakpointFromLineno( int lineno );
306 extern void DEBUG_AddWatchpoint( const DBG_VALUE *addr, int is_write );
307 extern void DEBUG_AddWatchpointFromId( const char *name );
308 extern void DEBUG_CheckDelayedBP( void );
309 extern void DEBUG_DelBreakpoint( int num );
310 extern void DEBUG_EnableBreakpoint( int num, BOOL enable );
311 extern void DEBUG_InfoBreakpoints(void);
312 extern BOOL DEBUG_HandleTrap(void);
313 extern BOOL DEBUG_ShouldContinue( DBG_ADDR* addr, DWORD code, int* count );
314 extern void DEBUG_SuspendExecution( void );
315 extern void DEBUG_RestartExecution( int count );
316 extern BOOL DEBUG_IsFctReturn(void);
317 extern int DEBUG_AddBPCondition(int bpnum, struct expr * exp);
319 /* debugger/db_disasm.c */
320 extern void DEBUG_Disasm( DBG_ADDR *addr, int display );
322 /* debugger/dbg.y */
323 extern void DEBUG_Parser(LPCSTR);
324 extern void DEBUG_Exit(DWORD);
326 /* debugger/debug.l */
327 extern void DEBUG_FlushSymbols(void);
328 extern char*DEBUG_MakeSymbol(const char*);
329 extern int DEBUG_ReadLine(const char* pfx, char* buffer, int size);
331 /* debugger/display.c */
332 extern int DEBUG_DoDisplay(void);
333 extern int DEBUG_AddDisplay(struct expr * exp, int count, char format, int local_frame);
334 extern int DEBUG_DelDisplay(int displaynum);
335 extern int DEBUG_InfoDisplay(void);
336 extern int DEBUG_EnableDisplay(int displaynum, int enable);
338 /* debugger/elf.c */
339 #define ELF_INFO_PATH 0x0001
340 #define ELF_INFO_DEBUG_HEADER 0x0002
341 #define ELF_INFO_SEGMENTS 0x0004
342 #define ELF_INFO_MODULE 0x0008
344 struct elf_info
346 unsigned flags;
347 char* elf_path; /* path to unix elf path, if ELF_INFO_PATH is set */
348 size_t elf_path_len;
349 void* load_addr; /* 32 bit linear addr, where ELF module is loaded */
350 unsigned long size; /* size of elf module (guessed) */
351 unsigned long dbg_hdr_addr; /* address of debug header (if ELF_INFO_DEBUG_HEADER is set) */
352 unsigned long segments[3]; /* addresses of .text, .data and .bss segments (not filled yet) */
355 extern enum DbgInfoLoad DEBUG_ReadWineLoaderDbgInfo(HANDLE hProcess, struct elf_info* elf_info);
356 extern BOOL DEBUG_SetElfSoLoadBreakpoint(const struct elf_info* elf_info);
358 /* debugger/expr.c */
359 extern void DEBUG_FreeExprMem(void);
360 struct expr * DEBUG_IntVarExpr(const char* name);
361 struct expr * DEBUG_SymbolExpr(const char * name);
362 struct expr * DEBUG_ConstExpr(int val);
363 struct expr * DEBUG_StringExpr(const char * str);
364 struct expr * DEBUG_SegAddr(struct expr *, struct expr *);
365 struct expr * DEBUG_USConstExpr(unsigned int val);
366 struct expr * DEBUG_BinopExpr(int oper, struct expr *, struct expr *);
367 struct expr * DEBUG_UnopExpr(int oper, struct expr *);
368 struct expr * DEBUG_StructPExpr(struct expr *, const char * element);
369 struct expr * DEBUG_StructExpr(struct expr *, const char * element);
370 struct expr * DEBUG_ArrayExpr(struct expr *, struct expr * index);
371 struct expr * DEBUG_CallExpr(const char *, int nargs, ...);
372 struct expr * DEBUG_TypeCastExpr(struct datatype *, struct expr *);
373 extern DBG_VALUE DEBUG_EvalExpr(struct expr *);
374 extern int DEBUG_DelDisplay(int displaynum);
375 extern struct expr * DEBUG_CloneExpr(const struct expr * exp);
376 extern int DEBUG_FreeExpr(struct expr * exp);
377 extern int DEBUG_DisplayExpr(const struct expr * exp);
379 /* debugger/hash.c */
380 extern struct name_hash * DEBUG_AddSymbol( const char *name,
381 const DBG_VALUE *addr,
382 const char *sourcefile,
383 int flags);
384 extern enum get_sym_val DEBUG_GetSymbolValue( const char * name, const int lineno, DBG_VALUE *addr, int );
385 extern const char * DEBUG_FindNearestSymbol( const DBG_ADDR *addr, int flag,
386 struct name_hash ** rtn,
387 unsigned int ebp,
388 struct list_id * source);
389 extern void DEBUG_ReadSymbolTable( const char * filename, unsigned long offset );
390 extern void DEBUG_AddLineNumber( struct name_hash * func, int line_num,
391 unsigned long offset );
392 extern struct wine_locals *
393 DEBUG_AddLocal( struct name_hash * func, int regno,
394 int offset,
395 int pc_start,
396 int pc_end,
397 char * name);
398 extern int DEBUG_CheckLinenoStatus(const DBG_ADDR *addr);
399 extern void DEBUG_GetFuncInfo(struct list_id * ret, const char * file,
400 const char * func);
401 extern int DEBUG_SetSymbolSize(struct name_hash * sym, unsigned int len);
402 extern int DEBUG_SetSymbolBPOff(struct name_hash * sym, unsigned int len);
403 extern int DEBUG_GetSymbolAddr(struct name_hash * sym, DBG_ADDR * addr);
404 extern int DEBUG_cmp_sym(const void * p1, const void * p2);
405 extern BOOL DEBUG_GetLineNumberAddr( const struct name_hash *, const int lineno,
406 DBG_ADDR *addr, int bp_flag );
408 extern int DEBUG_SetLocalSymbolType(struct wine_locals * sym,
409 struct datatype * type);
410 extern BOOL DEBUG_Normalize(struct name_hash * nh );
411 void DEBUG_InfoSymbols(const char* str);
412 const char *DEBUG_GetSymbolName(const struct name_hash *);
414 /* debugger/info.c */
415 extern void DEBUG_PrintBasic( const DBG_VALUE* value, int count, char format );
416 extern struct symbol_info DEBUG_PrintAddress( const DBG_ADDR *addr,
417 enum dbg_mode mode, int flag );
418 extern void DEBUG_Help(void);
419 extern void DEBUG_HelpInfo(void);
420 extern struct symbol_info DEBUG_PrintAddressAndArgs( const DBG_ADDR *addr,
421 enum dbg_mode mode,
422 unsigned int ebp,
423 int flag );
424 extern void DEBUG_InfoClass(const char* clsName);
425 extern void DEBUG_WalkClasses(void);
426 extern void DEBUG_DumpModule(DWORD mod);
427 extern void DEBUG_WalkModules(void);
428 extern void DEBUG_WalkProcess(void);
429 extern void DEBUG_WalkThreads(void);
430 extern void DEBUG_WalkExceptions(DWORD tid);
431 extern void DEBUG_InfoSegments(DWORD s, int v);
432 extern void DEBUG_InfoVirtual(DWORD pid);
433 extern void DEBUG_InfoWindow(HWND hWnd);
434 extern void DEBUG_WalkWindows(HWND hWnd, int indent);
435 extern void DEBUG_DbgChannel(BOOL add, const char* chnl, const char* name);
437 /* debugger/memory.c */
438 extern int DEBUG_ReadMemory( const DBG_VALUE* value );
439 extern void DEBUG_WriteMemory( const DBG_VALUE* val, int value );
440 extern void DEBUG_ExamineMemory( const DBG_VALUE *addr, int count, char format);
441 extern void DEBUG_InvalAddr( const DBG_ADDR* addr );
442 extern void DEBUG_InvalLinAddr( void* addr );
443 extern DWORD DEBUG_ToLinear( const DBG_ADDR *address );
444 extern void DEBUG_GetCurrentAddress( DBG_ADDR * );
445 extern BOOL DEBUG_GrabAddress( DBG_VALUE* value, BOOL fromCode );
446 extern enum dbg_mode DEBUG_GetSelectorType( WORD sel );
447 #ifdef __i386__
448 extern void DEBUG_FixAddress( DBG_ADDR *address, DWORD def );
449 extern int DEBUG_IsSelectorSystem( WORD sel );
450 #endif
451 extern int DEBUG_PrintStringA(const DBG_ADDR* address, int len);
452 extern int DEBUG_PrintStringW(const DBG_ADDR* address, int len);
454 /* debugger/module.c */
455 extern DBG_MODULE* DEBUG_AddModule(const char* name, enum DbgModuleType type,
456 void* mod_addr, unsigned long size, HMODULE hmodule);
457 extern int DEBUG_LoadEntryPoints( const char * prefix );
458 extern DBG_MODULE* DEBUG_FindModuleByName(const char* name, enum DbgModuleType type);
459 extern DBG_MODULE* DEBUG_FindModuleByHandle(HANDLE handle, enum DbgModuleType type);
460 extern DBG_MODULE* DEBUG_FindModuleByAddr(void* addr, enum DbgModuleType type);
461 extern DBG_MODULE* DEBUG_GetProcessMainModule(DBG_PROCESS* process);
462 extern void DEBUG_ReportDIL(enum DbgInfoLoad dil, const char* pfx,
463 const char* filename, void *load_addr);
464 extern void DEBUG_InfoShare(void);
466 /* debugger/msc.c */
467 extern void DEBUG_InitCVDataTypes(void);
468 extern enum DbgInfoLoad DEBUG_ProcessDebugDirectory( DBG_MODULE *module, const BYTE* file_map,
469 PIMAGE_DEBUG_DIRECTORY dbg, int nDbg );
471 /* debugger/pe.c */
472 extern void* DEBUG_MapDebugInfoFile(const char* name, DWORD offset, DWORD size,
473 HANDLE* hFile, HANDLE* hMap);
474 extern void DEBUG_UnmapDebugInfoFile(HANDLE hFile, HANDLE hMap, const void* addr);
475 extern void DEBUG_LoadPEModule( const char* name, HANDLE hFile, void *base );
476 extern enum DbgInfoLoad DEBUG_RegisterMSCDebugInfo(DBG_MODULE* module, HANDLE hFile,
477 void* nth, unsigned long nth_ofs);
478 extern enum DbgInfoLoad DEBUG_RegisterStabsDebugInfo(DBG_MODULE* module,
479 HANDLE hFile, void* nth,
480 unsigned long nth_ofs);
481 extern enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
482 void* _nth, unsigned long nth_ofs);
484 /* debugger/registers.c */
485 extern void DEBUG_InfoRegisters(const CONTEXT* ctx);
486 extern BOOL DEBUG_ValidateRegisters(void);
488 /* debugger/source.c */
489 extern void DEBUG_ShowDir(void);
490 extern void DEBUG_AddPath(const char * path);
491 extern void DEBUG_List(struct list_id * line1, struct list_id * line2,
492 int delta);
493 extern void DEBUG_NukePath(void);
494 extern void DEBUG_Disassemble(const DBG_VALUE *, const DBG_VALUE*, int offset);
495 extern BOOL DEBUG_DisassembleInstruction(DBG_ADDR *addr);
497 /* debugger/stack.c */
498 extern void DEBUG_InfoStack(void);
499 extern void DEBUG_BackTrace(DWORD threadID, BOOL noisy);
500 extern int DEBUG_InfoLocals(void);
501 extern int DEBUG_SetFrame(int newframe);
502 extern int DEBUG_GetCurrentFrame(struct name_hash ** name,
503 unsigned int * eip,
504 unsigned int * ebp);
506 /* debugger/stabs.c */
507 extern enum DbgInfoLoad DEBUG_ParseStabs(const char* addr, void *load_offset,
508 unsigned int staboff, int stablen,
509 unsigned int strtaboff, int strtablen);
511 /* debugger/types.c */
512 extern int DEBUG_nchar;
513 extern void DEBUG_InitTypes(void);
514 extern struct datatype * DEBUG_NewDataType(enum debug_type xtype,
515 const char * typename);
516 extern unsigned int DEBUG_TypeDerefPointer(const DBG_VALUE *value,
517 struct datatype ** newtype);
518 extern int DEBUG_AddStructElement(struct datatype * dt,
519 char * name, struct datatype * type,
520 int offset, int size);
521 extern int DEBUG_SetStructSize(struct datatype * dt, int size);
522 extern int DEBUG_SetPointerType(struct datatype * dt, struct datatype * dt2);
523 extern int DEBUG_SetArrayParams(struct datatype * dt, int min, int max,
524 struct datatype * dt2);
525 extern void DEBUG_Print( const DBG_VALUE *addr, int count, char format, int level );
526 extern unsigned int DEBUG_FindStructElement(DBG_VALUE * addr,
527 const char * ele_name, int * tmpbuf);
528 extern struct datatype * DEBUG_GetPointerType(struct datatype * dt);
529 extern int DEBUG_GetObjectSize(struct datatype * dt);
530 extern unsigned int DEBUG_ArrayIndex(const DBG_VALUE * addr, DBG_VALUE * result,
531 int index);
532 extern struct datatype * DEBUG_FindOrMakePointerType(struct datatype * reftype);
533 extern long long int DEBUG_GetExprValue(const DBG_VALUE * addr, const char ** format);
534 extern int DEBUG_SetBitfieldParams(struct datatype * dt, int offset,
535 int nbits, struct datatype * dt2);
536 extern int DEBUG_CopyFieldlist(struct datatype * dt, struct datatype * dt2);
537 extern const char* DEBUG_GetName(struct datatype * dt);
538 extern enum debug_type DEBUG_GetType(struct datatype * dt);
539 extern struct datatype * DEBUG_TypeCast(enum debug_type, const char *);
540 extern int DEBUG_PrintTypeCast(const struct datatype *);
541 extern int DEBUG_PrintType(const DBG_VALUE* addr);
542 extern struct datatype * DEBUG_GetBasicType(enum debug_type_basic);
543 extern int DEBUG_DumpTypes(void);
545 /* debugger/winedbg.c */
546 extern void DEBUG_OutputA(const char* buffer, int len);
547 extern void DEBUG_OutputW(const WCHAR* buffer, int len);
548 #ifdef __GNUC__
549 extern int DEBUG_Printf(const char* format, ...) __attribute__((format (printf,1,2)));
550 #else
551 extern int DEBUG_Printf(const char* format, ...);
552 #endif
553 extern DBG_INTVAR* DEBUG_GetIntVar(const char*);
554 extern BOOL DEBUG_Attach(DWORD pid, BOOL cofe, BOOL wfe);
555 extern BOOL DEBUG_Detach(void);
556 extern void DEBUG_Run(const char* args);
557 extern DBG_PROCESS* DEBUG_AddProcess(DWORD pid, HANDLE h, const char* imageName);
558 extern DBG_PROCESS* DEBUG_GetProcess(DWORD pid);
559 extern void DEBUG_DelProcess(DBG_PROCESS* p);
560 extern DBG_THREAD* DEBUG_AddThread(DBG_PROCESS* p, DWORD tid, HANDLE h, LPVOID start, LPVOID teb);
561 extern DBG_THREAD* DEBUG_GetThread(DBG_PROCESS* p, DWORD tid);
562 extern void DEBUG_DelThread(DBG_THREAD* t);
563 extern BOOL DEBUG_ProcessGetString(char* buffer, int size, HANDLE hp, LPSTR addr);
564 extern BOOL DEBUG_ProcessGetStringIndirect(char* buffer, int size, HANDLE hp, LPVOID addr, BOOL unicode);
565 extern void DEBUG_WaitNextException(DWORD cont, int count, int mode);
566 extern BOOL DEBUG_InterruptDebuggee(void);
567 extern int curr_frame;
569 /* gdbproxy.c */
570 extern BOOL DEBUG_GdbRemote(unsigned int);
572 extern void *DBG_alloc(size_t size);
573 extern void *DBG_realloc(void *ptr, size_t size);
574 extern void DBG_free(void *ptr);
575 extern char *DBG_strdup(const char *str);
577 #define DEBUG_STATUS_OFFSET 0x80003000
578 #define DEBUG_STATUS_INTERNAL_ERROR (DEBUG_STATUS_OFFSET+0)
579 #define DEBUG_STATUS_NO_SYMBOL (DEBUG_STATUS_OFFSET+1)
580 #define DEBUG_STATUS_DIV_BY_ZERO (DEBUG_STATUS_OFFSET+2)
581 #define DEBUG_STATUS_BAD_TYPE (DEBUG_STATUS_OFFSET+3)
582 #define DEBUG_STATUS_NO_FIELD (DEBUG_STATUS_OFFSET+4)
583 #define DEBUG_STATUS_ABORT (DEBUG_STATUS_OFFSET+5)
585 extern DBG_INTVAR DEBUG_IntVars[];
587 #define DBG_IVARNAME(_var) DEBUG_IV_##_var
588 #define DBG_IVARSTRUCT(_var) DEBUG_IntVars[DBG_IVARNAME(_var)]
589 #define DBG_IVAR(_var) (*(DBG_IVARSTRUCT(_var).pval))
590 #define INTERNAL_VAR(_var,_val,_ref,_typ) DBG_IVARNAME(_var),
591 enum debug_int_var {
592 #include "intvar.h"
593 DBG_IV_LAST
595 #undef INTERNAL_VAR
597 #endif /* __WINE_DEBUGGER_H */