* [2/2] RFA: implement 'set print symbol'
@ 2012-04-05 18:03 Tom Tromey
2012-04-05 21:13 ` Eli Zaretskii
2012-04-09 19:14 ` Jan Kratochvil
0 siblings, 2 replies; 20+ messages in thread
From: Tom Tromey @ 2012-04-05 18:03 UTC (permalink / raw)
To: gdb-patches
This needs a doc review.
This fixes PR 13907. The bug is a feature request, asking for a way to
print the symbol corresponding to an address. This already happens for
function pointers, but the PR asks for it to happen for all pointers.
This patch adds a new setting, 'set print symbol', which can be used to
enable the new feature.
Built and regtested on x86-64 Fedora 16.
Ok?
Tom
From e47ed6174be01701f0c13591be70f0ba81518270 Mon Sep 17 00:00:00 2001
From: Tom Tromey <tromey@redhat.com>
Date: Fri, 30 Mar 2012 09:41:18 -0600
Subject: [PATCH 2/2] Fix PR expr/13907
PR exp/13907:
* valprint.h (struct value_print_options) <symbol_print>: New
field.
* valprint.c (user_print_options): Add default for symbol_print.
(show_symbol_print): New function.
(generic_val_print): Respect symbol_print.
(_initialize_valprint): Add "print symbol" setting.
* f-valprint.c (f_val_print): Respect symbol_print.
* c-valprint.c (c_val_print): Respect symbol_print.
* NEWS: Update.
* gdb.base/printcmds.exp (test_print_symbol): New proc.
Call it.
* gdb.texinfo (Print Settings): Document 'set print symbol'.
---
gdb/ChangeLog | 13 +++++++++++++
gdb/NEWS | 5 +++++
gdb/c-valprint.c | 4 +++-
gdb/doc/ChangeLog | 4 ++++
gdb/doc/gdb.texinfo | 18 ++++++++++++++++++
gdb/f-valprint.c | 4 +++-
gdb/testsuite/ChangeLog | 5 +++++
gdb/testsuite/gdb.base/printcmds.exp | 11 +++++++++++
gdb/valprint.c | 25 +++++++++++++++++++++++--
gdb/valprint.h | 4 ++++
10 files changed, 89 insertions(+), 4 deletions(-)
diff --git a/gdb/NEWS b/gdb/NEWS
index 9444f6a..e65d922 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -93,6 +93,11 @@
** "info vtbl" can be used to show the virtual method tables for
C++ and Java objects.
+ ** "set print symbol"
+ "show print symbol"
+ Controls whether GDB attempts to display the symbol, if any,
+ corresponding to addresses it prints.
+
* New targets
Renesas RL78 rl78-*-elf
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 4e32973..3e28879 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -264,7 +264,9 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
return;
}
- if (options->addressprint)
+ if (options->symbol_print)
+ print_address_demangle (options, gdbarch, addr, stream, demangle);
+ else if (options->addressprint)
fputs_filtered (paddress (gdbarch, addr), stream);
/* For a pointer to a textual type, also print the string
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 8002429..4ef8c09 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -8116,6 +8116,24 @@ does not show the symbol name and filename of the referent, even with
the appropriate @code{set print} options turned on.
@end quotation
+You can also enable @samp{/a}-like formatting all the time using
+@samp{set print symbol on}:
+
+@table @code
+@item set print symbol on
+Tell @value{GDBN} to print the symbol corresponding to an address, if
+one exists.
+
+@item set print symbol off
+Tell @value{GDBN} not to print the symbol corresponding to an
+address. In this mode, @value{GDBN} will still print the symbol
+corresponding to pointers to functions. This is the default.
+
+@item show print symbol
+Show whether @value{GDBN} will display the symbol corresponding to an
+address.
+@end table
+
Other settings control how different kinds of objects are printed:
@table @code
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index 3181356..fd60953 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -320,7 +320,9 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
return;
}
- if (options->addressprint && options->format != 's')
+ if (options->symbol_print)
+ print_address_demangle (options, gdbarch, addr, stream, demangle);
+ else if (options->addressprint && options->format != 's')
fputs_filtered (paddress (gdbarch, addr), stream);
/* For a pointer to char or unsigned char, also print the string
diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp
index 08a54b0..36e6194 100644
--- a/gdb/testsuite/gdb.base/printcmds.exp
+++ b/gdb/testsuite/gdb.base/printcmds.exp
@@ -773,6 +773,16 @@ proc test_printf_with_dfp {} {
gdb_test "printf \"%DDf\\n\",1.2E6144dl" "1.200000000000000000000000000000000E\\+6144"
}
+proc test_print_symbol {} {
+ gdb_test_no_output "set print symbol on"
+
+ gdb_test "print &three" " = .* <three>"
+ gdb_test "print parrays" " = .* <arrays>"
+
+ # In case somebody adds tests after this.
+ gdb_test_no_output "set print symbol off"
+}
+
# Escape a left curly brace to prevent it from being interpreted as
# the beginning of a bound
proc gdb_test_escape_braces { args } {
@@ -840,3 +850,4 @@ test_print_array_constants
test_print_enums
test_printf
test_printf_with_dfp
+test_print_symbol
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 08dcbc0..63cc909 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -85,7 +85,8 @@ struct value_print_options user_print_options =
1, /* static_field_print */
1, /* pascal_static_field_print */
0, /* raw */
- 0 /* summary */
+ 0, /* summary */
+ 0 /* symbol_print */
};
/* Initialize *OPTS to be a copy of the user print options. */
@@ -219,6 +220,16 @@ show_addressprint (struct ui_file *file, int from_tty,
{
fprintf_filtered (file, _("Printing of addresses is %s.\n"), value);
}
+
+static void
+show_symbol_print (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
+{
+ fprintf_filtered (file,
+ _("Printing of symbols when printing pointers is %s.\n"),
+ value);
+}
+
\f
/* A helper function for val_print. When printing in "summary" mode,
@@ -396,7 +407,9 @@ generic_val_print (struct type *type, const gdb_byte *valaddr,
return;
}
- if (options->addressprint)
+ if (options->symbol_print)
+ print_address_demangle (options, gdbarch, addr, stream, demangle);
+ else if (options->addressprint)
fputs_filtered (paddress (gdbarch, addr), stream);
}
break;
@@ -2612,6 +2625,14 @@ Show printing of addresses."), NULL,
show_addressprint,
&setprintlist, &showprintlist);
+ add_setshow_boolean_cmd ("symbol", class_support,
+ &user_print_options.symbol_print, _("\
+Set printing of symbol names when printing pointers."), _("\
+Show printing of symbol names when printing pointers."),
+ NULL, NULL,
+ show_symbol_print,
+ &setprintlist, &showprintlist);
+
add_setshow_zuinteger_cmd ("input-radix", class_support, &input_radix_1,
_("\
Set default input radix for entering numbers."), _("\
diff --git a/gdb/valprint.h b/gdb/valprint.h
index 817e5cd..b853b1a 100644
--- a/gdb/valprint.h
+++ b/gdb/valprint.h
@@ -90,6 +90,10 @@ struct value_print_options
/* If nonzero, print the value in "summary" form. */
int summary;
+
+ /* If nonzero, when printing a pointer, print the symbol to which it
+ points, if any. */
+ int symbol_print;
};
/* The global print options set by the user. In general this should
--
1.7.7.6
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [2/2] RFA: implement 'set print symbol'
2012-04-05 18:03 [2/2] RFA: implement 'set print symbol' Tom Tromey
@ 2012-04-05 21:13 ` Eli Zaretskii
2012-04-09 14:32 ` Tom Tromey
2012-04-09 19:14 ` Jan Kratochvil
1 sibling, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2012-04-05 21:13 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
> From: Tom Tromey <tromey@redhat.com>
> Date: Thu, 05 Apr 2012 12:03:32 -0600
>
> Ok?
OK for the documentation part. Although personally, I'm not happy
that from now on "set print sym TAB" will not auto-complete to a full
command, like it did before. But that's me.
Thanks.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [2/2] RFA: implement 'set print symbol'
2012-04-05 21:13 ` Eli Zaretskii
@ 2012-04-09 14:32 ` Tom Tromey
2012-04-09 16:31 ` Eli Zaretskii
0 siblings, 1 reply; 20+ messages in thread
From: Tom Tromey @ 2012-04-09 14:32 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
Eli> OK for the documentation part. Although personally, I'm not happy
Eli> that from now on "set print sym TAB" will not auto-complete to a full
Eli> command, like it did before. But that's me.
If you pick a better name, I will change the patch.
Tom
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [2/2] RFA: implement 'set print symbol'
2012-04-09 14:32 ` Tom Tromey
@ 2012-04-09 16:31 ` Eli Zaretskii
2012-04-09 17:44 ` Tom Tromey
0 siblings, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2012-04-09 16:31 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
> From: Tom Tromey <tromey@redhat.com>
> Cc: gdb-patches@sourceware.org
> Date: Mon, 09 Apr 2012 08:32:38 -0600
>
> >>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
>
> Eli> OK for the documentation part. Although personally, I'm not happy
> Eli> that from now on "set print sym TAB" will not auto-complete to a full
> Eli> command, like it did before. But that's me.
>
> If you pick a better name, I will change the patch.
How about "set print auto-symbol-filename"?
Or maybe make "set print symbol-filename" a tristate setting, with an
additional state "always"?
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [2/2] RFA: implement 'set print symbol'
2012-04-09 16:31 ` Eli Zaretskii
@ 2012-04-09 17:44 ` Tom Tromey
2012-04-09 17:55 ` Eli Zaretskii
0 siblings, 1 reply; 20+ messages in thread
From: Tom Tromey @ 2012-04-09 17:44 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
Tom> If you pick a better name, I will change the patch.
Eli> How about "set print auto-symbol-filename"?
Eli> Or maybe make "set print symbol-filename" a tristate setting, with an
Eli> additional state "always"?
It isn't directly related to whether or not the file name is printed.
It has to do with whether the symbol name itself is printed.
So I don't think either of these really fits.
Tom
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [2/2] RFA: implement 'set print symbol'
2012-04-09 17:44 ` Tom Tromey
@ 2012-04-09 17:55 ` Eli Zaretskii
2012-04-09 18:00 ` Tom Tromey
0 siblings, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2012-04-09 17:55 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
> From: Tom Tromey <tromey@redhat.com>
> Cc: gdb-patches@sourceware.org
> Date: Mon, 09 Apr 2012 11:44:23 -0600
>
> >>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
>
> Tom> If you pick a better name, I will change the patch.
>
> Eli> How about "set print auto-symbol-filename"?
>
> Eli> Or maybe make "set print symbol-filename" a tristate setting, with an
> Eli> additional state "always"?
>
> It isn't directly related to whether or not the file name is printed.
> It has to do with whether the symbol name itself is printed.
> So I don't think either of these really fits.
Maybe I misunderstand what "set print symbol-filename" does, but at
least the manual seems to imply that it affects "print /a":
If you have a pointer and you are not sure where it points, try
@samp{set print symbol-filename on}. Then you can determine the name
and source file location of the variable where it points, using
@samp{p/a @var{pointer}}. This interprets the address in symbolic
form.
And your change makes it so the symbol is printed even without the /a
part, AFAIU. So what am I missing?
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [2/2] RFA: implement 'set print symbol'
2012-04-09 17:55 ` Eli Zaretskii
@ 2012-04-09 18:00 ` Tom Tromey
0 siblings, 0 replies; 20+ messages in thread
From: Tom Tromey @ 2012-04-09 18:00 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
Eli> Maybe I misunderstand what "set print symbol-filename" does, but at
Eli> least the manual seems to imply that it affects "print /a":
Eli> If you have a pointer and you are not sure where it points, try
Eli> @samp{set print symbol-filename on}. Then you can determine the name
Eli> and source file location of the variable where it points, using
Eli> @samp{p/a @var{pointer}}. This interprets the address in symbolic
Eli> form.
Eli> And your change makes it so the symbol is printed even without the /a
Eli> part, AFAIU. So what am I missing?
Suppose you have:
char x;
By default if you print it you get:
(gdb) print &x
$1 = 0xaaaaaa
With /a:
(gdb) p/a &x
$2 = 0xaaaaaa <x>
My patch makes the output look like this all the time.
'set print symbol-filename on' only works for function symbols:
(gdb) p /a &x
$3 = 0xaaaaaa <x>
(gdb) p &main
$4 = (int (*)()) 0x400474 <main at q.c:4>
It just adds the "at q.c:4" bit.
Tom
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [2/2] RFA: implement 'set print symbol'
2012-04-05 18:03 [2/2] RFA: implement 'set print symbol' Tom Tromey
2012-04-05 21:13 ` Eli Zaretskii
@ 2012-04-09 19:14 ` Jan Kratochvil
2012-04-09 19:21 ` Tom Tromey
1 sibling, 1 reply; 20+ messages in thread
From: Jan Kratochvil @ 2012-04-09 19:14 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
On Thu, 05 Apr 2012 20:03:32 +0200, Tom Tromey wrote:
> + 0 /* symbol_print */
I see now the reason why I have to use `info symbol' by hand for addresses
I see.
Why not to make it default? People will never find such an option.
Thanks,
Jan
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [2/2] RFA: implement 'set print symbol'
2012-04-09 19:14 ` Jan Kratochvil
@ 2012-04-09 19:21 ` Tom Tromey
2012-04-09 19:36 ` Jan Kratochvil
2012-04-09 20:45 ` Eli Zaretskii
0 siblings, 2 replies; 20+ messages in thread
From: Tom Tromey @ 2012-04-09 19:21 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches
>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
Jan> Why not to make it default? People will never find such an option.
It would be fine by me.
I can just zap the option entirely if you think that is ok.
Tom
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [2/2] RFA: implement 'set print symbol'
2012-04-09 19:21 ` Tom Tromey
@ 2012-04-09 19:36 ` Jan Kratochvil
2012-04-09 20:45 ` Eli Zaretskii
1 sibling, 0 replies; 20+ messages in thread
From: Jan Kratochvil @ 2012-04-09 19:36 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
On Mon, 09 Apr 2012 21:21:12 +0200, Tom Tromey wrote:
> >>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
>
> Jan> Why not to make it default? People will never find such an option.
>
> It would be fine by me.
> I can just zap the option entirely if you think that is ok.
I would find the option even useful if you describe it in NEWS as how to
retain the backward compatibility.
Thanks,
Jan
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [2/2] RFA: implement 'set print symbol'
2012-04-09 19:21 ` Tom Tromey
2012-04-09 19:36 ` Jan Kratochvil
@ 2012-04-09 20:45 ` Eli Zaretskii
2012-04-09 21:04 ` Tom Tromey
1 sibling, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2012-04-09 20:45 UTC (permalink / raw)
To: Tom Tromey; +Cc: jan.kratochvil, gdb-patches
> From: Tom Tromey <tromey@redhat.com>
> Cc: gdb-patches@sourceware.org
> Date: Mon, 09 Apr 2012 13:21:12 -0600
>
> >>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
>
> Jan> Why not to make it default? People will never find such an option.
>
> It would be fine by me.
> I can just zap the option entirely if you think that is ok.
Making that the default sounds like TRT to me, and it solves the name
conundrum.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [2/2] RFA: implement 'set print symbol'
2012-04-09 20:45 ` Eli Zaretskii
@ 2012-04-09 21:04 ` Tom Tromey
2012-04-10 6:17 ` Eli Zaretskii
0 siblings, 1 reply; 20+ messages in thread
From: Tom Tromey @ 2012-04-09 21:04 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: jan.kratochvil, gdb-patches
>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
Eli> Making that the default sounds like TRT to me, and it solves the name
Eli> conundrum.
Following Jan's follow-up, I plan to leave the option.
So the naming issue remains.
Tom
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [2/2] RFA: implement 'set print symbol'
2012-04-09 21:04 ` Tom Tromey
@ 2012-04-10 6:17 ` Eli Zaretskii
2012-04-10 6:56 ` Jan Kratochvil
0 siblings, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2012-04-10 6:17 UTC (permalink / raw)
To: Tom Tromey; +Cc: jan.kratochvil, gdb-patches
> From: Tom Tromey <tromey@redhat.com>
> Cc: jan.kratochvil@redhat.com, gdb-patches@sourceware.org
> Date: Mon, 09 Apr 2012 15:04:13 -0600
>
> >>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
>
> Eli> Making that the default sounds like TRT to me, and it solves the name
> Eli> conundrum.
>
> Following Jan's follow-up, I plan to leave the option.
> So the naming issue remains.
I'm confused. What is the plan now?
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [2/2] RFA: implement 'set print symbol'
2012-04-10 6:17 ` Eli Zaretskii
@ 2012-04-10 6:56 ` Jan Kratochvil
2012-04-10 7:50 ` Eli Zaretskii
0 siblings, 1 reply; 20+ messages in thread
From: Jan Kratochvil @ 2012-04-10 6:56 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Tom Tromey, gdb-patches
On Tue, 10 Apr 2012 08:15:20 +0200, Eli Zaretskii wrote:
> I'm confused. What is the plan now?
Everything the same, just by default it will be now "set print symbol on".
But one can manually "set print symbol off" to retain the GDB-7.4 behavior.
Regards,
Jan
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [2/2] RFA: implement 'set print symbol'
2012-04-10 6:56 ` Jan Kratochvil
@ 2012-04-10 7:50 ` Eli Zaretskii
2012-04-10 8:19 ` Jan Kratochvil
2012-04-17 0:54 ` Doug Evans
0 siblings, 2 replies; 20+ messages in thread
From: Eli Zaretskii @ 2012-04-10 7:50 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: tromey, gdb-patches
> Date: Tue, 10 Apr 2012 08:52:26 +0200
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
> Cc: Tom Tromey <tromey@redhat.com>, gdb-patches@sourceware.org
>
> On Tue, 10 Apr 2012 08:15:20 +0200, Eli Zaretskii wrote:
> > I'm confused. What is the plan now?
>
> Everything the same, just by default it will be now "set print symbol on".
> But one can manually "set print symbol off" to retain the GDB-7.4 behavior.
Why do we need to retain the old behavior? You yourself said that no
one will find this option to use it. My vote is to have the new
behavior as the only one. The mess with "set print" and p/a is
already too much, even without an additional knob.
But if we must have it, I would suggest to call it "set print
no-symbol", and have it off by default. (Yes, I know: double negation
is not an ideal situation, but it is IMO better than the aggravation
from the need to type more to disambiguate the command for
completion.)
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [2/2] RFA: implement 'set print symbol'
2012-04-10 7:50 ` Eli Zaretskii
@ 2012-04-10 8:19 ` Jan Kratochvil
2012-04-16 21:14 ` Tom Tromey
2012-05-14 19:39 ` Tom Tromey
2012-04-17 0:54 ` Doug Evans
1 sibling, 2 replies; 20+ messages in thread
From: Jan Kratochvil @ 2012-04-10 8:19 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches, Eli Zaretskii
On Tue, 10 Apr 2012 09:48:21 +0200, Eli Zaretskii wrote:
> Why do we need to retain the old behavior? You yourself said that no
> one will find this option to use it.
I have checked some (the first) FAIL cases of the testsuite and it does not
seem to be acceptable to be printed by default in its current form:
Breakpoint 7, marker3 (a=0x400918 <__dso_handle+48> "stack", b=0x400912 <__dso_handle+42> "trace") at ./gdb.base/break1.c:48^M
Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al
[15] .rodata PROGBITS 00000000004008e0 0008e0 00003e 00 A 0 0 8
[16] .eh_frame_hdr PROGBITS 0000000000400920 000920 00006c 00 A 0 0 4
Symbol table '.symtab' contains 84 entries:
Value Size Type Bind Vis Ndx Name
00000000004008e8 0 OBJECT GLOBAL HIDDEN 15 __dso_handle
0000000000400920 0 SECTION LOCAL DEFAULT 16
__dso_handle is a false resolution.
So if it should be default there should be at least restriction to ignore
size-less objects.
The question is whether there should be also a possibility to resolve the
address even to size-less objects, something like (hypothetical):
set print symbol no
set print symbol sizeful-only (default)
set print symbol always
but I think "set print symbol always" does not have to exist - there is always
the explicit "info symbol" command for special cases and the RFE PR/13907
should work fine with "set print symbol sizeful-only".
But even with size-ful objects the default on is not great:
(gdb) p t_structs_a(struct_val1)
$92 = <buf.2559>"foo"
Symbol table '.symtab' contains 177 entries:
Num: Value Size Type Bind Vis Ndx Name
43: 0000000000603a90 8 OBJECT LOCAL DEFAULT 25 buf.2559
Such local symbols just make no sense to display IMO. Maybe there could be GDB
hack to suppress the \.\d+$ symbols from GCC? Or even GCC suppressing them?
Too much information I thought may be the reason why some old-school hackers
may prefer the original behavior (I sure prefer the new behavior). But I do
not mind if the option exists / does not exist there either way, it is up to
Tom.
There is still an open issue of updating the whole testsuite if the default is
changed.
Thanks,
Jan
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [2/2] RFA: implement 'set print symbol'
2012-04-10 8:19 ` Jan Kratochvil
@ 2012-04-16 21:14 ` Tom Tromey
2012-05-14 19:39 ` Tom Tromey
1 sibling, 0 replies; 20+ messages in thread
From: Tom Tromey @ 2012-04-16 21:14 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches, Eli Zaretskii
>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
Jan> So if it should be default there should be at least restriction to ignore
Jan> size-less objects.
I'll do that.
Jan> Such local symbols just make no sense to display IMO. Maybe there
Jan> could be GDB hack to suppress the \.\d+$ symbols from GCC? Or even
Jan> GCC suppressing them?
No promises here.
Jan> There is still an open issue of updating the whole testsuite if the
Jan> default is changed.
Yes, I'm going to do that, but I got pulled away a bit, and updating the
test suite is annoying, so it is going to wait.
Tom
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [2/2] RFA: implement 'set print symbol'
2012-04-10 8:19 ` Jan Kratochvil
2012-04-16 21:14 ` Tom Tromey
@ 2012-05-14 19:39 ` Tom Tromey
1 sibling, 0 replies; 20+ messages in thread
From: Tom Tromey @ 2012-05-14 19:39 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches, Eli Zaretskii
>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
Jan> I have checked some (the first) FAIL cases of the testsuite and it does not
Jan> seem to be acceptable to be printed by default in its current form:
Jan> Breakpoint 7, marker3 (a=0x400918 <__dso_handle+48> "stack", b=0x400912 <__dso_handle+42> "trace") at ./gdb.base/break1.c:48^M
Jan> __dso_handle is a false resolution.
Jan> So if it should be default there should be at least restriction to ignore
Jan> size-less objects.
I made it ignore size-less data symbols.
It turns out that we can't ignore size-less text symbols --
asm-source.exp checks this case.
Jan> But even with size-ful objects the default on is not great:
Jan> (gdb) p t_structs_a(struct_val1)
Jan> $92 = <buf.2559>"foo"
In the new series (to be posted shortly) I fixed the obvious formatting
bug here.
Jan> Such local symbols just make no sense to display IMO. Maybe there
Jan> could be GDB hack to suppress the \.\d+$ symbols from GCC? Or even
Jan> GCC suppressing them?
I left it as-is.
I did notice that we have no way to look up a generic symbol by address.
In gdb currently, you can look up any minimal symbol by address, but
for full symbols you can only look up functions.
Jan> There is still an open issue of updating the whole testsuite if the
Jan> default is changed.
I did this. It revealed some other oddities.
Tom
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [2/2] RFA: implement 'set print symbol'
2012-04-10 7:50 ` Eli Zaretskii
2012-04-10 8:19 ` Jan Kratochvil
@ 2012-04-17 0:54 ` Doug Evans
2012-04-17 11:43 ` Tom Tromey
1 sibling, 1 reply; 20+ messages in thread
From: Doug Evans @ 2012-04-17 0:54 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Jan Kratochvil, tromey, gdb-patches
On Tue, Apr 10, 2012 at 12:48 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Tue, 10 Apr 2012 08:52:26 +0200
>> From: Jan Kratochvil <jan.kratochvil@redhat.com>
>> Cc: Tom Tromey <tromey@redhat.com>, gdb-patches@sourceware.org
>>
>> On Tue, 10 Apr 2012 08:15:20 +0200, Eli Zaretskii wrote:
>> > I'm confused. What is the plan now?
>>
>> Everything the same, just by default it will be now "set print symbol on".
>> But one can manually "set print symbol off" to retain the GDB-7.4 behavior.
>
> Why do we need to retain the old behavior? You yourself said that no
> one will find this option to use it. My vote is to have the new
> behavior as the only one. The mess with "set print" and p/a is
> already too much, even without an additional knob.
>
> But if we must have it, I would suggest to call it "set print
> no-symbol", and have it off by default. (Yes, I know: double negation
> is not an ideal situation, but it is IMO better than the aggravation
> from the need to type more to disambiguate the command for
> completion.)
Hi.
Yeah, double-negation is, umm, nasty.
Let's pick something non-double-negative. It can't be that hard.
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2012-05-14 19:39 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-05 18:03 [2/2] RFA: implement 'set print symbol' Tom Tromey
2012-04-05 21:13 ` Eli Zaretskii
2012-04-09 14:32 ` Tom Tromey
2012-04-09 16:31 ` Eli Zaretskii
2012-04-09 17:44 ` Tom Tromey
2012-04-09 17:55 ` Eli Zaretskii
2012-04-09 18:00 ` Tom Tromey
2012-04-09 19:14 ` Jan Kratochvil
2012-04-09 19:21 ` Tom Tromey
2012-04-09 19:36 ` Jan Kratochvil
2012-04-09 20:45 ` Eli Zaretskii
2012-04-09 21:04 ` Tom Tromey
2012-04-10 6:17 ` Eli Zaretskii
2012-04-10 6:56 ` Jan Kratochvil
2012-04-10 7:50 ` Eli Zaretskii
2012-04-10 8:19 ` Jan Kratochvil
2012-04-16 21:14 ` Tom Tromey
2012-05-14 19:39 ` Tom Tromey
2012-04-17 0:54 ` Doug Evans
2012-04-17 11:43 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox