public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [gdb] Fix maint print symbols/psymbols help text
@ 2023-08-14  8:53 Tom de Vries
  2023-08-14 12:14 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Tom de Vries @ 2023-08-14  8:53 UTC (permalink / raw)
  To: gdb-patches

Consider the help text of "maint print symbols":
...
(gdb) help maint print symbols
Print dump of current symbol definitions.
Usage: mt print symbols [-pc ADDRESS] [--] [OUTFILE]
       mt print symbols [-objfile OBJFILE] [-source SOURCE] [--] [OUTFILE]
Entries in the full symbol table are dumped to file OUTFILE,
or the terminal if OUTFILE is unspecified.
If ADDRESS is provided, dump only the file for that address.
If SOURCE is provided, dump only that file's symbols.
If OBJFILE is provided, dump only that file's minimal symbols.
...
and "maint print psymbols":
...
(gdb) help maint print psymbols
Print dump of current partial symbol definitions.
Usage: mt print psymbols [-objfile OBJFILE] [-pc ADDRESS] [--] [OUTFILE]
       mt print psymbols [-objfile OBJFILE] [-source SOURCE] [--] [OUTFILE]
Entries in the partial symbol table are dumped to file OUTFILE,
or the terminal if OUTFILE is unspecified.
If ADDRESS is provided, dump only the file for that address.
If SOURCE is provided, dump only that file's symbols.
If OBJFILE is provided, dump only that file's minimal symbols.
...

The OBJFILE lines mistakingly mention minimal symbols.

Fix this by reformulating as "dump only that object file's symbols".

Tested on x86_64-linux.
---
 gdb/psymtab.c | 2 +-
 gdb/symmisc.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 64b67078641..bdae9db9676 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1687,7 +1687,7 @@ Entries in the partial symbol table are dumped to file OUTFILE,\n\
 or the terminal if OUTFILE is unspecified.\n\
 If ADDRESS is provided, dump only the file for that address.\n\
 If SOURCE is provided, dump only that file's symbols.\n\
-If OBJFILE is provided, dump only that file's minimal symbols."),
+If OBJFILE is provided, dump only that object file's symbols."),
 	   &maintenanceprintlist);
 
   add_cmd ("psymtabs", class_maintenance, maintenance_info_psymtabs, _("\
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index a65552aa2d2..5b8a82e5137 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -1052,7 +1052,7 @@ Entries in the full symbol table are dumped to file OUTFILE,\n\
 or the terminal if OUTFILE is unspecified.\n\
 If ADDRESS is provided, dump only the file for that address.\n\
 If SOURCE is provided, dump only that file's symbols.\n\
-If OBJFILE is provided, dump only that file's minimal symbols."),
+If OBJFILE is provided, dump only that object file's symbols."),
 	   &maintenanceprintlist);
 
   add_cmd ("msymbols", class_maintenance, maintenance_print_msymbols, _("\

base-commit: 3b23a5ea693deee60648c9a9e9d666d83549298e
-- 
2.35.3


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

* Re: [PATCH] [gdb] Fix maint print symbols/psymbols help text
  2023-08-14  8:53 [PATCH] [gdb] Fix maint print symbols/psymbols help text Tom de Vries
@ 2023-08-14 12:14 ` Eli Zaretskii
  2023-08-14 12:48   ` Tom de Vries
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2023-08-14 12:14 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gdb-patches

> Date: Mon, 14 Aug 2023 10:53:40 +0200
> From: Tom de Vries via Gdb-patches <gdb-patches@sourceware.org>
> 
> diff --git a/gdb/psymtab.c b/gdb/psymtab.c
> index 64b67078641..bdae9db9676 100644
> --- a/gdb/psymtab.c
> +++ b/gdb/psymtab.c
> @@ -1687,7 +1687,7 @@ Entries in the partial symbol table are dumped to file OUTFILE,\n\
>  or the terminal if OUTFILE is unspecified.\n\
>  If ADDRESS is provided, dump only the file for that address.\n\
>  If SOURCE is provided, dump only that file's symbols.\n\
> -If OBJFILE is provided, dump only that file's minimal symbols."),
> +If OBJFILE is provided, dump only that object file's symbols."),
>  	   &maintenanceprintlist);
>  
>    add_cmd ("psymtabs", class_maintenance, maintenance_info_psymtabs, _("\
> diff --git a/gdb/symmisc.c b/gdb/symmisc.c
> index a65552aa2d2..5b8a82e5137 100644
> --- a/gdb/symmisc.c
> +++ b/gdb/symmisc.c
> @@ -1052,7 +1052,7 @@ Entries in the full symbol table are dumped to file OUTFILE,\n\
>  or the terminal if OUTFILE is unspecified.\n\
>  If ADDRESS is provided, dump only the file for that address.\n\
>  If SOURCE is provided, dump only that file's symbols.\n\
> -If OBJFILE is provided, dump only that file's minimal symbols."),
> +If OBJFILE is provided, dump only that object file's symbols."),
>  	   &maintenanceprintlist);
>  
>    add_cmd ("msymbols", class_maintenance, maintenance_print_msymbols, _("\

Thanks, this LGTM, but shouldn't the "ADDRESS" line be reworded like
below?

  If ADDRESS is provided, dump only the symbols for that address.

If that's not the intent, then can someone please explain the meaning
of "the file for that address"?

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

* Re: [PATCH] [gdb] Fix maint print symbols/psymbols help text
  2023-08-14 12:14 ` Eli Zaretskii
@ 2023-08-14 12:48   ` Tom de Vries
  2023-08-14 13:39     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Tom de Vries @ 2023-08-14 12:48 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

On 8/14/23 14:14, Eli Zaretskii wrote:
>> Date: Mon, 14 Aug 2023 10:53:40 +0200
>> From: Tom de Vries via Gdb-patches <gdb-patches@sourceware.org>
>>
>> diff --git a/gdb/psymtab.c b/gdb/psymtab.c
>> index 64b67078641..bdae9db9676 100644
>> --- a/gdb/psymtab.c
>> +++ b/gdb/psymtab.c
>> @@ -1687,7 +1687,7 @@ Entries in the partial symbol table are dumped to file OUTFILE,\n\
>>   or the terminal if OUTFILE is unspecified.\n\
>>   If ADDRESS is provided, dump only the file for that address.\n\
>>   If SOURCE is provided, dump only that file's symbols.\n\
>> -If OBJFILE is provided, dump only that file's minimal symbols."),
>> +If OBJFILE is provided, dump only that object file's symbols."),
>>   	   &maintenanceprintlist);
>>   
>>     add_cmd ("psymtabs", class_maintenance, maintenance_info_psymtabs, _("\
>> diff --git a/gdb/symmisc.c b/gdb/symmisc.c
>> index a65552aa2d2..5b8a82e5137 100644
>> --- a/gdb/symmisc.c
>> +++ b/gdb/symmisc.c
>> @@ -1052,7 +1052,7 @@ Entries in the full symbol table are dumped to file OUTFILE,\n\
>>   or the terminal if OUTFILE is unspecified.\n\
>>   If ADDRESS is provided, dump only the file for that address.\n\
>>   If SOURCE is provided, dump only that file's symbols.\n\
>> -If OBJFILE is provided, dump only that file's minimal symbols."),
>> +If OBJFILE is provided, dump only that object file's symbols."),
>>   	   &maintenanceprintlist);
>>   
>>     add_cmd ("msymbols", class_maintenance, maintenance_print_msymbols, _("\
> 
> Thanks, this LGTM, but shouldn't the "ADDRESS" line be reworded like
> below?
> 
>    If ADDRESS is provided, dump only the symbols for that address.
> 
> If that's not the intent, then can someone please explain the meaning
> of "the file for that address"?

I played around with it to understand what it does:
...
$ gcc -g hello.c
$ gdb -q -batch a.out -readnow -ex "maint print symbols" | grep ^Symtab
Symtab for file ../sysdeps/x86_64/crtn.S at 0x39c5e60
Symtab for file elf-init.c at 0x39c5260
Symtab for file /usr/lib64/gcc/x86_64-suse-linux/7/include/stddef.h at 
0x39c52a0
Symtab for file hello.c at 0x307ff80
Symtab for file /usr/lib64/gcc/x86_64-suse-linux/7/include/stddef.h at 
0x307ffc0
Symtab for file /usr/include/bits/types.h at 0x3080000
Symtab for file /usr/include/bits/types/struct_FILE.h at 0x39c2b70
Symtab for file /usr/include/bits/types/FILE.h at 0x39c2bb0
Symtab for file /usr/include/stdio.h at 0x39c2bf0
Symtab for file /usr/include/bits/sys_errlist.h at 0x39c2c30
Symtab for file ../sysdeps/x86_64/crti.S at 0x307fc90
Symtab for file init.c at 0x307f890
Symtab for file ../sysdeps/x86_64/start.S at 0x307f4c0
$ gdb -q -batch a.out -readnow -ex "maint print symbols -pc main" | grep 
^Symtab
Symtab for file hello.c at 0x242ff80
...

The docs say ( 
https://sourceware.org/gdb/onlinedocs/gdb/Symbols.html#index-maint-print-symbols 
):
...
If -pc address is specified, only dump symbols for the file with code at 
that address.
...

So how about:
...
     If ADDRESS is provided, dump only the symbols for the file with 
code at that address.
...
?

Thanks,
- Tom


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

* Re: [PATCH] [gdb] Fix maint print symbols/psymbols help text
  2023-08-14 12:48   ` Tom de Vries
@ 2023-08-14 13:39     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2023-08-14 13:39 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gdb-patches

> Date: Mon, 14 Aug 2023 14:48:10 +0200
> Cc: gdb-patches@sourceware.org
> From: Tom de Vries <tdevries@suse.de>
> 
> So how about:
> ...
>      If ADDRESS is provided, dump only the symbols for the file with 
> code at that address.
> ...
> ?

Perfect, thanks.

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

end of thread, other threads:[~2023-08-14 13:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-14  8:53 [PATCH] [gdb] Fix maint print symbols/psymbols help text Tom de Vries
2023-08-14 12:14 ` Eli Zaretskii
2023-08-14 12:48   ` Tom de Vries
2023-08-14 13:39     ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).