macosx-nat-cfmthread.c [plain text]
#include "macosx-nat-inferior.h"
#include "macosx-nat-cfmthread.h"
#include "defs.h"
#include "gdbcmd.h"
#include "breakpoint.h"
#include "annotate.h"
static CORE_ADDR
lookup_address (const char *s)
{
struct minimal_symbol *msym;
msym = lookup_minimal_symbol (s, NULL, NULL);
if (msym == NULL)
{
error ("unable to locate symbol \"%s\"", s);
}
return SYMBOL_VALUE_ADDRESS (msym);
}
void
macosx_cfm_thread_init (macosx_cfm_thread_status *s)
{
s->notify_debugger = 0;
s->info_api_cookie = 0;
s->breakpoint_offset = 0;
s->cfm_breakpoint = NULL;
}
void
macosx_cfm_thread_create (macosx_cfm_thread_status *s)
{
struct symtab_and_line sal;
char buf[64];
if (s->info_api_cookie == 0)
cfm_init ();
if (s->info_api_cookie == 0)
return;
snprintf (buf, 64, "PrepareClosure + %s",
core_addr_to_string (s->breakpoint_offset));
s->notify_debugger =
lookup_address ("PrepareClosure") + s->breakpoint_offset;
init_sal (&sal);
sal.pc = s->notify_debugger;
s->cfm_breakpoint =
set_momentary_breakpoint (sal, null_frame_id, bp_shlib_event);
s->cfm_breakpoint->disposition = disp_donttouch;
s->cfm_breakpoint->thread = -1;
s->cfm_breakpoint->addr_string = savestring (buf, strlen (buf));
breakpoints_changed ();
}
void
macosx_cfm_thread_destroy (macosx_cfm_thread_status *s)
{
if (s->cfm_breakpoint != NULL)
delete_breakpoint (s->cfm_breakpoint);
s->cfm_breakpoint = NULL;
macosx_cfm_thread_init (s);
}
void
_initialize_macosx_nat_cfmthread (void)
{
}