[PATCH 1/1] Add support for symbol addition to the Python API

Simon Marchi simark@simark.ca
Fri Jan 6 20:21:05 GMT 2023


Same as with the other patches, I can't apply that patch, it seems
misformatted.

On 1/5/23 20:37, dark.ryu.550--- via Gdb-patches wrote:
> This patch adds support for symbol creation and registration. It currently 
> supports adding type symbols (VAR_DOMAIN/LOC_TYPEDEF), static symbols 
> (VAR_DOMAIN/LOC_STATIC) and goto target labels (LABEL_DOMAIN/LOC_LABEL). It 
> adds the `add_type_symbol`, `add_static_symbol` and `add_label_symbol`
> functions
> to the `gdb.Objfile` type, allowing for the addition of the aforementioned
> types of
> symbols.
> 
> This is done through building a new `compunit_symtab`s for each symbol that
> is
> to be added, owned by a given objfile and whose lifetimes is bound to it. i 
> might be missing something here, but there doesn't seem to be an intended
> way 
> to add new symbols to a compunit_symtab after it's been finished. if there
> is, 
> then the efficiency of this method could very much be improved. It could
> also be
> made more efficient by having a way to add whole batches of symbols at once,
> 
> which would then all get added to the same `compunit_symtab`.

Indeed, I don't think there's a way today to add symbols to a finished
compunit_symtab.  Maybe it would be worth exploring that.  First, to
avoid creating one compunit_symtab per created user symbol.  But also
because I wonder how user-created symbols interact with existing
symbols.  Let's say I have a symbol that comes from DWARF in an existing
compunit_symtab, and I create a user symbol for that function's address.
The new symbol is in a new compunit_symtab.  This means there is some
overlap in the addresses of two compunit_symtabs.  What would functions
like find_compunit_symtab_by_address return?  Should the new symbol be
added to an existing compunit_symtab, if the address falls into an
existing compunit_symtab's address range?

I think I'll have more questions / worries, but I'll wait until I can
actually apply the patch and read it (I can't read diffs, sorry).

Simon


More information about the Gdb-patches mailing list