add-symbol-file/load and scripts

Doug Evans dje@google.com
Tue Jun 2 17:26:00 GMT 2009


On Tue, Jun 2, 2009 at 10:04 AM, Jerome Guitton <guitton@adacore.com> wrote:
> Paul Pluzhnikov (ppluzhnikov@google.com):
>
>> On Tue, Jun 2, 2009 at 9:27 AM, Jerome Guitton <guitton@adacore.com> wrote:
>>
>> > the text's address, as initialized
>> > in the symbol file itself, would be the appropriate defaut.
>>
>> AFAIU, on any UNIX system it would be appropriate default *only* for ET_EXEC.
>> For non-prelinked ET_DYN, one needs to add the base load address.
>
> Thank you for pointing this out! This definitely rules out the first
> solution.
>
> So, what about the second possibility? (That is to say: when it is
> possible, setting a convenience variable to the start address after
> load).

With a better scripting language with better tools for access to elf
files (a small subset of all of the various kinds of things one would
like to be able to script better), one could pass the .elf file to a
function and it would return the desired value.

add-symbol-file foo.elf $elf.load_address ("foo.elf")    # [just
winging syntax here, it's subordinate to the main point]



More information about the Gdb mailing list