debugger.h 21.8 KB
Newer Older
Alexandre Julliard's avatar
Alexandre Julliard committed
1 2 3 4
/*
 * Debugger definitions
 *
 * Copyright 1995 Alexandre Julliard
5 6 7 8 9 10 11 12 13 14 15 16 17
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Alexandre Julliard's avatar
Alexandre Julliard committed
19 20
 */

Alexandre Julliard's avatar
Alexandre Julliard committed
21 22
#ifndef __WINE_DEBUGGER_H
#define __WINE_DEBUGGER_H
Alexandre Julliard's avatar
Alexandre Julliard committed
23

24
#include <assert.h>
25 26
#include <stdarg.h>

27 28
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
29 30
#include "ntstatus.h"
#define WIN32_NO_STATUS
31
#define WIN32_LEAN_AND_MEAN
32
#include "windef.h"
33
#include "winbase.h"
34
#include "winver.h"
35
#include "winternl.h"
36 37
#include "dbghelp.h"
#include "cvconst.h"
38
#include "objbase.h"
39
#include "oaidl.h"
40
#include <wine/list.h>
Alexandre Julliard's avatar
Alexandre Julliard committed
41

42
#define ADDRSIZE        (be_cpu->pointer_size)
43 44
#define ADDRWIDTH       (ADDRSIZE * 2)

45
/* the debugger uses these exceptions for its internal use */
46 47 48 49 50 51 52 53 54
#define	DEBUG_STATUS_OFFSET		0x80003000
#define	DEBUG_STATUS_INTERNAL_ERROR	(DEBUG_STATUS_OFFSET+0) /* something went wrong */
#define	DEBUG_STATUS_NO_SYMBOL		(DEBUG_STATUS_OFFSET+1) /* no symbol found in lookup */
#define	DEBUG_STATUS_DIV_BY_ZERO	(DEBUG_STATUS_OFFSET+2)
#define	DEBUG_STATUS_BAD_TYPE		(DEBUG_STATUS_OFFSET+3) /* no type found, when type was expected */
#define DEBUG_STATUS_NO_FIELD		(DEBUG_STATUS_OFFSET+4) /* when dereferencing a struct, the field was not found */
#define DEBUG_STATUS_ABORT              (DEBUG_STATUS_OFFSET+5) /* user aborted on going action */
#define DEBUG_STATUS_CANT_DEREF         (DEBUG_STATUS_OFFSET+6) /* either not deref:able, or index out of bounds */
#define DEBUG_STATUS_NOT_AN_INTEGER     (DEBUG_STATUS_OFFSET+7) /* requiring an integral value */
Alexandre Julliard's avatar
Alexandre Julliard committed
55 56

/*
57
 * Return values for symbol_get_function_line_status.  Used to determine
Alexandre Julliard's avatar
Alexandre Julliard committed
58 59
 * what to do when the 'step' command is given.
 */
60
enum dbg_line_status
Alexandre Julliard's avatar
Alexandre Julliard committed
61
{
62 63 64 65
    dbg_no_line_info,
    dbg_not_on_a_line_number,
    dbg_on_a_line_number,
    dbg_in_a_thunk,
Alexandre Julliard's avatar
Alexandre Julliard committed
66 67
};

68
enum dbg_internal_types
Alexandre Julliard's avatar
Alexandre Julliard committed
69
{
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
    dbg_itype_first             = 0xffffff00,
    dbg_itype_unsigned_int,
    dbg_itype_signed_int,
    dbg_itype_signed_char_int,
    dbg_itype_unsigned_char_int,
    dbg_itype_unsigned_short_int,
    dbg_itype_signed_short_int,
    dbg_itype_unsigned_long_int,
    dbg_itype_signed_long_int,
    dbg_itype_unsigned_longlong_int,
    dbg_itype_signed_longlong_int,
    dbg_itype_char,
    dbg_itype_wchar,
    dbg_itype_short_real, /* aka float */
    dbg_itype_real,       /* aka double */
    dbg_itype_long_real,  /* aka long double */
    dbg_itype_astring,
    dbg_itype_ustring,
88
    dbg_itype_segptr,     /* hack for segmented pointers */
89
    dbg_itype_m128a,      /* 128-bit (XMM) registers */
90
    dbg_itype_none              = 0xffffffff
Alexandre Julliard's avatar
Alexandre Julliard committed
91 92
};

93 94 95 96 97 98 99 100 101
/* type description (in the following order):
 * - if 'id' is dbg_itype_none (whatever 'module' value), the type isn't known
 * - if 'module' is 0, it's an internal type (id is one of dbg_itype...)
 * - if 'module' is non 0, then 'id' is a type ID referring to module (loaded in
 *   dbghelp) which (linear) contains address 'module'.
 */
struct dbg_type
{
    unsigned long       id;
102
    DWORD_PTR           module;
103 104
};

105 106 107 108 109
struct dbg_lvalue       /* structure to hold left-values... */
{
    int			cookie;	/* DLV_??? */
/* DLV_TARGET references an address in debuggee's address space, whereas DLV_HOST
 * references the winedbg's address space
Alexandre Julliard's avatar
Alexandre Julliard committed
110
 */
111 112
#	define	DLV_TARGET	0xF00D
#	define	DLV_HOST	0x50DA
113
    ADDRESS64           addr;
114
    struct dbg_type     type;
Alexandre Julliard's avatar
Alexandre Julliard committed
115 116
};

117
enum dbg_exec_mode
118
{
119 120 121 122 123 124 125 126 127 128
    dbg_exec_cont,       		/* Continue execution */
    dbg_exec_step_over_line,  		/* Stepping over a call to next source line */
    dbg_exec_step_into_line,  		/* Step to next source line, stepping in if needed */
    dbg_exec_step_over_insn,  		/* Stepping over a call */
    dbg_exec_step_into_insn,  		/* Single-stepping an instruction */
    dbg_exec_finish,		        /* Single-step until we exit current frame */
#if 0
    EXEC_STEP_OVER_TRAMPOLINE, 	/* Step over trampoline.  Requires that we dig the real
                                 * return value off the stack and set breakpoint there - 
                                 * not at the instr just after the call.
129
				 */
130
#endif
131
};
132

133
struct dbg_breakpoint
134
{
135
    ADDRESS64           addr;
136 137 138 139
    unsigned long       enabled : 1,
                        xpoint_type : 2,
                        refcount : 13,
                        skipcount : 16;
140
    unsigned long       info;
141 142 143
    struct              /* only used for watchpoints */
    {
        BYTE		len : 2;
144
        DWORD64		oldval;
145 146
    } w;
    struct expr*        condition;
147 148
};

149 150 151 152 153 154 155 156 157
/* used for C++ exceptions in msvcrt
 * parameters:
 * [0] CXX_FRAME_MAGIC
 * [1] pointer to exception object
 * [2] pointer to type
 */
#define CXX_EXCEPTION                       0xe06d7363
#define CXX_FRAME_MAGIC                     0x19930520

158 159 160 161 162 163 164 165 166 167
/* Wine extension; Windows doesn't have a name for this code.  This is an
   undocumented exception understood by MS VC debugger, allowing the program
   to name a particular thread.  Search google.com or deja.com for "0x406d1388"
   for more info. */
#define EXCEPTION_NAME_THREAD               0x406D1388

/* Helper structure */
typedef struct tagTHREADNAME_INFO
{
   DWORD   dwType;     /* Must be 0x1000 */
168
   LPCSTR  szName;     /* Pointer to name - limited to 9 bytes (8 characters + terminator) */
169 170 171 172
   DWORD   dwThreadID; /* Thread ID (-1 = caller thread) */
   DWORD   dwFlags;    /* Reserved for future use.  Must be zero. */
} THREADNAME_INFO;

173 174
struct dbg_thread
{
175
    struct list                 entry;
176
    struct dbg_process* 	process;
177 178
    HANDLE			handle;
    DWORD			tid;
179 180
    void*			teb;
    enum dbg_exec_mode          exec_mode;      /* mode the thread is run (step/run...) */
181
    int			        exec_count;     /* count of mode operations */
182
    ADDRESS_MODE	        addr_mode;      /* mode */
183
    int                         stopped_xpoint; /* xpoint on which the thread has stopped (-1 if none) */
184
    struct dbg_breakpoint	step_over_bp;
185
    char                        name[9];
186
    BOOL                        in_exception;   /* TRUE if thread stopped with an exception */
187 188 189
    BOOL                        first_chance;   /* TRUE if thread stopped with a first chance exception
                                                 *      - only valid when in_exception is TRUE
                                                 */
190
    EXCEPTION_RECORD            excpt_record;   /* only valid when in_exception is TRUE */
191 192
    struct
    {
193 194
        ADDRESS64               addr_pc;
        ADDRESS64               addr_frame;
195
        ADDRESS64               addr_stack;
196 197 198
        DWORD_PTR               linear_pc;
        DWORD_PTR               linear_frame;
        DWORD_PTR               linear_stack;
199 200
        CONTEXT                 context;        /* context we got out of stackwalk for this frame */
        BOOL                    is_ctx_valid;   /* is the context above valid */
201 202 203
    }*                          frames;
    int                         num_frames;
    int                         curr_frame;
204
};
205

