mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-17 16:05:56 +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:
@ -39,7 +39,7 @@ ax_vdebug (const char *fmt, ...)
|
|||||||
#ifdef IN_PROCESS_AGENT
|
#ifdef IN_PROCESS_AGENT
|
||||||
fprintf (stderr, PROG "/ax: %s\n", buf);
|
fprintf (stderr, PROG "/ax: %s\n", buf);
|
||||||
#else
|
#else
|
||||||
debug_printf (PROG "/ax: %s\n", buf);
|
threads_debug_printf (PROG "/ax: %s", buf);
|
||||||
#endif
|
#endif
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
}
|
}
|
||||||
|
@ -110,30 +110,6 @@ debug_flush (void)
|
|||||||
fflush (debug_file);
|
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. */
|
/* See debug.h. */
|
||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
|
@ -35,31 +35,22 @@ extern int using_threads;
|
|||||||
|
|
||||||
extern bool debug_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;
|
extern int debug_timestamp;
|
||||||
|
|
||||||
void debug_flush (void);
|
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. */
|
/* Async signal safe debug output function that calls write directly. */
|
||||||
ssize_t debug_write (const void *buf, size_t nbyte);
|
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 */
|
#endif /* GDBSERVER_DEBUG_H */
|
||||||
|
@ -45,11 +45,7 @@ void
|
|||||||
prefork_hook (const char *args)
|
prefork_hook (const char *args)
|
||||||
{
|
{
|
||||||
client_state &cs = get_client_state ();
|
client_state &cs = get_client_state ();
|
||||||
if (debug_threads)
|
threads_debug_printf ("args: %s", args);
|
||||||
{
|
|
||||||
debug_printf ("args: %s\n", args);
|
|
||||||
debug_flush ();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef SIGTTOU
|
#ifdef SIGTTOU
|
||||||
signal (SIGTTOU, SIG_DFL);
|
signal (SIGTTOU, SIG_DFL);
|
||||||
|
@ -2467,8 +2467,7 @@ emit_ops_insns (const uint32_t *start, int len)
|
|||||||
{
|
{
|
||||||
CORE_ADDR buildaddr = current_insn_ptr;
|
CORE_ADDR buildaddr = current_insn_ptr;
|
||||||
|
|
||||||
if (debug_threads)
|
threads_debug_printf ("Adding %d instrucions at %s",
|
||||||
debug_printf ("Adding %d instrucions at %s\n",
|
|
||||||
len, paddress (buildaddr));
|
len, paddress (buildaddr));
|
||||||
|
|
||||||
append_insns (&buildaddr, len, start);
|
append_insns (&buildaddr, len, start);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1503,8 +1503,7 @@ add_insns (const unsigned char *start, int len)
|
|||||||
{
|
{
|
||||||
CORE_ADDR buildaddr = current_insn_ptr;
|
CORE_ADDR buildaddr = current_insn_ptr;
|
||||||
|
|
||||||
if (debug_threads)
|
threads_debug_printf ("Adding %d bytes of insn at %s",
|
||||||
debug_printf ("Adding %d bytes of insn at %s\n",
|
|
||||||
len, paddress (buildaddr));
|
len, paddress (buildaddr));
|
||||||
|
|
||||||
append_insns (&buildaddr, len, start);
|
append_insns (&buildaddr, len, start);
|
||||||
|
@ -1628,8 +1628,7 @@ add_insns (unsigned char *start, int len)
|
|||||||
{
|
{
|
||||||
CORE_ADDR buildaddr = current_insn_ptr;
|
CORE_ADDR buildaddr = current_insn_ptr;
|
||||||
|
|
||||||
if (debug_threads)
|
threads_debug_printf ("Adding %d bytes of insn at %s",
|
||||||
debug_printf ("Adding %d bytes of insn at %s\n",
|
|
||||||
len, paddress (buildaddr));
|
len, paddress (buildaddr));
|
||||||
|
|
||||||
append_insns (&buildaddr, len, start);
|
append_insns (&buildaddr, len, start);
|
||||||
|
@ -371,9 +371,8 @@ insert_memory_breakpoint (struct raw_breakpoint *bp)
|
|||||||
err = read_inferior_memory (bp->pc, buf, bp_size (bp));
|
err = read_inferior_memory (bp->pc, buf, bp_size (bp));
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
{
|
{
|
||||||
if (debug_threads)
|
threads_debug_printf ("Failed to read shadow memory of"
|
||||||
debug_printf ("Failed to read shadow memory of"
|
" breakpoint at 0x%s (%s).",
|
||||||
" breakpoint at 0x%s (%s).\n",
|
|
||||||
paddress (bp->pc), safe_strerror (err));
|
paddress (bp->pc), safe_strerror (err));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -383,12 +382,9 @@ insert_memory_breakpoint (struct raw_breakpoint *bp)
|
|||||||
err = the_target->write_memory (bp->pc, bp_opcode (bp),
|
err = the_target->write_memory (bp->pc, bp_opcode (bp),
|
||||||
bp_size (bp));
|
bp_size (bp));
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
{
|
threads_debug_printf ("Failed to insert breakpoint at 0x%s (%s).",
|
||||||
if (debug_threads)
|
|
||||||
debug_printf ("Failed to insert breakpoint at 0x%s (%s).\n",
|
|
||||||
paddress (bp->pc), safe_strerror (err));
|
paddress (bp->pc), safe_strerror (err));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return err != 0 ? -1 : 0;
|
return err != 0 ? -1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -411,12 +407,10 @@ remove_memory_breakpoint (struct raw_breakpoint *bp)
|
|||||||
memcpy (buf, bp->old_data, bp_size (bp));
|
memcpy (buf, bp->old_data, bp_size (bp));
|
||||||
err = target_write_memory (bp->pc, buf, bp_size (bp));
|
err = target_write_memory (bp->pc, buf, bp_size (bp));
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
{
|
threads_debug_printf ("Failed to uninsert raw breakpoint "
|
||||||
if (debug_threads)
|
"at 0x%s (%s) while deleting it.",
|
||||||
debug_printf ("Failed to uninsert raw breakpoint "
|
|
||||||
"at 0x%s (%s) while deleting it.\n",
|
|
||||||
paddress (bp->pc), safe_strerror (err));
|
paddress (bp->pc), safe_strerror (err));
|
||||||
}
|
|
||||||
return err != 0 ? -1 : 0;
|
return err != 0 ? -1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -438,8 +432,8 @@ set_raw_breakpoint_at (enum raw_bkpt_type type, CORE_ADDR where, int kind,
|
|||||||
{
|
{
|
||||||
/* A different kind than previously seen. The previous
|
/* A different kind than previously seen. The previous
|
||||||
breakpoint must be gone then. */
|
breakpoint must be gone then. */
|
||||||
if (debug_threads)
|
threads_debug_printf
|
||||||
debug_printf ("Inconsistent breakpoint kind? Was %d, now %d.\n",
|
("Inconsistent breakpoint kind? Was %d, now %d.",
|
||||||
bp->kind, kind);
|
bp->kind, kind);
|
||||||
bp->inserted = -1;
|
bp->inserted = -1;
|
||||||
bp = NULL;
|
bp = NULL;
|
||||||
@ -463,8 +457,7 @@ 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);
|
*err = the_target->insert_point (bp->raw_type, bp->pc, bp->kind, bp);
|
||||||
if (*err != 0)
|
if (*err != 0)
|
||||||
{
|
{
|
||||||
if (debug_threads)
|
threads_debug_printf ("Failed to insert breakpoint at 0x%s (%d).",
|
||||||
debug_printf ("Failed to insert breakpoint at 0x%s (%d).\n",
|
|
||||||
paddress (where), *err);
|
paddress (where), *err);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -594,9 +587,9 @@ delete_fast_tracepoint_jump (struct fast_tracepoint_jump *todel)
|
|||||||
/* Something went wrong, relink the jump. */
|
/* Something went wrong, relink the jump. */
|
||||||
*bp_link = prev_bp_link;
|
*bp_link = prev_bp_link;
|
||||||
|
|
||||||
if (debug_threads)
|
threads_debug_printf
|
||||||
debug_printf ("Failed to uninsert fast tracepoint jump "
|
("Failed to uninsert fast tracepoint jump "
|
||||||
"at 0x%s (%s) while deleting it.\n",
|
"at 0x%s (%s) while deleting it.",
|
||||||
paddress (bp->pc), safe_strerror (ret));
|
paddress (bp->pc), safe_strerror (ret));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -657,9 +650,8 @@ set_fast_tracepoint_jump (CORE_ADDR where,
|
|||||||
err = read_inferior_memory (where, buf, length);
|
err = read_inferior_memory (where, buf, length);
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
{
|
{
|
||||||
if (debug_threads)
|
threads_debug_printf ("Failed to read shadow memory of"
|
||||||
debug_printf ("Failed to read shadow memory of"
|
" fast tracepoint at 0x%s (%s).",
|
||||||
" fast tracepoint at 0x%s (%s).\n",
|
|
||||||
paddress (where), safe_strerror (err));
|
paddress (where), safe_strerror (err));
|
||||||
free (jp);
|
free (jp);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -682,8 +674,8 @@ set_fast_tracepoint_jump (CORE_ADDR where,
|
|||||||
err = target_write_memory (where, buf, length);
|
err = target_write_memory (where, buf, length);
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
{
|
{
|
||||||
if (debug_threads)
|
threads_debug_printf
|
||||||
debug_printf ("Failed to insert fast tracepoint jump at 0x%s (%s).\n",
|
("Failed to insert fast tracepoint jump at 0x%s (%s).",
|
||||||
paddress (where), safe_strerror (err));
|
paddress (where), safe_strerror (err));
|
||||||
|
|
||||||
/* Unlink it. */
|
/* Unlink it. */
|
||||||
@ -707,9 +699,8 @@ uninsert_fast_tracepoint_jumps_at (CORE_ADDR pc)
|
|||||||
{
|
{
|
||||||
/* This can happen when we remove all breakpoints while handling
|
/* This can happen when we remove all breakpoints while handling
|
||||||
a step-over. */
|
a step-over. */
|
||||||
if (debug_threads)
|
threads_debug_printf ("Could not find fast tracepoint jump at 0x%s "
|
||||||
debug_printf ("Could not find fast tracepoint jump at 0x%s "
|
"in list (uninserting).",
|
||||||
"in list (uninserting).\n",
|
|
||||||
paddress (pc));
|
paddress (pc));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -736,9 +727,8 @@ uninsert_fast_tracepoint_jumps_at (CORE_ADDR pc)
|
|||||||
{
|
{
|
||||||
jp->inserted = 1;
|
jp->inserted = 1;
|
||||||
|
|
||||||
if (debug_threads)
|
threads_debug_printf ("Failed to uninsert fast tracepoint jump at"
|
||||||
debug_printf ("Failed to uninsert fast tracepoint jump at"
|
" 0x%s (%s).",
|
||||||
" 0x%s (%s).\n",
|
|
||||||
paddress (pc), safe_strerror (err));
|
paddress (pc), safe_strerror (err));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -756,9 +746,8 @@ reinsert_fast_tracepoint_jumps_at (CORE_ADDR where)
|
|||||||
{
|
{
|
||||||
/* This can happen when we remove breakpoints when a tracepoint
|
/* This can happen when we remove breakpoints when a tracepoint
|
||||||
hit causes a tracing stop, while handling a step-over. */
|
hit causes a tracing stop, while handling a step-over. */
|
||||||
if (debug_threads)
|
threads_debug_printf ("Could not find fast tracepoint jump at 0x%s "
|
||||||
debug_printf ("Could not find fast tracepoint jump at 0x%s "
|
"in list (reinserting).",
|
||||||
"in list (reinserting).\n",
|
|
||||||
paddress (where));
|
paddress (where));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -783,9 +772,8 @@ reinsert_fast_tracepoint_jumps_at (CORE_ADDR where)
|
|||||||
{
|
{
|
||||||
jp->inserted = 0;
|
jp->inserted = 0;
|
||||||
|
|
||||||
if (debug_threads)
|
threads_debug_printf ("Failed to reinsert fast tracepoint jump at"
|
||||||
debug_printf ("Failed to reinsert fast tracepoint jump at"
|
" 0x%s (%s).",
|
||||||
" 0x%s (%s).\n",
|
|
||||||
paddress (where), safe_strerror (err));
|
paddress (where), safe_strerror (err));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -897,9 +885,8 @@ delete_raw_breakpoint (struct process_info *proc, struct raw_breakpoint *todel)
|
|||||||
/* Something went wrong, relink the breakpoint. */
|
/* Something went wrong, relink the breakpoint. */
|
||||||
*bp_link = prev_bp_link;
|
*bp_link = prev_bp_link;
|
||||||
|
|
||||||
if (debug_threads)
|
threads_debug_printf ("Failed to uninsert raw breakpoint "
|
||||||
debug_printf ("Failed to uninsert raw breakpoint "
|
"at 0x%s while deleting it.",
|
||||||
"at 0x%s while deleting it.\n",
|
|
||||||
paddress (bp->pc));
|
paddress (bp->pc));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -1404,8 +1391,7 @@ gdb_no_commands_at_breakpoint_z_type (char z_type, CORE_ADDR addr)
|
|||||||
if (bp == NULL)
|
if (bp == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (debug_threads)
|
threads_debug_printf ("at 0x%s, type Z%c, bp command_list is 0x%s",
|
||||||
debug_printf ("at 0x%s, type Z%c, bp command_list is 0x%s\n",
|
|
||||||
paddress (addr), z_type,
|
paddress (addr), z_type,
|
||||||
phex_nz ((uintptr_t) bp->command_list, 0));
|
phex_nz ((uintptr_t) bp->command_list, 0));
|
||||||
return (bp->command_list == NULL);
|
return (bp->command_list == NULL);
|
||||||
@ -1521,8 +1507,7 @@ uninsert_raw_breakpoint (struct raw_breakpoint *bp)
|
|||||||
{
|
{
|
||||||
if (bp->inserted < 0)
|
if (bp->inserted < 0)
|
||||||
{
|
{
|
||||||
if (debug_threads)
|
threads_debug_printf ("Breakpoint at %s is marked insert-disabled.",
|
||||||
debug_printf ("Breakpoint at %s is marked insert-disabled.\n",
|
|
||||||
paddress (bp->pc));
|
paddress (bp->pc));
|
||||||
}
|
}
|
||||||
else if (bp->inserted > 0)
|
else if (bp->inserted > 0)
|
||||||
@ -1536,8 +1521,7 @@ uninsert_raw_breakpoint (struct raw_breakpoint *bp)
|
|||||||
{
|
{
|
||||||
bp->inserted = 1;
|
bp->inserted = 1;
|
||||||
|
|
||||||
if (debug_threads)
|
threads_debug_printf ("Failed to uninsert raw breakpoint at 0x%s.",
|
||||||
debug_printf ("Failed to uninsert raw breakpoint at 0x%s.\n",
|
|
||||||
paddress (bp->pc));
|
paddress (bp->pc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1565,9 +1549,8 @@ uninsert_breakpoints_at (CORE_ADDR pc)
|
|||||||
{
|
{
|
||||||
/* This can happen when we remove all breakpoints while handling
|
/* This can happen when we remove all breakpoints while handling
|
||||||
a step-over. */
|
a step-over. */
|
||||||
if (debug_threads)
|
threads_debug_printf ("Could not find breakpoint at 0x%s "
|
||||||
debug_printf ("Could not find breakpoint at 0x%s "
|
"in list (uninserting).",
|
||||||
"in list (uninserting).\n",
|
|
||||||
paddress (pc));
|
paddress (pc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1622,8 +1605,8 @@ reinsert_raw_breakpoint (struct raw_breakpoint *bp)
|
|||||||
err = the_target->insert_point (bp->raw_type, bp->pc, bp->kind, bp);
|
err = the_target->insert_point (bp->raw_type, bp->pc, bp->kind, bp);
|
||||||
if (err == 0)
|
if (err == 0)
|
||||||
bp->inserted = 1;
|
bp->inserted = 1;
|
||||||
else if (debug_threads)
|
else
|
||||||
debug_printf ("Failed to reinsert breakpoint at 0x%s (%d).\n",
|
threads_debug_printf ("Failed to reinsert breakpoint at 0x%s (%d).",
|
||||||
paddress (bp->pc), err);
|
paddress (bp->pc), err);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1648,9 +1631,8 @@ reinsert_breakpoints_at (CORE_ADDR pc)
|
|||||||
{
|
{
|
||||||
/* This can happen when we remove all breakpoints while handling
|
/* This can happen when we remove all breakpoints while handling
|
||||||
a step-over. */
|
a step-over. */
|
||||||
if (debug_threads)
|
threads_debug_printf ("Could not find raw breakpoint at 0x%s "
|
||||||
debug_printf ("Could not find raw breakpoint at 0x%s "
|
"in list (reinserting).",
|
||||||
"in list (reinserting).\n",
|
|
||||||
paddress (pc));
|
paddress (pc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,8 +144,7 @@ handle_accept_event (int err, gdb_client_data client_data)
|
|||||||
struct sockaddr_storage sockaddr;
|
struct sockaddr_storage sockaddr;
|
||||||
socklen_t len = sizeof (sockaddr);
|
socklen_t len = sizeof (sockaddr);
|
||||||
|
|
||||||
if (debug_threads)
|
threads_debug_printf ("handling possible accept event");
|
||||||
debug_printf ("handling possible accept event\n");
|
|
||||||
|
|
||||||
remote_desc = accept (listen_desc, (struct sockaddr *) &sockaddr, &len);
|
remote_desc = accept (listen_desc, (struct sockaddr *) &sockaddr, &len);
|
||||||
if (remote_desc == -1)
|
if (remote_desc == -1)
|
||||||
@ -1084,8 +1083,7 @@ void
|
|||||||
prepare_resume_reply (char *buf, ptid_t ptid, const target_waitstatus &status)
|
prepare_resume_reply (char *buf, ptid_t ptid, const target_waitstatus &status)
|
||||||
{
|
{
|
||||||
client_state &cs = get_client_state ();
|
client_state &cs = get_client_state ();
|
||||||
if (debug_threads)
|
threads_debug_printf ("Writing resume reply for %s:%d",
|
||||||
debug_printf ("Writing resume reply for %s:%d\n",
|
|
||||||
target_pid_to_str (ptid).c_str (), status.kind ());
|
target_pid_to_str (ptid).c_str (), status.kind ());
|
||||||
|
|
||||||
switch (status.kind ())
|
switch (status.kind ())
|
||||||
|
@ -1228,8 +1228,7 @@ handle_detach (char *own_buf)
|
|||||||
pass signals down without informing GDB. */
|
pass signals down without informing GDB. */
|
||||||
if (!non_stop)
|
if (!non_stop)
|
||||||
{
|
{
|
||||||
if (debug_threads)
|
threads_debug_printf ("Forcing non-stop mode");
|
||||||
debug_printf ("Forcing non-stop mode\n");
|
|
||||||
|
|
||||||
non_stop = true;
|
non_stop = true;
|
||||||
the_target->start_non_stop (true);
|
the_target->start_non_stop (true);
|
||||||
@ -3336,8 +3335,8 @@ queue_stop_reply_callback (thread_info *thread)
|
|||||||
{
|
{
|
||||||
if (target_thread_stopped (thread))
|
if (target_thread_stopped (thread))
|
||||||
{
|
{
|
||||||
if (debug_threads)
|
threads_debug_printf
|
||||||
debug_printf ("Reporting thread %s as already stopped with %s\n",
|
("Reporting thread %s as already stopped with %s",
|
||||||
target_pid_to_str (thread->id).c_str (),
|
target_pid_to_str (thread->id).c_str (),
|
||||||
thread->last_status.to_string ().c_str ());
|
thread->last_status.to_string ().c_str ());
|
||||||
|
|
||||||
@ -4183,16 +4182,14 @@ process_point_options (struct gdb_breakpoint *bp, const char **packet)
|
|||||||
if (*dataptr == 'X')
|
if (*dataptr == 'X')
|
||||||
{
|
{
|
||||||
/* Conditional expression. */
|
/* Conditional expression. */
|
||||||
if (debug_threads)
|
threads_debug_printf ("Found breakpoint condition.");
|
||||||
debug_printf ("Found breakpoint condition.\n");
|
|
||||||
if (!add_breakpoint_condition (bp, &dataptr))
|
if (!add_breakpoint_condition (bp, &dataptr))
|
||||||
dataptr = strchrnul (dataptr, ';');
|
dataptr = strchrnul (dataptr, ';');
|
||||||
}
|
}
|
||||||
else if (startswith (dataptr, "cmds:"))
|
else if (startswith (dataptr, "cmds:"))
|
||||||
{
|
{
|
||||||
dataptr += strlen ("cmds:");
|
dataptr += strlen ("cmds:");
|
||||||
if (debug_threads)
|
threads_debug_printf ("Found breakpoint commands %s.", dataptr);
|
||||||
debug_printf ("Found breakpoint commands %s.\n", dataptr);
|
|
||||||
persist = (*dataptr == '1');
|
persist = (*dataptr == '1');
|
||||||
dataptr += 2;
|
dataptr += 2;
|
||||||
if (add_breakpoint_commands (bp, &dataptr, persist))
|
if (add_breakpoint_commands (bp, &dataptr, persist))
|
||||||
@ -4576,8 +4573,7 @@ process_serial_event (void)
|
|||||||
void
|
void
|
||||||
handle_serial_event (int err, gdb_client_data client_data)
|
handle_serial_event (int err, gdb_client_data client_data)
|
||||||
{
|
{
|
||||||
if (debug_threads)
|
threads_debug_printf ("handling possible serial event");
|
||||||
debug_printf ("handling possible serial event\n");
|
|
||||||
|
|
||||||
/* Really handle it. */
|
/* Really handle it. */
|
||||||
if (process_serial_event () < 0)
|
if (process_serial_event () < 0)
|
||||||
@ -4610,8 +4606,7 @@ void
|
|||||||
handle_target_event (int err, gdb_client_data client_data)
|
handle_target_event (int err, gdb_client_data client_data)
|
||||||
{
|
{
|
||||||
client_state &cs = get_client_state ();
|
client_state &cs = get_client_state ();
|
||||||
if (debug_threads)
|
threads_debug_printf ("handling possible target event");
|
||||||
debug_printf ("handling possible target event\n");
|
|
||||||
|
|
||||||
cs.last_ptid = mywait (minus_one_ptid, &cs.last_status,
|
cs.last_ptid = mywait (minus_one_ptid, &cs.last_status,
|
||||||
TARGET_WNOHANG, 1);
|
TARGET_WNOHANG, 1);
|
||||||
@ -4663,9 +4658,8 @@ handle_target_event (int err, gdb_client_data client_data)
|
|||||||
inferior, as if it wasn't being traced. */
|
inferior, as if it wasn't being traced. */
|
||||||
enum gdb_signal signal;
|
enum gdb_signal signal;
|
||||||
|
|
||||||
if (debug_threads)
|
threads_debug_printf ("GDB not connected; forwarding event %d for"
|
||||||
debug_printf ("GDB not connected; forwarding event %d for"
|
" [%s]",
|
||||||
" [%s]\n",
|
|
||||||
(int) cs.last_status.kind (),
|
(int) cs.last_status.kind (),
|
||||||
target_pid_to_str (cs.last_ptid).c_str ());
|
target_pid_to_str (cs.last_ptid).c_str ());
|
||||||
|
|
||||||
|
@ -184,8 +184,7 @@ find_one_thread (ptid_t ptid)
|
|||||||
error ("Cannot get thread info for LWP %d: %s",
|
error ("Cannot get thread info for LWP %d: %s",
|
||||||
lwpid, thread_db_err_str (err));
|
lwpid, thread_db_err_str (err));
|
||||||
|
|
||||||
if (debug_threads)
|
threads_debug_printf ("Found thread %ld (LWP %d)",
|
||||||
debug_printf ("Found thread %ld (LWP %d)\n",
|
|
||||||
(unsigned long) ti.ti_tid, ti.ti_lid);
|
(unsigned long) ti.ti_tid, ti.ti_lid);
|
||||||
|
|
||||||
if (lwpid != ti.ti_lid)
|
if (lwpid != ti.ti_lid)
|
||||||
@ -218,8 +217,7 @@ attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t *ti_p)
|
|||||||
struct lwp_info *lwp;
|
struct lwp_info *lwp;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (debug_threads)
|
threads_debug_printf ("Attaching to thread %ld (LWP %d)",
|
||||||
debug_printf ("Attaching to thread %ld (LWP %d)\n",
|
|
||||||
(unsigned long) ti_p->ti_tid, ti_p->ti_lid);
|
(unsigned long) ti_p->ti_tid, ti_p->ti_lid);
|
||||||
err = the_linux_target->attach_lwp (ptid);
|
err = the_linux_target->attach_lwp (ptid);
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
@ -283,9 +281,8 @@ find_new_threads_callback (const td_thrhandle_t *th_p, void *data)
|
|||||||
thread that previously exited and was joined. (glibc marks
|
thread that previously exited and was joined. (glibc marks
|
||||||
terminated and joined threads with kernel thread ID -1. See
|
terminated and joined threads with kernel thread ID -1. See
|
||||||
glibc PR17707. */
|
glibc PR17707. */
|
||||||
if (debug_threads)
|
threads_debug_printf ("thread_db: skipping exited and "
|
||||||
debug_printf ("thread_db: skipping exited and "
|
"joined thread (0x%lx)",
|
||||||
"joined thread (0x%lx)\n",
|
|
||||||
(unsigned long) ti.ti_tid);
|
(unsigned long) ti.ti_tid);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -333,8 +330,7 @@ thread_db_find_new_threads (void)
|
|||||||
TD_THR_ANY_STATE,
|
TD_THR_ANY_STATE,
|
||||||
TD_THR_LOWEST_PRIORITY,
|
TD_THR_LOWEST_PRIORITY,
|
||||||
TD_SIGNO_MASK, TD_THR_ANY_USER_FLAGS);
|
TD_SIGNO_MASK, TD_THR_ANY_USER_FLAGS);
|
||||||
if (debug_threads)
|
threads_debug_printf ("Found %d threads in iteration %d.",
|
||||||
debug_printf ("Found %d threads in iteration %d.\n",
|
|
||||||
new_thread_count, iteration);
|
new_thread_count, iteration);
|
||||||
|
|
||||||
if (new_thread_count != 0)
|
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);
|
err = tdb->td_ta_new_p (&tdb->proc_handle, &tdb->thread_agent);
|
||||||
if (err != TD_OK)
|
if (err != TD_OK)
|
||||||
{
|
{
|
||||||
if (debug_threads)
|
threads_debug_printf ("td_ta_new(): %s", thread_db_err_str (err));
|
||||||
debug_printf ("td_ta_new(): %s\n", thread_db_err_str (err));
|
|
||||||
free (tdb);
|
free (tdb);
|
||||||
proc->priv->thread_db = NULL;
|
proc->priv->thread_db = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
@ -535,8 +530,7 @@ try_thread_db_load_1 (void *handle)
|
|||||||
{ \
|
{ \
|
||||||
if ((a) == NULL) \
|
if ((a) == NULL) \
|
||||||
{ \
|
{ \
|
||||||
if (debug_threads) \
|
threads_debug_printf ("dlsym: %s", dlerror ()); \
|
||||||
debug_printf ("dlsym: %s\n", dlerror ()); \
|
|
||||||
if (required) \
|
if (required) \
|
||||||
{ \
|
{ \
|
||||||
free (tdb); \
|
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);
|
err = tdb->td_ta_new_p (&tdb->proc_handle, &tdb->thread_agent);
|
||||||
if (err != TD_OK)
|
if (err != TD_OK)
|
||||||
{
|
{
|
||||||
if (debug_threads)
|
threads_debug_printf ("td_ta_new(): %s", thread_db_err_str (err));
|
||||||
debug_printf ("td_ta_new(): %s\n", thread_db_err_str (err));
|
|
||||||
free (tdb);
|
free (tdb);
|
||||||
proc->priv->thread_db = NULL;
|
proc->priv->thread_db = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
@ -601,14 +594,12 @@ try_thread_db_load (const char *library)
|
|||||||
{
|
{
|
||||||
void *handle;
|
void *handle;
|
||||||
|
|
||||||
if (debug_threads)
|
threads_debug_printf ("Trying host libthread_db library: %s.",
|
||||||
debug_printf ("Trying host libthread_db library: %s.\n",
|
|
||||||
library);
|
library);
|
||||||
handle = dlopen (library, RTLD_NOW);
|
handle = dlopen (library, RTLD_NOW);
|
||||||
if (handle == NULL)
|
if (handle == NULL)
|
||||||
{
|
{
|
||||||
if (debug_threads)
|
threads_debug_printf ("dlopen failed: %s.", dlerror ());
|
||||||
debug_printf ("dlopen failed: %s.\n", dlerror ());
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -623,7 +614,7 @@ try_thread_db_load (const char *library)
|
|||||||
const char *const libpath = dladdr_to_soname (td_init);
|
const char *const libpath = dladdr_to_soname (td_init);
|
||||||
|
|
||||||
if (libpath != NULL)
|
if (libpath != NULL)
|
||||||
debug_printf ("Host %s resolved to: %s.\n", library, libpath);
|
threads_debug_printf ("Host %s resolved to: %s.", library, libpath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -722,8 +713,7 @@ thread_db_load_search (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug_threads)
|
threads_debug_printf ("thread_db_load_search returning %d", rc);
|
||||||
debug_printf ("thread_db_load_search returning %d\n", rc);
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,11 +87,7 @@ trace_vdebug (const char *fmt, ...)
|
|||||||
|
|
||||||
#define trace_debug(fmt, args...) \
|
#define trace_debug(fmt, args...) \
|
||||||
do { \
|
do { \
|
||||||
if (debug_threads) \
|
threads_debug_printf ((fmt), ##args); \
|
||||||
{ \
|
|
||||||
debug_printf ((fmt), ##args); \
|
|
||||||
debug_printf ("\n"); \
|
|
||||||
} \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -324,8 +320,7 @@ tracepoint_look_up_symbols (void)
|
|||||||
|
|
||||||
if (look_up_one_symbol (symbol_list[i].name, addrp, 1) == 0)
|
if (look_up_one_symbol (symbol_list[i].name, addrp, 1) == 0)
|
||||||
{
|
{
|
||||||
if (debug_threads)
|
threads_debug_printf ("symbol `%s' not found", symbol_list[i].name);
|
||||||
debug_printf ("symbol `%s' not found\n", symbol_list[i].name);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4519,15 +4514,14 @@ handle_tracepoint_bkpts (struct thread_info *tinfo, CORE_ADDR stop_pc)
|
|||||||
ipa_expr_eval_result,
|
ipa_expr_eval_result,
|
||||||
paddress (ipa_error_tracepoint));
|
paddress (ipa_error_tracepoint));
|
||||||
|
|
||||||
if (debug_threads)
|
|
||||||
{
|
|
||||||
if (ipa_trace_buffer_is_full)
|
if (ipa_trace_buffer_is_full)
|
||||||
trace_debug ("lib stopped due to full buffer.");
|
trace_debug ("lib stopped due to full buffer.");
|
||||||
|
|
||||||
if (ipa_stopping_tracepoint)
|
if (ipa_stopping_tracepoint)
|
||||||
trace_debug ("lib stopped due to tpoint");
|
trace_debug ("lib stopped due to tpoint");
|
||||||
|
|
||||||
if (ipa_error_tracepoint)
|
if (ipa_error_tracepoint)
|
||||||
trace_debug ("lib stopped due to error");
|
trace_debug ("lib stopped due to error");
|
||||||
}
|
|
||||||
|
|
||||||
if (ipa_stopping_tracepoint != 0)
|
if (ipa_stopping_tracepoint != 0)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user