mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-02-17 13:10:12 +08:00
gdbserver: introduce threads_debug_printf, THREADS_SCOPED_DEBUG_ENTER_EXIT
Add the threads_debug_printf and THREADS_SCOPED_DEBUG_ENTER_EXIT, which use the logging infrastructure from gdbsupport/common-debug.h. Replace all debug_print uses that are predicated by debug_threads with threads_dethreads_debug_printf. Replace uses of the debug_enter and debug_exit macros with THREADS_SCOPED_DEBUG_ENTER_EXIT, which serves essentially the same purpose, but allows showing what comes between the enter and the exit in an indented form. Note that "threads" debug is currently used for a bit of everything in GDBserver, not only threads related stuff. It should ideally be cleaned up and separated logically as is done in GDB, but that's out of the scope of this patch. Change-Id: I2d4546464462cb4c16f7f1168c5cec5a89f2289a
This commit is contained in:
parent
c68665c726
commit
c058728c31
@ -39,7 +39,7 @@ ax_vdebug (const char *fmt, ...)
|
||||
#ifdef IN_PROCESS_AGENT
|
||||
fprintf (stderr, PROG "/ax: %s\n", buf);
|
||||
#else
|
||||
debug_printf (PROG "/ax: %s\n", buf);
|
||||
threads_debug_printf (PROG "/ax: %s", buf);
|
||||
#endif
|
||||
va_end (ap);
|
||||
}
|
||||
|
@ -110,30 +110,6 @@ debug_flush (void)
|
||||
fflush (debug_file);
|
||||
}
|
||||
|
||||
/* Notify the user that the code is entering FUNCTION_NAME.
|
||||
FUNCTION_NAME is the name of the calling function, or NULL if unknown.
|
||||
|
||||
This is intended to be called via the debug_enter macro. */
|
||||
|
||||
void
|
||||
do_debug_enter (const char *function_name)
|
||||
{
|
||||
if (function_name != NULL)
|
||||
debug_printf (">>>> entering %s\n", function_name);
|
||||
}
|
||||
|
||||
/* Notify the user that the code is exiting FUNCTION_NAME.
|
||||
FUNCTION_NAME is the name of the calling function, or NULL if unknown.
|
||||
|
||||
This is intended to be called via the debug_exit macro. */
|
||||
|
||||
void
|
||||
do_debug_exit (const char *function_name)
|
||||
{
|
||||
if (function_name != NULL)
|
||||
debug_printf ("<<<< exiting %s\n", function_name);
|
||||
}
|
||||
|
||||
/* See debug.h. */
|
||||
|
||||
ssize_t
|
||||
|
@ -35,31 +35,22 @@ extern int using_threads;
|
||||
|
||||
extern bool debug_threads;
|
||||
|
||||
/* Print a "threads" debug statement. */
|
||||
|
||||
#define threads_debug_printf(fmt, ...) \
|
||||
debug_prefixed_printf_cond (debug_threads, \
|
||||
"threads", fmt, ##__VA_ARGS__)
|
||||
|
||||
/* Print "threads" enter/exit debug statements. */
|
||||
|
||||
#define THREADS_SCOPED_DEBUG_ENTER_EXIT \
|
||||
scoped_debug_enter_exit (debug_threads, "threads")
|
||||
|
||||
extern int debug_timestamp;
|
||||
|
||||
void debug_flush (void);
|
||||
void do_debug_enter (const char *function_name);
|
||||
void do_debug_exit (const char *function_name);
|
||||
|
||||
/* Async signal safe debug output function that calls write directly. */
|
||||
ssize_t debug_write (const void *buf, size_t nbyte);
|
||||
|
||||
/* These macros are for use in major functions that produce a lot of
|
||||
debugging output. They help identify in the mass of debugging output
|
||||
when these functions enter and exit. debug_enter is intended to be
|
||||
called at the start of a function, before any other debugging output.
|
||||
debug_exit is intended to be called at the end of the same function,
|
||||
after all debugging output. */
|
||||
#ifdef FUNCTION_NAME
|
||||
#define debug_enter() \
|
||||
do { do_debug_enter (FUNCTION_NAME); } while (0)
|
||||
#define debug_exit() \
|
||||
do { do_debug_exit (FUNCTION_NAME); } while (0)
|
||||
#else
|
||||
#define debug_enter() \
|
||||
do { } while (0)
|
||||
#define debug_exit() \
|
||||
do { } while (0)
|
||||
#endif
|
||||
|
||||
#endif /* GDBSERVER_DEBUG_H */
|
||||
|
@ -45,11 +45,7 @@ void
|
||||
prefork_hook (const char *args)
|
||||
{
|
||||
client_state &cs = get_client_state ();
|
||||
if (debug_threads)
|
||||
{
|
||||
debug_printf ("args: %s\n", args);
|
||||
debug_flush ();
|
||||
}
|
||||
threads_debug_printf ("args: %s", args);
|
||||
|
||||
#ifdef SIGTTOU
|
||||
signal (SIGTTOU, SIG_DFL);
|
||||
|
@ -2467,9 +2467,8 @@ emit_ops_insns (const uint32_t *start, int len)
|
||||
{
|
||||
CORE_ADDR buildaddr = current_insn_ptr;
|
||||
|
||||
if (debug_threads)
|
||||
debug_printf ("Adding %d instrucions at %s\n",
|
||||
len, paddress (buildaddr));
|
||||
threads_debug_printf ("Adding %d instrucions at %s",
|
||||
len, paddress (buildaddr));
|
||||
|
||||
append_insns (&buildaddr, len, start);
|
||||
current_insn_ptr = buildaddr;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1503,9 +1503,8 @@ add_insns (const unsigned char *start, int len)
|
||||
{
|
||||
CORE_ADDR buildaddr = current_insn_ptr;
|
||||
|
||||
if (debug_threads)
|
||||
debug_printf ("Adding %d bytes of insn at %s\n",
|
||||
len, paddress (buildaddr));
|
||||
threads_debug_printf ("Adding %d bytes of insn at %s",
|
||||
len, paddress (buildaddr));
|
||||
|
||||
append_insns (&buildaddr, len, start);
|
||||
current_insn_ptr = buildaddr;
|
||||
|
@ -1628,9 +1628,8 @@ add_insns (unsigned char *start, int len)
|
||||
{
|
||||
CORE_ADDR buildaddr = current_insn_ptr;
|
||||
|
||||
if (debug_threads)
|
||||
debug_printf ("Adding %d bytes of insn at %s\n",
|
||||
len, paddress (buildaddr));
|
||||
threads_debug_printf ("Adding %d bytes of insn at %s",
|
||||
len, paddress (buildaddr));
|
||||
|
||||
append_insns (&buildaddr, len, start);
|
||||
current_insn_ptr = buildaddr;
|
||||
|
@ -371,10 +371,9 @@ insert_memory_breakpoint (struct raw_breakpoint *bp)
|
||||
err = read_inferior_memory (bp->pc, buf, bp_size (bp));
|
||||
if (err != 0)
|
||||
{
|
||||
if (debug_threads)
|
||||
debug_printf ("Failed to read shadow memory of"
|
||||
" breakpoint at 0x%s (%s).\n",
|
||||
paddress (bp->pc), safe_strerror (err));
|
||||
threads_debug_printf ("Failed to read shadow memory of"
|
||||
" breakpoint at 0x%s (%s).",
|
||||
paddress (bp->pc), safe_strerror (err));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -383,11 +382,8 @@ insert_memory_breakpoint (struct raw_breakpoint *bp)
|
||||
err = the_target->write_memory (bp->pc, bp_opcode (bp),
|
||||
bp_size (bp));
|
||||
if (err != 0)
|
||||
{
|
||||
if (debug_threads)
|
||||
debug_printf ("Failed to insert breakpoint at 0x%s (%s).\n",
|
||||
paddress (bp->pc), safe_strerror (err));
|
||||
}
|
||||
threads_debug_printf ("Failed to insert breakpoint at 0x%s (%s).",
|
||||
paddress (bp->pc), safe_strerror (err));
|
||||
}
|
||||
return err != 0 ? -1 : 0;
|
||||
}
|
||||
@ -411,12 +407,10 @@ remove_memory_breakpoint (struct raw_breakpoint *bp)
|
||||
memcpy (buf, bp->old_data, bp_size (bp));
|
||||
err = target_write_memory (bp->pc, buf, bp_size (bp));
|
||||
if (err != 0)
|
||||
{
|
||||
if (debug_threads)
|
||||
debug_printf ("Failed to uninsert raw breakpoint "
|
||||
"at 0x%s (%s) while deleting it.\n",
|
||||
paddress (bp->pc), safe_strerror (err));
|
||||
}
|
||||
threads_debug_printf ("Failed to uninsert raw breakpoint "
|
||||
"at 0x%s (%s) while deleting it.",
|
||||
paddress (bp->pc), safe_strerror (err));
|
||||
|
||||
return err != 0 ? -1 : 0;
|
||||
}
|
||||
|
||||
@ -438,9 +432,9 @@ set_raw_breakpoint_at (enum raw_bkpt_type type, CORE_ADDR where, int kind,
|
||||
{
|
||||
/* A different kind than previously seen. The previous
|
||||
breakpoint must be gone then. */
|
||||
if (debug_threads)
|
||||
debug_printf ("Inconsistent breakpoint kind? Was %d, now %d.\n",
|
||||
bp->kind, kind);
|
||||
threads_debug_printf
|
||||
("Inconsistent breakpoint kind? Was %d, now %d.",
|
||||
bp->kind, kind);
|
||||
bp->inserted = -1;
|
||||
bp = NULL;
|
||||
}
|
||||
@ -463,9 +457,8 @@ set_raw_breakpoint_at (enum raw_bkpt_type type, CORE_ADDR where, int kind,
|
||||
*err = the_target->insert_point (bp->raw_type, bp->pc, bp->kind, bp);
|
||||
if (*err != 0)
|
||||
{
|
||||
if (debug_threads)
|
||||
debug_printf ("Failed to insert breakpoint at 0x%s (%d).\n",
|
||||
paddress (where), *err);
|
||||
threads_debug_printf ("Failed to insert breakpoint at 0x%s (%d).",
|
||||
paddress (where), *err);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -594,10 +587,10 @@ delete_fast_tracepoint_jump (struct fast_tracepoint_jump *todel)
|
||||
/* Something went wrong, relink the jump. */
|
||||
*bp_link = prev_bp_link;
|
||||
|
||||
if (debug_threads)
|
||||
debug_printf ("Failed to uninsert fast tracepoint jump "
|
||||
"at 0x%s (%s) while deleting it.\n",
|
||||
paddress (bp->pc), safe_strerror (ret));
|
||||
threads_debug_printf
|
||||
("Failed to uninsert fast tracepoint jump "
|
||||
"at 0x%s (%s) while deleting it.",
|
||||
paddress (bp->pc), safe_strerror (ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -657,10 +650,9 @@ set_fast_tracepoint_jump (CORE_ADDR where,
|
||||
err = read_inferior_memory (where, buf, length);
|
||||
if (err != 0)
|
||||
{
|
||||
if (debug_threads)
|
||||
debug_printf ("Failed to read shadow memory of"
|
||||
" fast tracepoint at 0x%s (%s).\n",
|
||||
paddress (where), safe_strerror (err));
|
||||
threads_debug_printf ("Failed to read shadow memory of"
|
||||
" fast tracepoint at 0x%s (%s).",
|
||||
paddress (where), safe_strerror (err));
|
||||
free (jp);
|
||||
return NULL;
|
||||
}
|
||||
@ -682,9 +674,9 @@ set_fast_tracepoint_jump (CORE_ADDR where,
|
||||
err = target_write_memory (where, buf, length);
|
||||
if (err != 0)
|
||||
{
|
||||
if (debug_threads)
|
||||
debug_printf ("Failed to insert fast tracepoint jump at 0x%s (%s).\n",
|
||||
paddress (where), safe_strerror (err));
|
||||
threads_debug_printf
|
||||
("Failed to insert fast tracepoint jump at 0x%s (%s).",
|
||||
paddress (where), safe_strerror (err));
|
||||
|
||||
/* Unlink it. */
|
||||
proc->fast_tracepoint_jumps = jp->next;
|
||||
@ -707,10 +699,9 @@ uninsert_fast_tracepoint_jumps_at (CORE_ADDR pc)
|
||||
{
|
||||
/* This can happen when we remove all breakpoints while handling
|
||||
a step-over. */
|
||||
if (debug_threads)
|
||||
debug_printf ("Could not find fast tracepoint jump at 0x%s "
|
||||
"in list (uninserting).\n",
|
||||
paddress (pc));
|
||||
threads_debug_printf ("Could not find fast tracepoint jump at 0x%s "
|
||||
"in list (uninserting).",
|
||||
paddress (pc));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -736,10 +727,9 @@ uninsert_fast_tracepoint_jumps_at (CORE_ADDR pc)
|
||||
{
|
||||
jp->inserted = 1;
|
||||
|
||||
if (debug_threads)
|
||||
debug_printf ("Failed to uninsert fast tracepoint jump at"
|
||||
" 0x%s (%s).\n",
|
||||
paddress (pc), safe_strerror (err));
|
||||
threads_debug_printf ("Failed to uninsert fast tracepoint jump at"
|
||||
" 0x%s (%s).",
|
||||
paddress (pc), safe_strerror (err));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -756,10 +746,9 @@ reinsert_fast_tracepoint_jumps_at (CORE_ADDR where)
|
||||
{
|
||||
/* This can happen when we remove breakpoints when a tracepoint
|
||||
hit causes a tracing stop, while handling a step-over. */
|
||||
if (debug_threads)
|
||||
debug_printf ("Could not find fast tracepoint jump at 0x%s "
|
||||
"in list (reinserting).\n",
|
||||
paddress (where));
|
||||
threads_debug_printf ("Could not find fast tracepoint jump at 0x%s "
|
||||
"in list (reinserting).",
|
||||
paddress (where));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -783,10 +772,9 @@ reinsert_fast_tracepoint_jumps_at (CORE_ADDR where)
|
||||
{
|
||||
jp->inserted = 0;
|
||||
|
||||
if (debug_threads)
|
||||
debug_printf ("Failed to reinsert fast tracepoint jump at"
|
||||
" 0x%s (%s).\n",
|
||||
paddress (where), safe_strerror (err));
|
||||
threads_debug_printf ("Failed to reinsert fast tracepoint jump at"
|
||||
" 0x%s (%s).",
|
||||
paddress (where), safe_strerror (err));
|
||||
}
|
||||
}
|
||||
|
||||
@ -897,10 +885,9 @@ delete_raw_breakpoint (struct process_info *proc, struct raw_breakpoint *todel)
|
||||
/* Something went wrong, relink the breakpoint. */
|
||||
*bp_link = prev_bp_link;
|
||||
|
||||
if (debug_threads)
|
||||
debug_printf ("Failed to uninsert raw breakpoint "
|
||||
"at 0x%s while deleting it.\n",
|
||||
paddress (bp->pc));
|
||||
threads_debug_printf ("Failed to uninsert raw breakpoint "
|
||||
"at 0x%s while deleting it.",
|
||||
paddress (bp->pc));
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@ -1404,10 +1391,9 @@ gdb_no_commands_at_breakpoint_z_type (char z_type, CORE_ADDR addr)
|
||||
if (bp == NULL)
|
||||
return 1;
|
||||
|
||||
if (debug_threads)
|
||||
debug_printf ("at 0x%s, type Z%c, bp command_list is 0x%s\n",
|
||||
paddress (addr), z_type,
|
||||
phex_nz ((uintptr_t) bp->command_list, 0));
|
||||
threads_debug_printf ("at 0x%s, type Z%c, bp command_list is 0x%s",
|
||||
paddress (addr), z_type,
|
||||
phex_nz ((uintptr_t) bp->command_list, 0));
|
||||
return (bp->command_list == NULL);
|
||||
}
|
||||
|
||||
@ -1521,9 +1507,8 @@ uninsert_raw_breakpoint (struct raw_breakpoint *bp)
|
||||
{
|
||||
if (bp->inserted < 0)
|
||||
{
|
||||
if (debug_threads)
|
||||
debug_printf ("Breakpoint at %s is marked insert-disabled.\n",
|
||||
paddress (bp->pc));
|
||||
threads_debug_printf ("Breakpoint at %s is marked insert-disabled.",
|
||||
paddress (bp->pc));
|
||||
}
|
||||
else if (bp->inserted > 0)
|
||||
{
|
||||
@ -1536,9 +1521,8 @@ uninsert_raw_breakpoint (struct raw_breakpoint *bp)
|
||||
{
|
||||
bp->inserted = 1;
|
||||
|
||||
if (debug_threads)
|
||||
debug_printf ("Failed to uninsert raw breakpoint at 0x%s.\n",
|
||||
paddress (bp->pc));
|
||||
threads_debug_printf ("Failed to uninsert raw breakpoint at 0x%s.",
|
||||
paddress (bp->pc));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1565,10 +1549,9 @@ uninsert_breakpoints_at (CORE_ADDR pc)
|
||||
{
|
||||
/* This can happen when we remove all breakpoints while handling
|
||||
a step-over. */
|
||||
if (debug_threads)
|
||||
debug_printf ("Could not find breakpoint at 0x%s "
|
||||
"in list (uninserting).\n",
|
||||
paddress (pc));
|
||||
threads_debug_printf ("Could not find breakpoint at 0x%s "
|
||||
"in list (uninserting).",
|
||||
paddress (pc));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1622,9 +1605,9 @@ reinsert_raw_breakpoint (struct raw_breakpoint *bp)
|
||||
err = the_target->insert_point (bp->raw_type, bp->pc, bp->kind, bp);
|
||||
if (err == 0)
|
||||
bp->inserted = 1;
|
||||
else if (debug_threads)
|
||||
debug_printf ("Failed to reinsert breakpoint at 0x%s (%d).\n",
|
||||
paddress (bp->pc), err);
|
||||
else
|
||||
threads_debug_printf ("Failed to reinsert breakpoint at 0x%s (%d).",
|
||||
paddress (bp->pc), err);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1648,10 +1631,9 @@ reinsert_breakpoints_at (CORE_ADDR pc)
|
||||
{
|
||||
/* This can happen when we remove all breakpoints while handling
|
||||
a step-over. */
|
||||
if (debug_threads)
|
||||
debug_printf ("Could not find raw breakpoint at 0x%s "
|
||||
"in list (reinserting).\n",
|
||||
paddress (pc));
|
||||
threads_debug_printf ("Could not find raw breakpoint at 0x%s "
|
||||
"in list (reinserting).",
|
||||
paddress (pc));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,8 +144,7 @@ handle_accept_event (int err, gdb_client_data client_data)
|
||||
struct sockaddr_storage sockaddr;
|
||||
socklen_t len = sizeof (sockaddr);
|
||||
|
||||
if (debug_threads)
|
||||
debug_printf ("handling possible accept event\n");
|
||||
threads_debug_printf ("handling possible accept event");
|
||||
|
||||
remote_desc = accept (listen_desc, (struct sockaddr *) &sockaddr, &len);
|
||||
if (remote_desc == -1)
|
||||
@ -1084,9 +1083,8 @@ void
|
||||
prepare_resume_reply (char *buf, ptid_t ptid, const target_waitstatus &status)
|
||||
{
|
||||
client_state &cs = get_client_state ();
|
||||
if (debug_threads)
|
||||
debug_printf ("Writing resume reply for %s:%d\n",
|
||||
target_pid_to_str (ptid).c_str (), status.kind ());
|
||||
threads_debug_printf ("Writing resume reply for %s:%d",
|
||||
target_pid_to_str (ptid).c_str (), status.kind ());
|
||||
|
||||
switch (status.kind ())
|
||||
{
|
||||
|
@ -1228,8 +1228,7 @@ handle_detach (char *own_buf)
|
||||
pass signals down without informing GDB. */
|
||||
if (!non_stop)
|
||||
{
|
||||
if (debug_threads)
|
||||
debug_printf ("Forcing non-stop mode\n");
|
||||
threads_debug_printf ("Forcing non-stop mode");
|
||||
|
||||
non_stop = true;
|
||||
the_target->start_non_stop (true);
|
||||
@ -3336,10 +3335,10 @@ queue_stop_reply_callback (thread_info *thread)
|
||||
{
|
||||
if (target_thread_stopped (thread))
|
||||
{
|
||||
if (debug_threads)
|
||||
debug_printf ("Reporting thread %s as already stopped with %s\n",
|
||||
target_pid_to_str (thread->id).c_str (),
|
||||
thread->last_status.to_string ().c_str ());
|
||||
threads_debug_printf
|
||||
("Reporting thread %s as already stopped with %s",
|
||||
target_pid_to_str (thread->id).c_str (),
|
||||
thread->last_status.to_string ().c_str ());
|
||||
|
||||
gdb_assert (thread->last_status.kind () != TARGET_WAITKIND_IGNORE);
|
||||
|
||||
@ -4183,16 +4182,14 @@ process_point_options (struct gdb_breakpoint *bp, const char **packet)
|
||||
if (*dataptr == 'X')
|
||||
{
|
||||
/* Conditional expression. */
|
||||
if (debug_threads)
|
||||
debug_printf ("Found breakpoint condition.\n");
|
||||
threads_debug_printf ("Found breakpoint condition.");
|
||||
if (!add_breakpoint_condition (bp, &dataptr))
|
||||
dataptr = strchrnul (dataptr, ';');
|
||||
}
|
||||
else if (startswith (dataptr, "cmds:"))
|
||||
{
|
||||
dataptr += strlen ("cmds:");
|
||||
if (debug_threads)
|
||||
debug_printf ("Found breakpoint commands %s.\n", dataptr);
|
||||
threads_debug_printf ("Found breakpoint commands %s.", dataptr);
|
||||
persist = (*dataptr == '1');
|
||||
dataptr += 2;
|
||||
if (add_breakpoint_commands (bp, &dataptr, persist))
|
||||
@ -4576,8 +4573,7 @@ process_serial_event (void)
|
||||
void
|
||||
handle_serial_event (int err, gdb_client_data client_data)
|
||||
{
|
||||
if (debug_threads)
|
||||
debug_printf ("handling possible serial event\n");
|
||||
threads_debug_printf ("handling possible serial event");
|
||||
|
||||
/* Really handle it. */
|
||||
if (process_serial_event () < 0)
|
||||
@ -4610,8 +4606,7 @@ void
|
||||
handle_target_event (int err, gdb_client_data client_data)
|
||||
{
|
||||
client_state &cs = get_client_state ();
|
||||
if (debug_threads)
|
||||
debug_printf ("handling possible target event\n");
|
||||
threads_debug_printf ("handling possible target event");
|
||||
|
||||
cs.last_ptid = mywait (minus_one_ptid, &cs.last_status,
|
||||
TARGET_WNOHANG, 1);
|
||||
@ -4663,11 +4658,10 @@ handle_target_event (int err, gdb_client_data client_data)
|
||||
inferior, as if it wasn't being traced. */
|
||||
enum gdb_signal signal;
|
||||
|
||||
if (debug_threads)
|
||||
debug_printf ("GDB not connected; forwarding event %d for"
|
||||
" [%s]\n",
|
||||
(int) cs.last_status.kind (),
|
||||
target_pid_to_str (cs.last_ptid).c_str ());
|
||||
threads_debug_printf ("GDB not connected; forwarding event %d for"
|
||||
" [%s]",
|
||||
(int) cs.last_status.kind (),
|
||||
target_pid_to_str (cs.last_ptid).c_str ());
|
||||
|
||||
if (cs.last_status.kind () == TARGET_WAITKIND_STOPPED)
|
||||
signal = cs.last_status.sig ();
|
||||
|
@ -184,9 +184,8 @@ find_one_thread (ptid_t ptid)
|
||||
error ("Cannot get thread info for LWP %d: %s",
|
||||
lwpid, thread_db_err_str (err));
|
||||
|
||||
if (debug_threads)
|
||||
debug_printf ("Found thread %ld (LWP %d)\n",
|
||||
(unsigned long) ti.ti_tid, ti.ti_lid);
|
||||
threads_debug_printf ("Found thread %ld (LWP %d)",
|
||||
(unsigned long) ti.ti_tid, ti.ti_lid);
|
||||
|
||||
if (lwpid != ti.ti_lid)
|
||||
{
|
||||
@ -218,9 +217,8 @@ attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t *ti_p)
|
||||
struct lwp_info *lwp;
|
||||
int err;
|
||||
|
||||
if (debug_threads)
|
||||
debug_printf ("Attaching to thread %ld (LWP %d)\n",
|
||||
(unsigned long) ti_p->ti_tid, ti_p->ti_lid);
|
||||
threads_debug_printf ("Attaching to thread %ld (LWP %d)",
|
||||
(unsigned long) ti_p->ti_tid, ti_p->ti_lid);
|
||||
err = the_linux_target->attach_lwp (ptid);
|
||||
if (err != 0)
|
||||
{
|
||||
@ -283,10 +281,9 @@ find_new_threads_callback (const td_thrhandle_t *th_p, void *data)
|
||||
thread that previously exited and was joined. (glibc marks
|
||||
terminated and joined threads with kernel thread ID -1. See
|
||||
glibc PR17707. */
|
||||
if (debug_threads)
|
||||
debug_printf ("thread_db: skipping exited and "
|
||||
"joined thread (0x%lx)\n",
|
||||
(unsigned long) ti.ti_tid);
|
||||
threads_debug_printf ("thread_db: skipping exited and "
|
||||
"joined thread (0x%lx)",
|
||||
(unsigned long) ti.ti_tid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -333,9 +330,8 @@ thread_db_find_new_threads (void)
|
||||
TD_THR_ANY_STATE,
|
||||
TD_THR_LOWEST_PRIORITY,
|
||||
TD_SIGNO_MASK, TD_THR_ANY_USER_FLAGS);
|
||||
if (debug_threads)
|
||||
debug_printf ("Found %d threads in iteration %d.\n",
|
||||
new_thread_count, iteration);
|
||||
threads_debug_printf ("Found %d threads in iteration %d.",
|
||||
new_thread_count, iteration);
|
||||
|
||||
if (new_thread_count != 0)
|
||||
{
|
||||
@ -492,8 +488,7 @@ thread_db_load_search (void)
|
||||
err = tdb->td_ta_new_p (&tdb->proc_handle, &tdb->thread_agent);
|
||||
if (err != TD_OK)
|
||||
{
|
||||
if (debug_threads)
|
||||
debug_printf ("td_ta_new(): %s\n", thread_db_err_str (err));
|
||||
threads_debug_printf ("td_ta_new(): %s", thread_db_err_str (err));
|
||||
free (tdb);
|
||||
proc->priv->thread_db = NULL;
|
||||
return 0;
|
||||
@ -535,8 +530,7 @@ try_thread_db_load_1 (void *handle)
|
||||
{ \
|
||||
if ((a) == NULL) \
|
||||
{ \
|
||||
if (debug_threads) \
|
||||
debug_printf ("dlsym: %s\n", dlerror ()); \
|
||||
threads_debug_printf ("dlsym: %s", dlerror ()); \
|
||||
if (required) \
|
||||
{ \
|
||||
free (tdb); \
|
||||
@ -556,8 +550,7 @@ try_thread_db_load_1 (void *handle)
|
||||
err = tdb->td_ta_new_p (&tdb->proc_handle, &tdb->thread_agent);
|
||||
if (err != TD_OK)
|
||||
{
|
||||
if (debug_threads)
|
||||
debug_printf ("td_ta_new(): %s\n", thread_db_err_str (err));
|
||||
threads_debug_printf ("td_ta_new(): %s", thread_db_err_str (err));
|
||||
free (tdb);
|
||||
proc->priv->thread_db = NULL;
|
||||
return 0;
|
||||
@ -601,14 +594,12 @@ try_thread_db_load (const char *library)
|
||||
{
|
||||
void *handle;
|
||||
|
||||
if (debug_threads)
|
||||
debug_printf ("Trying host libthread_db library: %s.\n",
|
||||
library);
|
||||
threads_debug_printf ("Trying host libthread_db library: %s.",
|
||||
library);
|
||||
handle = dlopen (library, RTLD_NOW);
|
||||
if (handle == NULL)
|
||||
{
|
||||
if (debug_threads)
|
||||
debug_printf ("dlopen failed: %s.\n", dlerror ());
|
||||
threads_debug_printf ("dlopen failed: %s.", dlerror ());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -623,7 +614,7 @@ try_thread_db_load (const char *library)
|
||||
const char *const libpath = dladdr_to_soname (td_init);
|
||||
|
||||
if (libpath != NULL)
|
||||
debug_printf ("Host %s resolved to: %s.\n", library, libpath);
|
||||
threads_debug_printf ("Host %s resolved to: %s.", library, libpath);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -722,8 +713,7 @@ thread_db_load_search (void)
|
||||
}
|
||||
}
|
||||
|
||||
if (debug_threads)
|
||||
debug_printf ("thread_db_load_search returning %d\n", rc);
|
||||
threads_debug_printf ("thread_db_load_search returning %d", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -87,11 +87,7 @@ trace_vdebug (const char *fmt, ...)
|
||||
|
||||
#define trace_debug(fmt, args...) \
|
||||
do { \
|
||||
if (debug_threads) \
|
||||
{ \
|
||||
debug_printf ((fmt), ##args); \
|
||||
debug_printf ("\n"); \
|
||||
} \
|
||||
threads_debug_printf ((fmt), ##args); \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
@ -324,8 +320,7 @@ tracepoint_look_up_symbols (void)
|
||||
|
||||
if (look_up_one_symbol (symbol_list[i].name, addrp, 1) == 0)
|
||||
{
|
||||
if (debug_threads)
|
||||
debug_printf ("symbol `%s' not found\n", symbol_list[i].name);
|
||||
threads_debug_printf ("symbol `%s' not found", symbol_list[i].name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -4519,15 +4514,14 @@ handle_tracepoint_bkpts (struct thread_info *tinfo, CORE_ADDR stop_pc)
|
||||
ipa_expr_eval_result,
|
||||
paddress (ipa_error_tracepoint));
|
||||
|
||||
if (debug_threads)
|
||||
{
|
||||
if (ipa_trace_buffer_is_full)
|
||||
trace_debug ("lib stopped due to full buffer.");
|
||||
if (ipa_stopping_tracepoint)
|
||||
trace_debug ("lib stopped due to tpoint");
|
||||
if (ipa_error_tracepoint)
|
||||
trace_debug ("lib stopped due to error");
|
||||
}
|
||||
if (ipa_trace_buffer_is_full)
|
||||
trace_debug ("lib stopped due to full buffer.");
|
||||
|
||||
if (ipa_stopping_tracepoint)
|
||||
trace_debug ("lib stopped due to tpoint");
|
||||
|
||||
if (ipa_error_tracepoint)
|
||||
trace_debug ("lib stopped due to error");
|
||||
|
||||
if (ipa_stopping_tracepoint != 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user