206 207
struct dbg_delayed_bp
{
208
    BOOL                        is_symbol;
209
    BOOL                        software_bp;
210 211 212 213
    union
    {
        struct
        {
214 215 216
            int				lineno;
            char*			name;
        } symbol;
217
        ADDRESS64               addr;
218
    } u;
219
};
220

221 222 223
#define MAX_BREAKPOINTS 100
struct dbg_process
{
224
    struct list                 entry;
225 226
    HANDLE			handle;
    DWORD			pid;
227
    const struct be_process_io* process_io;
228
    void*                       pio_data;
229
    const WCHAR*		imageName;
230
    struct list           	threads;
231
    BOOL                        continue_on_first_exception : 1,
232
                                active_debuggee : 1;
233 234 235
    struct dbg_breakpoint       bp[MAX_BREAKPOINTS];
    unsigned                    next_bp;
    struct dbg_delayed_bp*      delayed_bp;
236
    int				num_delayed_bp;
237 238 239 240 241
    struct open_file_list*      source_ofiles;
    char*                       search_path;
    char                        source_current_file[MAX_PATH];
    int                         source_start_line;
    int                         source_end_line;
242 243
};

244 245 246
/* describes the way the debugger interacts with a given process */
struct be_process_io
{
247
    BOOL        (*close_process)(struct dbg_process*, BOOL);
248 249 250
    BOOL        (*read)(HANDLE, const void*, void*, SIZE_T, SIZE_T*);
    BOOL        (*write)(HANDLE, void*, const void*, SIZE_T, SIZE_T*);
    BOOL        (*get_selector)(HANDLE, DWORD, LDT_ENTRY*);
251 252
};

253
extern	struct dbg_process*	dbg_curr_process;
254
extern	DWORD_PTR	        dbg_curr_pid;
255
extern	struct dbg_thread*	dbg_curr_thread;
256
extern	DWORD_PTR	        dbg_curr_tid;
257 258
extern  CONTEXT 	        dbg_context;
extern  BOOL                    dbg_interactiveP;
259
extern  HANDLE                  dbg_houtput;
260 261

struct dbg_internal_var
262
{
263
    DWORD_PTR		        val;
264
    const char*		        name;
265
    DWORD_PTR		        *pval;
266
    unsigned long               typeid; /* always internal type */
267 268
};

269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285
enum sym_get_lval {sglv_found, sglv_unknown, sglv_aborted};

enum type_expr_e
{
    type_expr_type_id,
    type_expr_udt_class,
    type_expr_udt_struct,
    type_expr_udt_union,
    type_expr_enumeration
};

struct type_expr_t
{ 
    enum type_expr_e    type;
    unsigned            deref_count;
    union
    {
286
        struct dbg_type type;
287 288 289 290
        const char*     name;
    } u;
};

291 292
enum dbg_start {start_ok, start_error_parse, start_error_init};

293 294
  /* break.c */
extern void             break_set_xpoints(BOOL set);
295
extern BOOL             break_add_break(const ADDRESS64* addr, BOOL verbose, BOOL swbp);
296 297
extern BOOL             break_add_break_from_lvalue(const struct dbg_lvalue* value, BOOL swbp);
extern void             break_add_break_from_id(const char* name, int lineno, BOOL swbp);
298
extern void             break_add_break_from_lineno(const char *filename, int lineno, BOOL swbp);
299 300
extern void             break_add_watch_from_lvalue(const struct dbg_lvalue* lvalue, BOOL is_write);
extern void             break_add_watch_from_id(const char* name, BOOL is_write);
301 302
extern void             break_check_delayed_bp(void);
extern void             break_delete_xpoint(int num);
303
extern void             break_delete_xpoints_from_module(DWORD64 base);
304 305
extern void             break_enable_xpoint(int num, BOOL enable);
extern void             break_info(void);
306
extern void             break_adjust_pc(ADDRESS64* addr, DWORD code, BOOL first_chance, BOOL* is_break);
307
extern BOOL             break_should_continue(ADDRESS64* addr, DWORD code);
308 309 310 311
extern void             break_suspend_execution(void);
extern void             break_restart_execution(int count);
extern int              break_add_condition(int bpnum, struct expr* exp);

