This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 0/3] remove-symbol-file
- From: Pedro Alves <palves at redhat dot com>
- To: Nicolas Blanc <nicolas dot blanc at intel dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 24 Apr 2013 15:09:26 +0100
- Subject: Re: [PATCH 0/3] remove-symbol-file
- References: <1366098721-18302-1-git-send-email-nicolas dot blanc at intel dot com>
On 04/16/2013 08:51 AM, Nicolas Blanc wrote:
> This patch adds a command for removing individual symbol files.
>
> The symbol-file command without parameter can be used to clear
> all symbol-file information. This command is not practical if
> the user needs to remove just one file, however.
>
> Apple provides its own remove-symbol-file command but the code
> was not upstreamed [1]. I provide here my own implementation.
> There are two main differences between the command from Apple and
> mine:
>
> 1) The remove-symbol-file command from Apple takes as parameter
> the file to remove whereas this implementation requires the load
> address of the file. Hence, this command is able to unload
> symbol for files that have been loaded multiple times.
Some points to consider on the interface/spec/requirements, before
the user interface is carved in stone.
Doesn't it also make it more complicated to use for the more common
case of not loading files multiple times? For the case of multiple
symbol files with the same file, we could warn/query the user to
remove all with the same file.
I believe one can actually load overlapping files with add-symbol-file.
So "load address" is not a unique identifier, though in practice it'll
work most of the time.
Also, "load address" is not clear here. With "add-symbol-file",
the specified addresses is actually the ".text" section's address.
(gdb) help add-symbol-file
Load symbols from FILE, assuming FILE has been dynamically loaded.
Usage: add-symbol-file FILE ADDR [-s <SECT> <SECT_ADDR> -s <SECT> <SECT_ADDR> ...]
ADDR is the starting address of the file's text.
...
if (argcnt == 1)
{
/* The second argument is always the text address at which
to load the program. */
sect_opts[section_index].name = ".text";
sect_opts[section_index].value = arg;
...
This actually looks a bit problematic for the remove case, because
there may not be a .text segment at all, or the .text section may
not be the lowest section loaded in the text segment, or the text
segment may not be the lowest loaded segment. In the add case,
if there's no .text, you pass in a random ADDR, I believe.
So should we consider mirroring the add-symbol-file syntax?
remove-symbol-file FILE
remove-symbol-file FILE ADDR
remove-symbol-file -s .data DATA_ADDR
And in all cases, if there are overlapping symbol files,
warn/remove all that match?
How are manually added symbol files listed, BTW?
Should we have a new "info symbol-files" command listing manually
added symbol files?
Maybe we should have a unique number to each symbol file? Then the user
could list and remove them by number (like e.g., breakpoints) instead.
Or maybe even generalize that into "info objfiles". Dunno.
> I would appreciate feedback from the maintainers of GDB at Apple to
> help upstream a command that satisfies the community at large.
There are none. Apple stopped caring about upstream GDB long ago.
--
Pedro Alves