Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH 2/6] gdbserver: remove function abbrevs from debugging text
@ 2013-12-17 21:43 Doug Evans
  2013-12-18  0:42 ` Yao Qi
  0 siblings, 1 reply; 6+ messages in thread
From: Doug Evans @ 2013-12-17 21:43 UTC (permalink / raw)
  To: gdb-patches

Hi.

This patch removes the function abbreviations from the debugging output.
In one example it's wrong (GPS vs get_detach_signal), and I rarely
keep in cache the translation to function name.

2013-12-17  Doug Evans  <dje@google.com>

	* linux-low.c (linux_kill_one_lwp): Replace LKL with linux_kill_one_lwp
	in debugging printf.
	(get_detach_signal): Replace GPS with get_detach_signal in debugging
	printf.  Remove extraneous "lwp" in output.
	(cancel_breakpoint): Replace CB with get_detach_signal in debugging
	printf.
	(select_event_lwp): Replace SEL with select_event_lwp in debugging
	printf.

---
 gdb/gdbserver/linux-low.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 770ee16..464aaf0 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -899,7 +899,7 @@ linux_kill_one_lwp (struct lwp_info *lwp)
   kill (pid, SIGKILL);
   if (debug_threads)
     fprintf (stderr,
-	     "LKL:  kill (SIGKILL) %s, 0, 0 (%s)\n",
+	     "linux_kill_one_lwp: kill (SIGKILL) %s, 0, 0 (%s)\n",
 	     target_pid_to_str (ptid_of (lwp)),
 	     errno ? strerror (errno) : "OK");
 
@@ -907,7 +907,7 @@ linux_kill_one_lwp (struct lwp_info *lwp)
   ptrace (PTRACE_KILL, pid, (PTRACE_TYPE_ARG3) 0, (PTRACE_TYPE_ARG4) 0);
   if (debug_threads)
     fprintf (stderr,
-	     "LKL:  PTRACE_KILL %s, 0, 0 (%s)\n",
+	     "linux_kill_one_lwp: PTRACE_KILL %s, 0, 0 (%s)\n",
 	     target_pid_to_str (ptid_of (lwp)),
 	     errno ? strerror (errno) : "OK");
 }
@@ -1032,7 +1032,8 @@ get_detach_signal (struct thread_info *thread)
     {
       if (debug_threads)
 	fprintf (stderr,
-		 "GPS: lwp %s hasn't stopped: no pending signal\n",
+		 "get_detach_signal: %s hasn't stopped: "
+		 "no pending signal\n",
 		 target_pid_to_str (ptid_of (lp)));
       return 0;
     }
@@ -1042,7 +1043,7 @@ get_detach_signal (struct thread_info *thread)
     {
       if (debug_threads)
 	fprintf (stderr,
-		 "GPS: lwp %s had stopped with extended "
+		 "get_detach_signal: %s had stopped with extended "
 		 "status: no pending signal\n",
 		 target_pid_to_str (ptid_of (lp)));
       return 0;
@@ -1054,7 +1055,8 @@ get_detach_signal (struct thread_info *thread)
     {
       if (debug_threads)
 	fprintf (stderr,
-		 "GPS: lwp %s had signal %s, but it is in nopass state\n",
+		 "get_detach_signal: %s had signal %s, but it is "
+		 "in nopass state\n",
 		 target_pid_to_str (ptid_of (lp)),
 		 gdb_signal_to_string (signo));
       return 0;
@@ -1067,7 +1069,7 @@ get_detach_signal (struct thread_info *thread)
     {
       if (debug_threads)
 	fprintf (stderr,
-		 "GPS: lwp %s had signal %s, "
+		 "get_detach_signal: %s had signal %s, "
 		 "but we don't know if we should pass it.  Default to not.\n",
 		 target_pid_to_str (ptid_of (lp)),
 		 gdb_signal_to_string (signo));
@@ -1077,7 +1079,8 @@ get_detach_signal (struct thread_info *thread)
     {
       if (debug_threads)
 	fprintf (stderr,
-		 "GPS: lwp %s has pending signal %s: delivering it.\n",
+		 "get_detach_signal: %s has pending signal %s: "
+		 "delivering it.\n",
 		 target_pid_to_str (ptid_of (lp)),
 		 gdb_signal_to_string (signo));
 
@@ -1735,7 +1738,7 @@ cancel_breakpoint (struct lwp_info *lwp)
     {
       if (debug_threads)
 	fprintf (stderr,
-		 "CB: Push back breakpoint for %s\n",
+		 "cancel_breakpoint: Push back breakpoint for %s\n",
 		 target_pid_to_str (ptid_of (lwp)));
 
       /* Back up the PC if necessary.  */
@@ -1753,7 +1756,7 @@ cancel_breakpoint (struct lwp_info *lwp)
     {
       if (debug_threads)
 	fprintf (stderr,
-		 "CB: No breakpoint found at %s for [%s]\n",
+		 "cancel_breakpoint: No breakpoint found at %s for [%s]\n",
 		 paddress (lwp->stop_pc),
 		 target_pid_to_str (ptid_of (lwp)));
     }
@@ -2083,7 +2086,7 @@ select_event_lwp (struct lwp_info **orig_lp)
     {
       if (debug_threads)
 	fprintf (stderr,
-		 "SEL: Select single-step %s\n",
+		 "select_event_lwp: Select single-step %s\n",
 		 target_pid_to_str (ptid_of (event_lp)));
     }
   else
@@ -2100,7 +2103,7 @@ select_event_lwp (struct lwp_info **orig_lp)
 
       if (debug_threads && num_events > 1)
 	fprintf (stderr,
-		 "SEL: Found %d SIGTRAP events, selecting #%d\n",
+		 "select_event_lwp: Found %d SIGTRAP events, selecting #%d\n",
 		 num_events, random_selector);
 
       event_lp = (struct lwp_info *) find_inferior (&all_lwps,
-- 
1.8.5.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/6] gdbserver: remove function abbrevs from debugging text
  2013-12-17 21:43 [PATCH 2/6] gdbserver: remove function abbrevs from debugging text Doug Evans
@ 2013-12-18  0:42 ` Yao Qi
  2013-12-18  1:20   ` Doug Evans
  2013-12-18 15:13   ` Tom Tromey
  0 siblings, 2 replies; 6+ messages in thread