312
  /* crashdlg.c */
313
extern int              display_crash_dialog(void);
314
extern HANDLE           display_crash_details(HANDLE event);
315 316
extern int              msgbox_res_id(HWND hwnd, UINT textId, UINT captionId, UINT uType);

317
  /* dbg.y */
318
extern void             parser_handle(HANDLE);
319
extern int              input_read_line(const char* pfx, char* buffer, int size);
320
extern int              input_fetch_entire_line(const char* pfx, char** line);
321
extern HANDLE           parser_generate_command_file(const char*, ...);
322 323 324

  /* debug.l */
extern void             lexeme_flush(void);
325
extern char*            lexeme_alloc_size(int);
326 327

  /* display.c */
328 329 330 331 332
extern BOOL             display_print(void);
extern BOOL             display_add(struct expr* exp, int count, char format);
extern BOOL             display_delete(int displaynum);
extern BOOL             display_info(void);
extern BOOL             display_enable(int displaynum, int enable);
333 334 335 336 337

  /* expr.c */
extern void             expr_free_all(void);
extern struct expr*     expr_alloc_internal_var(const char* name);
extern struct expr*     expr_alloc_symbol(const char* name);
338 339
extern struct expr*     expr_alloc_sconstant(long int val);
extern struct expr*     expr_alloc_uconstant(long unsigned val);
340 341 342 343 344 345 346 347
extern struct expr*     expr_alloc_string(const char* str);
extern struct expr*     expr_alloc_binary_op(int oper, struct expr*, struct expr*);
extern struct expr*     expr_alloc_unary_op(int oper, struct expr*);
extern struct expr*     expr_alloc_pstruct(struct expr*, const char* element);
extern struct expr*     expr_alloc_struct(struct expr*, const char* element);
extern struct expr*     expr_alloc_func_call(const char*, int nargs, ...);
extern struct expr*     expr_alloc_typecast(struct type_expr_t*, struct expr*);
extern struct dbg_lvalue expr_eval(struct expr*);
Mike McCormack's avatar
Mike McCormack committed
348
extern struct expr*     expr_clone(const struct expr* exp, BOOL *local_binding);
349 350
extern BOOL             expr_free(struct expr* exp);
extern BOOL             expr_print(const struct expr* exp);
351 352 353 354

  /* info.c */
extern void             print_help(void);
extern void             info_help(void);
355
extern void             info_win32_module(DWORD64 mod);
356 357 358 359
extern void             info_win32_class(HWND hWnd, const char* clsName);
extern void             info_win32_window(HWND hWnd, BOOL detailed);
extern void             info_win32_processes(void);
extern void             info_win32_threads(void);
360
extern void             info_win32_frame_exceptions(DWORD tid);
361 362
extern void             info_win32_virtual(DWORD pid);
extern void             info_win32_segments(DWORD start, int length);
363
extern void             info_win32_exception(void);
364 365 366
extern void             info_wine_dbg_channel(BOOL add, const char* chnl, const char* name);

  /* memory.c */
367
extern BOOL             memory_read_value(const struct dbg_lvalue* lvalue, DWORD size, void* result);
368
extern BOOL             memory_write_value(const struct dbg_lvalue* val, DWORD size, void* value);
369
extern void             memory_examine(const struct dbg_lvalue *lvalue, int count, char format);
370 371 372
extern void*            memory_to_linear_addr(const ADDRESS64* address);
extern BOOL             memory_get_current_pc(ADDRESS64* address);
extern BOOL             memory_get_current_stack(ADDRESS64* address);
373
extern BOOL             memory_get_string(struct dbg_process* pcs, void* addr, BOOL in_debuggee, BOOL unicode, char* buffer, int size);
374
extern BOOL             memory_get_string_indirect(struct dbg_process* pcs, void* addr, BOOL unicode, WCHAR* buffer, int size);
375
extern BOOL             memory_get_register(DWORD regno, DWORD_PTR** value, char* buffer, int len);
376
extern void             memory_disassemble(const struct dbg_lvalue*, const struct dbg_lvalue*, int instruction_count);
377 378 379 380 381
extern BOOL             memory_disasm_one_insn(ADDRESS64* addr);
#define MAX_OFFSET_TO_STR_LEN 19
extern char*            memory_offset_to_string(char *str, DWORD64 offset, unsigned mode);
extern void             print_bare_address(const ADDRESS64* addr);
extern void             print_address(const ADDRESS64* addr, BOOLEAN with_line);
382
extern void             print_basic(const struct dbg_lvalue* value, char format);
383 384

  /* source.c */
385
extern void             source_list(IMAGEHLP_LINE64* src1, IMAGEHLP_LINE64* src2, int delta);
386
extern void             source_list_from_addr(const ADDRESS64* addr, int nlines);
387 388
extern void             source_show_path(void);
extern void             source_add_path(const char* path);
389 390
extern void             source_nuke_path(struct dbg_process* p);
extern void             source_free_files(struct dbg_process* p);
391 392

  /* stack.c */
393
extern void             stack_info(int len);
394 395 396
extern void             stack_backtrace(DWORD threadID);
extern BOOL             stack_set_frame(int newframe);
extern BOOL             stack_get_current_frame(IMAGEHLP_STACK_FRAME* ihsf);
397 398
extern BOOL             stack_get_register_frame(const struct dbg_internal_var* div, DWORD_PTR** pval);
extern unsigned         stack_fetch_frames(const CONTEXT* ctx);
399
extern BOOL             stack_get_current_symbol(SYMBOL_INFO* sym);
400 401 402 403

  /* symbol.c */
extern enum sym_get_lval symbol_get_lvalue(const char* name, const int lineno, struct dbg_lvalue* addr, BOOL bp_disp);
extern void             symbol_read_symtable(const char* filename, unsigned long offset);
404
extern enum dbg_line_status symbol_get_function_line_status(const ADDRESS64* addr);
405
extern BOOL             symbol_get_line(const char* filename, const char* func, IMAGEHLP_LINE64* ret);
406
extern void             symbol_info(const char* str);
407
extern void             symbol_print_local(const SYMBOL_INFO* sym, DWORD_PTR base, BOOL detailed);
408
extern BOOL             symbol_info_locals(void);
409
extern BOOL             symbol_is_local(const char* name);
410 411 412 413 414 415
struct sgv_data;
typedef enum sym_get_lval (*symbol_picker_t)(const char* name, const struct sgv_data* sgv,
                                             struct dbg_lvalue* rtn);
extern symbol_picker_t symbol_current_picker;
extern enum sym_get_lval symbol_picker_interactive(const char* name, const struct sgv_data* sgv,
                                                   struct dbg_lvalue* rtn);
416 417
extern enum sym_get_lval symbol_picker_scoped(const char* name, const struct sgv_data* sgv,
                                              struct dbg_lvalue* rtn);
418

Eric Pouech's avatar
Eric Pouech committed
419 420 421
  /* tgt_active.c */
extern void             dbg_run_debuggee(const char* args);
extern void             dbg_wait_next_exception(DWORD cont, int count, int mode);
422 423
extern enum dbg_start   dbg_active_attach(int argc, char* argv[]);
extern enum dbg_start   dbg_active_launch(int argc, char* argv[]);
Eric Pouech's avatar
Eric Pouech committed
424
extern enum dbg_start   dbg_active_auto(int argc, char* argv[]);
425
extern enum dbg_start   dbg_active_minidump(int argc, char* argv[]);
426 427
extern void             dbg_active_wait_for_first_exception(void);
extern BOOL             dbg_attach_debuggee(DWORD pid, BOOL cofe);
Eric Pouech's avatar
Eric Pouech committed
428

429 430
  /* tgt_minidump.c */
extern void             minidump_write(const char*, const EXCEPTION_RECORD*);
431
extern enum dbg_start   minidump_reload(int argc, char* argv[]);
432

433 434 435
  /* tgt_module.c */
extern enum dbg_start   tgt_module_load(const char* name, BOOL keep);

436 437
  /* types.c */
