winedbg: Enhance printing of variables or fields.
[wine.git] / programs / winedbg / debugger.h
blobc4c0402ef5fc9e5b4787be479ef8c51f1601e884
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WINE_DEBUGGER_H
22 #define __WINE_DEBUGGER_H
24 #include <assert.h>
25 #include <stdarg.h>
27 #define NONAMELESSUNION
28 #define NONAMELESSSTRUCT
29 #include "ntstatus.h"
30 #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 #include "dbghelp.h"
37 #include "cvconst.h"
38 #include "objbase.h"
39 #include "oaidl.h"
40 #include <wine/list.h>
42 #define ADDRSIZE ((int)(dbg_curr_process ? dbg_curr_process->be_cpu->pointer_size : sizeof(void*)))
43 #define ADDRWIDTH (ADDRSIZE * 2)
45 /* the debugger uses these exceptions for its internal use */
46 #define DEBUG_STATUS_OFFSET 0x80003000
47 #define DEBUG_STATUS_INTERNAL_ERROR (DEBUG_STATUS_OFFSET+0) /* something went wrong */
48 #define DEBUG_STATUS_NO_SYMBOL (DEBUG_STATUS_OFFSET+1) /* no symbol found in lookup */
49 #define DEBUG_STATUS_DIV_BY_ZERO (DEBUG_STATUS_OFFSET+2)
50 #define DEBUG_STATUS_BAD_TYPE (DEBUG_STATUS_OFFSET+3) /* no type found, when type was expected */
51 #define DEBUG_STATUS_NO_FIELD (DEBUG_STATUS_OFFSET+4) /* when dereferencing a struct, the field was not found */
52 #define DEBUG_STATUS_ABORT (DEBUG_STATUS_OFFSET+5) /* user aborted on going action */
53 #define DEBUG_STATUS_CANT_DEREF (DEBUG_STATUS_OFFSET+6) /* either not deref:able, or index out of bounds */
54 #define DEBUG_STATUS_NOT_AN_INTEGER (DEBUG_STATUS_OFFSET+7) /* requiring an integral value */
57 * Return values for symbol_get_function_line_status. Used to determine
58 * what to do when the 'step' command is given.
60 enum dbg_line_status
62 dbg_no_line_info,
63 dbg_not_on_a_line_number,
64 dbg_on_a_line_number,
65 dbg_in_a_thunk,
68 enum dbg_internal_types
70 /* types that we synthetize inside the debugger */
71 dbg_itype_synthetized = 0xf0000000,
72 /* order here must match types.c:basic_types_details table */
73 dbg_itype_first = 0xffffff00,
74 dbg_itype_void = dbg_itype_first,
75 dbg_itype_bool,
76 dbg_itype_char,
77 dbg_itype_wchar,
78 dbg_itype_char8,
79 dbg_itype_char16,
80 dbg_itype_char32,
82 dbg_itype_unsigned_int8,
83 dbg_itype_unsigned_int16,
84 dbg_itype_unsigned_int32,
85 dbg_itype_unsigned_int64,
86 dbg_itype_unsigned_int128,
87 dbg_itype_unsigned_long32,
88 dbg_itype_unsigned_long64,
90 dbg_itype_signed_int8,
91 dbg_itype_signed_int16,
92 dbg_itype_signed_int32,
93 dbg_itype_signed_int64,
94 dbg_itype_signed_int128,
95 dbg_itype_signed_long32,
96 dbg_itype_signed_long64,
98 dbg_itype_short_real, /* aka float */
99 dbg_itype_real, /* aka double */
100 dbg_itype_long_real, /* aka long double */
102 dbg_itype_last,
104 /* they represent the dbg_lg(u)int_t types */
105 dbg_itype_lgint,
106 dbg_itype_lguint,
108 dbg_itype_astring,
109 dbg_itype_ustring,
110 dbg_itype_segptr, /* hack for segmented pointers */
111 dbg_itype_m128a, /* 128-bit (XMM) registers */
112 dbg_itype_none = 0xffffffff
115 /* Largest integers the debugger's compiler can support.
116 * It's large enough to store a pointer (in debuggee or debugger's address space).
117 * It can be smaller than the largest integer(s) of the debuggee.
118 * (eg. 64 bit on PE build of debugger, vs 128 int in ELF build of a library)
120 typedef LONG64 dbg_lgint_t;
121 typedef ULONG64 dbg_lguint_t;
123 /* type description (in the following order):
124 * - if 'id' is dbg_itype_none (whatever 'module' value), the type isn't known
125 * - if 'module' is 0, it's an internal type (id is one of dbg_itype...)
126 * - if 'module' is non 0, then 'id' is a type ID referring to module (loaded in
127 * dbghelp) which (linear) contains address 'module'.
129 struct dbg_type
131 ULONG id;
132 DWORD_PTR module;
135 struct dbg_lvalue /* structure to hold left-values... */
137 unsigned in_debuggee : 1, /* 1 = debuggee address space, 0 = debugger address space */
138 bitstart : 8, /* in fact, 7 should be sufficient for underlying 128bit integers */
139 bitlen;
140 ADDRESS64 addr;
141 struct dbg_type type;
144 static inline void init_lvalue(struct dbg_lvalue* lv, BOOL in_debuggee, void* addr)
146 lv->in_debuggee = !!in_debuggee;
147 lv->bitstart = 0;
148 lv->bitlen = 0;
149 lv->addr.Mode = AddrModeFlat;
150 lv->addr.Offset = (DWORD_PTR)addr;
151 lv->type.module = 0;
152 lv->type.id = dbg_itype_none;
155 static inline void init_lvalue_in_debugger(struct dbg_lvalue* lv, DWORD_PTR module,
156 enum dbg_internal_types it, void* addr)
158 lv->in_debuggee = 0;
159 lv->bitstart = 0;
160 lv->bitlen = 0;
161 lv->addr.Mode = AddrModeFlat;
162 lv->addr.Offset = (DWORD_PTR)addr;
163 lv->type.module = module;
164 lv->type.id = it;
167 enum dbg_exec_mode
169 dbg_exec_cont, /* Continue execution */
170 dbg_exec_step_over_line, /* Stepping over a call to next source line */
171 dbg_exec_step_into_line, /* Step to next source line, stepping in if needed */
172 dbg_exec_step_over_insn, /* Stepping over a call */
173 dbg_exec_step_into_insn, /* Single-stepping an instruction */
174 dbg_exec_finish, /* Single-step until we exit current frame */
175 #if 0
176 EXEC_STEP_OVER_TRAMPOLINE, /* Step over trampoline. Requires that we dig the real
177 * return value off the stack and set breakpoint there -
178 * not at the instr just after the call.
180 #endif
183 struct dbg_breakpoint
185 ADDRESS64 addr;
186 unsigned int enabled : 1,
187 xpoint_type : 2,
188 refcount : 13,
189 skipcount : 16;
190 unsigned int info;
191 struct /* only used for watchpoints */
193 BYTE len : 2;
194 DWORD64 oldval;
195 } w;
196 struct expr* condition;
199 /* Helper structure */
200 typedef struct tagTHREADNAME_INFO
202 DWORD dwType; /* Must be 0x1000 */
203 LPCSTR szName; /* Pointer to name - limited to 9 bytes (8 characters + terminator) */
204 DWORD dwThreadID; /* Thread ID (-1 = caller thread) */
205 DWORD dwFlags; /* Reserved for future use. Must be zero. */
206 } THREADNAME_INFO;
208 typedef union dbg_ctx
210 CONTEXT ctx;
211 WOW64_CONTEXT x86;
212 } dbg_ctx_t;
214 struct dbg_thread
216 struct list entry;
217 struct dbg_process* process;
218 HANDLE handle;
219 DWORD tid;
220 void* teb;
221 enum dbg_exec_mode exec_mode; /* mode the thread is run (step/run...) */
222 int exec_count; /* count of mode operations */
223 ADDRESS_MODE addr_mode; /* mode */
224 int stopped_xpoint; /* xpoint on which the thread has stopped (-1 if none) */
225 struct dbg_breakpoint step_over_bp;
226 char name[9];
227 BOOL in_exception; /* TRUE if thread stopped with an exception */
228 BOOL first_chance; /* TRUE if thread stopped with a first chance exception
229 * - only valid when in_exception is TRUE
231 EXCEPTION_RECORD excpt_record; /* only valid when in_exception is TRUE */
232 struct dbg_frame
234 ADDRESS64 addr_pc;
235 ADDRESS64 addr_frame;
236 ADDRESS64 addr_stack;
237 DWORD_PTR linear_pc;
238 DWORD_PTR linear_frame;
239 DWORD_PTR linear_stack;
240 dbg_ctx_t context; /* context we got out of stackwalk for this frame */
241 DWORD inline_ctx;
242 BOOL is_ctx_valid; /* is the context above valid */
243 }* frames;
244 int num_frames;
245 int curr_frame;
246 BOOL suspended;
249 struct dbg_delayed_bp
251 BOOL is_symbol;
252 BOOL software_bp;
253 union
255 struct
257 int lineno;
258 char* name;
259 } symbol;
260 ADDRESS64 addr;
261 } u;
264 #define MAX_BREAKPOINTS 100
265 struct dbg_process
267 struct list entry;
268 HANDLE handle;
269 DWORD pid;
270 const struct be_process_io* process_io;
271 void* pio_data;
272 const WCHAR* imageName;
273 struct list threads;
274 struct backend_cpu* be_cpu;
275 HANDLE event_on_first_exception;
276 BOOL active_debuggee;
277 struct dbg_breakpoint bp[MAX_BREAKPOINTS];
278 unsigned next_bp;
279 struct dbg_delayed_bp* delayed_bp;
280 int num_delayed_bp;
281 struct open_file_list* source_ofiles;
282 char* search_path;
283 char source_current_file[MAX_PATH];
284 int source_start_line;
285 int source_end_line;
286 const struct data_model* data_model;
287 struct dbg_type* synthetized_types;
288 unsigned num_synthetized_types;
291 /* describes the way the debugger interacts with a given process */
292 struct be_process_io
294 BOOL (*close_process)(struct dbg_process*, BOOL);
295 BOOL (*read)(HANDLE, const void*, void*, SIZE_T, SIZE_T*);
296 BOOL (*write)(HANDLE, void*, const void*, SIZE_T, SIZE_T*);
297 BOOL (*get_selector)(HANDLE, DWORD, LDT_ENTRY*);
300 extern struct dbg_process* dbg_curr_process;
301 extern DWORD dbg_curr_pid;
302 extern struct dbg_thread* dbg_curr_thread;
303 extern DWORD dbg_curr_tid;
304 extern dbg_ctx_t dbg_context;
305 extern BOOL dbg_interactiveP;
306 extern HANDLE dbg_houtput;
308 struct dbg_internal_var
310 DWORD val;
311 const char* name;
312 void* pval;
313 ULONG typeid; /* always internal type */
316 enum sym_get_lval {sglv_found, sglv_unknown, sglv_aborted};
318 enum dbg_start {start_ok, start_error_parse, start_error_init};
320 /* break.c */
321 extern void break_set_xpoints(BOOL set);
322 extern BOOL break_add_break(const ADDRESS64* addr, BOOL verbose, BOOL swbp);
323 extern BOOL break_add_break_from_lvalue(const struct dbg_lvalue* value, BOOL swbp);
324 extern void break_add_break_from_id(const char* name, int lineno, BOOL swbp);
325 extern void break_add_break_from_lineno(const char *filename, int lineno, BOOL swbp);
326 extern void break_add_watch_from_lvalue(const struct dbg_lvalue* lvalue, BOOL is_write);
327 extern void break_add_watch_from_id(const char* name, BOOL is_write);
328 extern void break_check_delayed_bp(void);
329 extern void break_delete_xpoint(int num);
330 extern void break_delete_xpoints_from_module(DWORD64 base);
331 extern void break_enable_xpoint(int num, BOOL enable);
332 extern void break_info(void);
333 extern void break_adjust_pc(ADDRESS64* addr, DWORD code, BOOL first_chance, BOOL* is_break);
334 extern BOOL break_should_continue(ADDRESS64* addr, DWORD code);
335 extern void break_suspend_execution(void);
336 extern void break_restart_execution(int count);
337 extern int break_add_condition(int bpnum, struct expr* exp);
339 /* crashdlg.c */
340 extern int display_crash_dialog(void);
341 extern HANDLE display_crash_details(HANDLE event);
342 extern int msgbox_res_id(HWND hwnd, UINT textId, UINT captionId, UINT uType);
344 /* dbg.y */
345 extern void parser_handle(const char*, HANDLE);
346 extern int input_read_line(const char* pfx, char* buffer, int size);
347 extern size_t input_lex_read_buffer(char* pfx, int size);
348 extern HANDLE WINAPIV parser_generate_command_file(const char*, ...);
350 /* debug.l */
351 extern void lexeme_flush(void);
352 extern char* lexeme_alloc_size(int);
354 /* display.c */
355 extern BOOL display_print(void);
356 extern BOOL display_add(struct expr* exp, int count, char format);
357 extern BOOL display_delete(int displaynum);
358 extern BOOL display_info(void);
359 extern BOOL display_enable(int displaynum, int enable);
361 /* expr.c */
362 extern void expr_free_all(void);
363 extern struct expr* expr_alloc_internal_var(const char* name);
364 extern struct expr* expr_alloc_symbol(const char* name);
365 extern struct expr* expr_alloc_sconstant(dbg_lgint_t val);
366 extern struct expr* expr_alloc_uconstant(dbg_lguint_t val);
367 extern struct expr* expr_alloc_string(const char* str);
368 extern struct expr* expr_alloc_binary_op(int oper, struct expr*, struct expr*);
369 extern struct expr* expr_alloc_unary_op(int oper, struct expr*);
370 extern struct expr* expr_alloc_pstruct(struct expr*, const char* element);
371 extern struct expr* expr_alloc_struct(struct expr*, const char* element);
372 extern struct expr* WINAPIV expr_alloc_func_call(const char*, int nargs, ...);
373 extern struct expr* expr_alloc_typecast(struct dbg_type*, struct expr*);
374 extern struct dbg_lvalue expr_eval(struct expr*);
375 extern struct expr* expr_clone(const struct expr* exp, BOOL *local_binding);
376 extern BOOL expr_free(struct expr* exp);
377 extern BOOL expr_print(const struct expr* exp);
379 /* info.c */
380 extern void print_help(void);
381 extern void info_help(void);
382 extern void info_win32_module(DWORD64 mod);
383 extern void info_win32_class(HWND hWnd, const char* clsName);
384 extern void info_win32_window(HWND hWnd, BOOL detailed);
385 extern void info_win32_processes(void);
386 extern void info_win32_threads(void);
387 extern void info_win32_frame_exceptions(DWORD tid);
388 extern void info_win32_virtual(DWORD pid);
389 extern void info_win32_segments(DWORD start, int length);
390 extern void info_win32_exception(void);
391 extern void info_wine_dbg_channel(BOOL add, const char* chnl, const char* name);
392 extern WCHAR* fetch_thread_description(DWORD tid);
394 /* memory.c */
395 extern BOOL memory_read_value(const struct dbg_lvalue* lvalue, DWORD size, void* result);
396 extern BOOL memory_write_value(const struct dbg_lvalue* val, DWORD size, void* value);
397 extern BOOL memory_transfer_value(const struct dbg_lvalue* to, const struct dbg_lvalue* from);
398 extern BOOL memory_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size,
399 BOOL is_signed, dbg_lgint_t* ret);
400 extern BOOL memory_store_integer(const struct dbg_lvalue* lvalue, dbg_lgint_t val);
401 extern BOOL memory_fetch_float(const struct dbg_lvalue* lvalue, double *ret);
402 extern BOOL memory_store_float(const struct dbg_lvalue* lvalue, double *ret);
403 extern void memory_examine(const struct dbg_lvalue *lvalue, int count, char format);
404 extern void* memory_to_linear_addr(const ADDRESS64* address);
405 extern BOOL memory_get_current_pc(ADDRESS64* address);
406 extern BOOL memory_get_current_stack(ADDRESS64* address);
407 extern BOOL memory_get_string(struct dbg_process* pcs, void* addr, BOOL in_debuggee, BOOL unicode, char* buffer, int size);
408 extern BOOL memory_get_string_indirect(struct dbg_process* pcs, void* addr, BOOL unicode, WCHAR* buffer, int size);
409 extern BOOL memory_get_register(DWORD regno, struct dbg_lvalue* value, char* buffer, int len);
410 extern void memory_disassemble(const struct dbg_lvalue*, const struct dbg_lvalue*, int instruction_count);
411 extern BOOL memory_disasm_one_insn(ADDRESS64* addr);
412 #define MAX_OFFSET_TO_STR_LEN 19
413 extern char* memory_offset_to_string(char *str, DWORD64 offset, unsigned mode);
414 extern void print_bare_address(const ADDRESS64* addr);
415 extern void print_address(const ADDRESS64* addr, BOOLEAN with_line);
416 extern void print_basic(const struct dbg_lvalue* value, char format);
418 /* source.c */
419 extern void source_list(IMAGEHLP_LINE64* src1, IMAGEHLP_LINE64* src2, int delta);
420 extern void source_list_from_addr(const ADDRESS64* addr, int nlines);
421 extern void source_show_path(void);
422 extern void source_add_path(const char* path);
423 extern void source_nuke_path(struct dbg_process* p);
424 extern void source_free_files(struct dbg_process* p);
426 /* stack.c */
427 extern void stack_info(int len);
428 extern void stack_backtrace(DWORD threadID);
429 extern BOOL stack_set_frame(int newframe);
430 extern BOOL stack_get_register_frame(const struct dbg_internal_var* div, struct dbg_lvalue* lvalue);
431 extern unsigned stack_fetch_frames(const dbg_ctx_t *ctx);
432 extern BOOL stack_get_current_symbol(SYMBOL_INFO* sym);
433 static inline struct dbg_frame*
434 stack_get_thread_frame(struct dbg_thread* thd, unsigned nf)
436 if (!thd->frames || nf >= thd->num_frames) return NULL;
437 return &thd->frames[nf];
439 static inline struct dbg_frame*
440 stack_get_curr_frame(void)
442 return stack_get_thread_frame(dbg_curr_thread, dbg_curr_thread->curr_frame);
445 /* symbol.c */
446 extern enum sym_get_lval symbol_get_lvalue(const char* name, const int lineno, struct dbg_lvalue* addr, BOOL bp_disp);
447 extern void symbol_read_symtable(const char* filename, ULONG_PTR offset);
448 extern enum dbg_line_status symbol_get_function_line_status(const ADDRESS64* addr);
449 extern BOOL symbol_get_line(const char* filename, const char* func, IMAGEHLP_LINE64* ret);
450 extern void symbol_info(const char* str);
451 extern void symbol_print_localvalue(const SYMBOL_INFO* sym, DWORD_PTR base, BOOL detailed);
452 extern BOOL symbol_info_locals(void);
453 extern BOOL symbol_is_local(const char* name);
454 struct sgv_data;
455 typedef enum sym_get_lval (*symbol_picker_t)(const char* name, const struct sgv_data* sgv,
456 struct dbg_lvalue* rtn);
457 extern symbol_picker_t symbol_current_picker;
458 extern enum sym_get_lval symbol_picker_interactive(const char* name, const struct sgv_data* sgv,
459 struct dbg_lvalue* rtn);
460 extern enum sym_get_lval symbol_picker_scoped(const char* name, const struct sgv_data* sgv,
461 struct dbg_lvalue* rtn);
463 /* tgt_active.c */
464 struct list_string
466 char* string;
467 struct list_string* next;
469 extern void dbg_run_debuggee(struct list_string* ls);
470 extern void dbg_wait_next_exception(DWORD cont, int count, int mode);
471 extern enum dbg_start dbg_active_attach(int argc, char* argv[]);
472 extern BOOL dbg_set_curr_thread(DWORD tid);
473 extern enum dbg_start dbg_active_launch(int argc, char* argv[]);
474 extern enum dbg_start dbg_active_auto(int argc, char* argv[]);
475 extern enum dbg_start dbg_active_minidump(int argc, char* argv[]);
476 extern void dbg_active_wait_for_first_exception(void);
477 extern BOOL dbg_attach_debuggee(DWORD pid);
478 extern void fetch_module_name(void* name_addr, void* mod_addr, WCHAR* buffer, size_t bufsz);
480 /* tgt_minidump.c */
481 extern void minidump_write(const char*, const EXCEPTION_RECORD*);
482 extern enum dbg_start minidump_reload(int argc, char* argv[]);
484 /* tgt_module.c */
485 extern enum dbg_start tgt_module_load(const char* name, BOOL keep);
487 /* types.c */
488 extern void print_value(const struct dbg_lvalue* addr, char format, int level);
489 extern BOOL types_print_type(const struct dbg_type*, BOOL details, const WCHAR* varname);
490 extern BOOL print_types(void);
491 extern dbg_lgint_t types_extract_as_integer(const struct dbg_lvalue*);
492 extern dbg_lgint_t types_extract_as_lgint(const struct dbg_lvalue*, unsigned* psize, BOOL *pissigned);
493 extern void types_extract_as_address(const struct dbg_lvalue*, ADDRESS64*);
494 extern BOOL types_store_value(struct dbg_lvalue* lvalue_to, const struct dbg_lvalue* lvalue_from);
495 extern BOOL types_udt_find_element(struct dbg_lvalue* value, const char* name);
496 extern BOOL types_array_index(const struct dbg_lvalue* value, int index, struct dbg_lvalue* result);
497 extern BOOL types_get_info(const struct dbg_type*, IMAGEHLP_SYMBOL_TYPE_INFO, void*);
498 extern BOOL types_get_real_type(struct dbg_type* type, DWORD* tag);
499 extern BOOL types_find_pointer(const struct dbg_type* type, struct dbg_type* outtype);
500 extern BOOL types_find_type(const char* name, enum SymTagEnum tag, struct dbg_type* outtype);
501 extern BOOL types_compare(const struct dbg_type, const struct dbg_type, BOOL* equal);
502 extern BOOL types_is_integral_type(const struct dbg_lvalue*);
503 extern BOOL types_is_float_type(const struct dbg_lvalue*);
504 extern BOOL types_is_pointer_type(const struct dbg_lvalue*);
505 extern BOOL types_find_basic(const WCHAR*, const char*, struct dbg_type* type);
506 extern BOOL types_unload_module(DWORD_PTR linear);
508 /* winedbg.c */
509 #ifdef __GNUC__
510 extern int WINAPIV dbg_printf(const char* format, ...) __attribute__((format (printf,1,2)));
511 #else
512 extern int WINAPIV dbg_printf(const char* format, ...);
513 #endif
514 extern const struct dbg_internal_var* dbg_get_internal_var(const char*);
515 extern BOOL dbg_interrupt_debuggee(void);
516 extern unsigned dbg_num_processes(void);
517 extern struct dbg_process* dbg_add_process(const struct be_process_io* pio, DWORD pid, HANDLE h);
518 extern void dbg_set_process_name(struct dbg_process* p, const WCHAR* name);
519 extern struct dbg_process* dbg_get_process(DWORD pid);
520 extern struct dbg_process* dbg_get_process_h(HANDLE handle);
521 extern void dbg_del_process(struct dbg_process* p);
522 struct dbg_thread* dbg_add_thread(struct dbg_process* p, DWORD tid, HANDLE h, void* teb);
523 extern struct dbg_thread* dbg_get_thread(struct dbg_process* p, DWORD tid);
524 extern void dbg_del_thread(struct dbg_thread* t);
525 extern BOOL dbg_init(HANDLE hProc, const WCHAR* in, BOOL invade);
526 extern BOOL dbg_load_module(HANDLE hProc, HANDLE hFile, const WCHAR* name, DWORD_PTR base, DWORD size);
527 extern void dbg_set_option(const char*, const char*);
528 extern void dbg_start_interactive(const char*, HANDLE hFile);
529 extern void dbg_init_console(void);
531 /* gdbproxy.c */
532 extern int gdb_main(int argc, char* argv[]);
534 static inline BOOL dbg_read_memory(const void* addr, void* buffer, size_t len)
536 SIZE_T rlen;
537 return dbg_curr_process->process_io->read(dbg_curr_process->handle, addr, buffer, len, &rlen) && len == rlen;
540 static inline BOOL dbg_write_memory(void* addr, const void* buffer, size_t len)
542 SIZE_T wlen;
543 return dbg_curr_process->process_io->write(dbg_curr_process->handle, addr, buffer, len, &wlen) && len == wlen;
546 struct data_model
548 enum dbg_internal_types itype;
549 const WCHAR* name;
552 extern const struct data_model ilp32_data_model[];
553 extern const struct data_model lp64_data_model[];
554 extern const struct data_model llp64_data_model[];
556 extern struct dbg_internal_var dbg_internal_vars[];
558 #define DBG_IVARNAME(_var) dbg_internal_var_##_var
559 #define DBG_IVARSTRUCT(_var) dbg_internal_vars[DBG_IVARNAME(_var)]
560 #define DBG_IVAR(_var) (DBG_IVARSTRUCT(_var).val)
561 #define INTERNAL_VAR(_var,_val,_ref,itype) DBG_IVARNAME(_var),
562 enum debug_int_var
564 #include "intvar.h"
565 DBG_IV_LAST
567 #undef INTERNAL_VAR
569 /* include CPU dependent bits */
570 #include "be_cpu.h"
572 #endif /* __WINE_DEBUGGER_H */