diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-10-25 14:33:55 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-10-25 14:33:55 -0400 |
commit | 61d7f128e6ea37af805be4e365f5879b0d42bb93 (patch) | |
tree | c581803312ce6dcb9b37ef348c37367090ea293e /gdbserver/tracepoint.cc | |
parent | b3a9fe6f51fd3922ce7978b6ba5ce0cbdf33885e (diff) | |
download | fsf-binutils-gdb-61d7f128e6ea37af805be4e365f5879b0d42bb93.zip fsf-binutils-gdb-61d7f128e6ea37af805be4e365f5879b0d42bb93.tar.gz fsf-binutils-gdb-61d7f128e6ea37af805be4e365f5879b0d42bb93.tar.bz2 |
gdbserver: make target_pid_to_str return std::string
I wanted to write a warning that included two target_pid_to_str calls,
like this:
warning (_("Blabla %s, blabla %s"),
target_pid_to_str (ptid1),
target_pid_to_str (ptid2));
This doesn't work, because target_pid_to_str stores its result in a
static buffer, so my message would show twice the same ptid. Change
target_pid_to_str to return an std::string to avoid this. I don't think
we save much by using a static buffer, but it is more error-prone.
Change-Id: Ie3f649627686b84930529cc5c7c691ccf5d36dc2
Diffstat (limited to 'gdbserver/tracepoint.cc')
-rw-r--r-- | gdbserver/tracepoint.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gdbserver/tracepoint.cc b/gdbserver/tracepoint.cc index bc8fb26..c01973b 100644 --- a/gdbserver/tracepoint.cc +++ b/gdbserver/tracepoint.cc @@ -4408,7 +4408,7 @@ tracepoint_finished_step (struct thread_info *tinfo, CORE_ADDR stop_pc) wstep_link = &tinfo->while_stepping; trace_debug ("Thread %s finished a single-step for tracepoint %d at 0x%s", - target_pid_to_str (tinfo->id), + target_pid_to_str (tinfo->id).c_str (), wstep->tp_number, paddress (wstep->tp_address)); ctx.base.type = trap_tracepoint; @@ -4421,7 +4421,7 @@ tracepoint_finished_step (struct thread_info *tinfo, CORE_ADDR stop_pc) { trace_debug ("NO TRACEPOINT %d at 0x%s FOR THREAD %s!", wstep->tp_number, paddress (wstep->tp_address), - target_pid_to_str (tinfo->id)); + target_pid_to_str (tinfo->id).c_str ()); /* Unlink. */ *wstep_link = wstep->next; @@ -4441,7 +4441,7 @@ tracepoint_finished_step (struct thread_info *tinfo, CORE_ADDR stop_pc) { /* The requested numbers of steps have occurred. */ trace_debug ("Thread %s done stepping for tracepoint %d at 0x%s", - target_pid_to_str (tinfo->id), + target_pid_to_str (tinfo->id).c_str (), wstep->tp_number, paddress (wstep->tp_address)); /* Unlink the wstep. */ @@ -4588,7 +4588,7 @@ tracepoint_was_hit (struct thread_info *tinfo, CORE_ADDR stop_pc) && tpoint->type != static_tracepoint) { trace_debug ("Thread %s at address of tracepoint %d at 0x%s", - target_pid_to_str (tinfo->id), + target_pid_to_str (tinfo->id).c_str (), tpoint->number, paddress (tpoint->address)); /* Test the condition if present, and collect if true. */ |