extern void             print_value(const struct dbg_lvalue* addr, char format, int level);
438 439
extern BOOL             types_print_type(const struct dbg_type*, BOOL details);
extern BOOL             print_types(void);
440
extern long int         types_extract_as_integer(const struct dbg_lvalue*);
441
extern LONGLONG         types_extract_as_longlong(const struct dbg_lvalue*, unsigned* psize, BOOL *pissigned);
442
extern void             types_extract_as_address(const struct dbg_lvalue*, ADDRESS64*);
443
extern BOOL             types_store_value(struct dbg_lvalue* lvalue_to, const struct dbg_lvalue* lvalue_from);
444 445
extern BOOL             types_udt_find_element(struct dbg_lvalue* value, const char* name, long int* tmpbuf);
extern BOOL             types_array_index(const struct dbg_lvalue* value, int index, struct dbg_lvalue* result);
446
extern BOOL             types_get_info(const struct dbg_type*, IMAGEHLP_SYMBOL_TYPE_INFO, void*);
447
extern BOOL             types_get_real_type(struct dbg_type* type, DWORD* tag);
448 449
extern struct dbg_type  types_find_pointer(const struct dbg_type* type);
extern struct dbg_type  types_find_type(unsigned long linear, const char* name, enum SymTagEnum tag);
450 451 452

  /* winedbg.c */
extern void	        dbg_outputW(const WCHAR* buffer, int len);
453
extern const char*      dbg_W2A(const WCHAR* buffer, unsigned len);
454
#ifdef __GNUC__
455
extern int	        dbg_printf(const char* format, ...) __attribute__((format (printf,1,2)));
456
#else
457
extern int	        dbg_printf(const char* format, ...);
458
#endif
459 460
extern const struct dbg_internal_var* dbg_get_internal_var(const char*);
extern BOOL             dbg_interrupt_debuggee(void);
461
extern unsigned         dbg_num_processes(void);
Eric Pouech's avatar
Eric Pouech committed
462
extern struct dbg_process* dbg_add_process(const struct be_process_io* pio, DWORD pid, HANDLE h);
463
extern void             dbg_set_process_name(struct dbg_process* p, const WCHAR* name);
464
extern struct dbg_process* dbg_get_process(DWORD pid);
465
extern struct dbg_process* dbg_get_process_h(HANDLE handle);
466 467 468 469
extern void             dbg_del_process(struct dbg_process* p);
struct dbg_thread*	dbg_add_thread(struct dbg_process* p, DWORD tid, HANDLE h, void* teb);
extern struct dbg_thread* dbg_get_thread(struct dbg_process* p, DWORD tid);
extern void             dbg_del_thread(struct dbg_thread* t);
470
extern BOOL             dbg_init(HANDLE hProc, const WCHAR* in, BOOL invade);
471
extern BOOL             dbg_load_module(HANDLE hProc, HANDLE hFile, const WCHAR* name, DWORD_PTR base, DWORD size);
472
extern BOOL             dbg_get_debuggee_info(HANDLE hProcess, IMAGEHLP_MODULE64* imh_mod);
473
extern void             dbg_set_option(const char*, const char*);
474 475
extern void             dbg_start_interactive(HANDLE hFile);
extern void             dbg_init_console(void);
476

Eric Pouech's avatar
Eric Pouech committed
477
  /* gdbproxy.c */
478
extern int              gdb_main(int argc, char* argv[]);
479

480 481
static inline BOOL dbg_read_memory(const void* addr, void* buffer, size_t len)
{
482
    SIZE_T rlen;
483
    return dbg_curr_process->process_io->read(dbg_curr_process->handle, addr, buffer, len, &rlen) && len == rlen;
484
}
485

486 487
static inline BOOL dbg_write_memory(void* addr, const void* buffer, size_t len)
{
488
    SIZE_T wlen;
489
    return dbg_curr_process->process_io->write(dbg_curr_process->handle, addr, buffer, len, &wlen) && len == wlen;
490
}
491

492 493 494 495 496 497 498 499 500 501
static inline void* dbg_heap_realloc(void* buffer, size_t size)
{
    return (buffer) ? HeapReAlloc(GetProcessHeap(), 0, buffer, size) :
        HeapAlloc(GetProcessHeap(), 0, size);
}

extern struct dbg_internal_var          dbg_internal_vars[];

#define  DBG_IVARNAME(_var)	dbg_internal_var_##_var
#define  DBG_IVARSTRUCT(_var)	dbg_internal_vars[DBG_IVARNAME(_var)]
502
#define  DBG_IVAR(_var)		(*(DBG_IVARSTRUCT(_var).pval))
503 504 505
#define  INTERNAL_VAR(_var,_val,_ref,itype) DBG_IVARNAME(_var),
enum debug_int_var
{
506
#include "intvar.h"
507 508
   DBG_IV_LAST
};
509 510
#undef   INTERNAL_VAR

511 512 513
/* include CPU dependent bits */
#include "be_cpu.h"

Alexandre Julliard's avatar
Alexandre Julliard committed
514
#endif  /* __WINE_DEBUGGER_H */