From: Yao Qi @ 2013-12-18  0:42 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches

On 12/18/2013 05:43 AM, Doug Evans wrote:
> This patch removes the function abbreviations from the debugging output.

Function abbreviations are also mentioned in linux-nat debugging output.
IWBN to keep them consistent.

> In one example it's wrong (GPS vs get_detach_signal), and I rarely
> keep in cache the translation to function name.

The function names in debugging output will be out of sync as function
names are changed, unless macro __func__ is used.  However, __func__
is defined in C99 and we are using C90 (?) in GDB.

-- 
Yao (齐尧)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/6] gdbserver: remove function abbrevs from debugging text
  2013-12-18  0:42 ` Yao Qi
@ 2013-12-18  1:20   ` Doug Evans
  2013-12-18  1:57     ` Yao Qi
  2013-12-18 11:16     ` Pedro Alves
  2013-12-18 15:13   ` Tom Tromey
  1 sibling, 2 replies; 6+ messages in thread
From: Doug Evans @ 2013-12-18  1:20 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

On Tue, Dec 17, 2013 at 4:41 PM, Yao Qi <yao@codesourcery.com> wrote:
> On 12/18/2013 05:43 AM, Doug Evans wrote:
>> This patch removes the function abbreviations from the debugging output.
>
> Function abbreviations are also mentioned in linux-nat debugging output.
> IWBN to keep them consistent.

Sure.  I'll submit a separate patch for that.

>> In one example it's wrong (GPS vs get_detach_signal), and I rarely
>> keep in cache the translation to function name.
>
> The function names in debugging output will be out of sync as function
> names are changed, unless macro __func__ is used.  However, __func__
> is defined in C99 and we are using C90 (?) in GDB.

I think it's reasonable to do what we do for gdb_assert, namely just
punt on printing the name if the feature isn't present.

I see I missed at least one function with an abbreviated function name anyway.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/6] gdbserver: remove function abbrevs from debugging text
  2013-12-18  1:20   ` Doug Evans
@ 2013-12-18  1:57     ` Yao Qi
  2013-12-18 11:16     ` Pedro Alves
  1 sibling, 0 replies; 6+ messages in thread
From: Yao Qi @ 2013-12-18  1:57 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches

On 12/18/2013 09:20 AM, Doug Evans wrote:
> I think it's reasonable to do what we do for gdb_assert, namely just
> punt on printing the name if the feature isn't present.

Agreed.

b.t.w, I didn't know gdb_assert uses __func__ before.

-- 
Yao (齐尧)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/6] gdbserver: remove function abbrevs from debugging text
  2013-12-18  1:20   ` Doug Evans
  2013-12-18  1:57     ` Yao Qi
@ 2013-12-18 11:16     ` Pedro Alves
  1 sibling, 0 replies; 6+ messages in thread
From: Pedro Alves @ 2013-12-18 11:16 UTC (permalink / raw)
  To: Doug Evans; +Cc: Yao Qi, gdb-patches

On 12/18/2013 01:20 AM, Doug Evans wrote:
> On Tue, Dec 17, 2013 at 4:41 PM, Yao Qi <yao@codesourcery.com> wrote:
>> On 12/18/2013 05:43 AM, Doug Evans wrote:
>>> This patch removes the function abbreviations from the debugging output.
>>
>> Function abbreviations are also mentioned in linux-nat debugging output.
>> IWBN to keep them consistent.
> 
> Sure.  I'll submit a separate patch for that.
> 
>>> In one example it's wrong (GPS vs get_detach_signal), and I rarely
>>> keep in cache the translation to function name.
>>
>> The function names in debugging output will be out of sync as function
>> names are changed, unless macro __func__ is used.  However, __func__
>> is defined in C99 and we are using C90 (?) in GDB.
> 
> I think it's reasonable to do what we do for gdb_assert, namely just
> punt on printing the name if the feature isn't present.

Yeah.  FAOD, I think using __PRETTY_FUNCTION__/__func__
would be great.

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/6] gdbserver: remove function abbrevs from debugging text
  2013-12-18  0:42 ` Yao Qi
  2013-12-18  1:20   ` Doug Evans
@ 2013-12-18 15:13   ` Tom Tromey
  1 sibling, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2013-12-18 15:13 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:

Yao> The function names in debugging output will be out of sync as function
Yao> names are changed, unless macro __func__ is used.  However, __func__
Yao> is defined in C99 and we are using C90 (?) in GDB.

FWIW we found out a while back that gdbserver actually relies on GNU C
-- see the ax_debug and ax_debug_1 defines in ax.c.  And, BFD
unconditionally uses "long long" in spots.  So while the rule is
officially that gdb is C89, in practice that isn't actually true.

Tom


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-12-18 15:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-17 21:43 [PATCH 2/6] gdbserver: remove function abbrevs from debugging text Doug Evans
2013-12-18  0:42 ` Yao Qi
2013-12-18  1:20   ` Doug Evans
2013-12-18  1:57     ` Yao Qi
2013-12-18 11:16     ` Pedro Alves
2013-12-18 15:13   ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox