delorie.com/djgpp/doc/libc/libc_667.html | search |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
#include <debug/dbgcom.h> void run_child (void); |
This function starts or resumes the debugged program, via a
longjmp
to the debuggee's code. When the debuggee hits a
breakpoint, or exits normally, the exception handler that is called to
service the breakpoint exception will longjmp
back to
run_child
, and it will then return to the caller.
After run_child
returns, the debugger usually examines the
a_tss
variable to find out the reason the debuggee stopped. The
a_tss
variable is defined by the header `debug/tss.h' as
follows:
typedef struct TSS { unsigned short tss_back_link; unsigned short res0; unsigned long tss_esp0; unsigned short tss_ss0; unsigned short res1; unsigned long tss_esp1; unsigned short tss_ss1; unsigned short res2; unsigned long tss_esp2; unsigned short tss_ss2; unsigned short res3; unsigned long tss_cr3; unsigned long tss_eip; unsigned long tss_eflags; unsigned long tss_eax; unsigned long tss_ecx; unsigned long tss_edx; unsigned long tss_ebx; unsigned long tss_esp; unsigned long tss_ebp; unsigned long tss_esi; unsigned long tss_edi; unsigned short tss_es; unsigned short res4; unsigned short tss_cs; unsigned short res5; unsigned short tss_ss; unsigned short res6; unsigned short tss_ds; unsigned short res7; unsigned short tss_fs; unsigned short res8; unsigned short tss_gs; unsigned short res9; unsigned short tss_ldt; unsigned short res10; unsigned short tss_trap; unsigned char tss_iomap; unsigned char tss_irqn; unsigned long tss_error; } TSS; extern TSS a_tss; |
See the example below for a typical tests after run_child
returns.
Note that, generally, you'd need to save the standard handles before
calling run_child
and restore them after it returns. Otherwise,
if the debuggee redirects one of its standard handles, the corresponding
debugger's standard handle is redirected as well.
See section redir_to_child, and see redir_to_debugger.
ANSI/ISO C | No |
POSIX | No |
save_npx (); run_child (); load_npx (); if (a_tss.tss_irqn == 0x21) { status = DEBUGGEE_EXITED; exit_code = a_tss.tss_eax & 0xff; } else { status = DEBUGGEE_GOT_SIGNAL if (a_tss.tss_irqn == 0x75) signal_number = SIGINT; else if (a_tss.tss_irqn == 1 || a_tss.tss_irqn == 3) signal_number = SIGTRAP; /* a breakpoint */ } |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
webmaster | delorie software privacy |
Copyright © 2004 | Updated Apr 2004 |