Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-debug-dev] Module class needs to be expanded

Hi Linda,

In gdbPicl, a module is represented by a single start and end address.
Issuing a "info file" commande in Gdb will give a list of addresses as
follows:

        Entry point: 0x8048840
        0x080480f4 - 0x08048107 is .interp
        0x08048108 - 0x08048128 is .note.ABI-tag
        0x08048128 - 0x080481f0 is .hash
        0x080481f0 - 0x080483e0 is .dynsym
        0x080483e0 - 0x080485b8 is .dynstr
        0x080485b8 - 0x080485f6 is .gnu.version
        0x080485f8 - 0x08048628 is .gnu.version_r
        0x08048628 - 0x08048630 is .rel.got
        0x08048630 - 0x08048638 is .rel.bss
        0x08048638 - 0x080486d8 is .rel.plt
        0x080486d8 - 0x080486f0 is .init
        0x080486f0 - 0x08048840 is .plt
        0x08048840 - 0x08049f54 is .text
        0x08049f54 - 0x08049f72 is .fini
        0x08049f80 - 0x0804a41c is .rodata
        0x0804b420 - 0x0804b510 is .data
        0x0804b510 - 0x0804b7e8 is .eh_frame
        0x0804b7e8 - 0x0804b814 is .gcc_except_table
        0x0804b814 - 0x0804b81c is .ctors
        0x0804b81c - 0x0804b824 is .dtors
        0x0804b824 - 0x0804b884 is .got

Although these address ranges shown are contiguous on Linux, these
addresses may be dispersed on other operating systems.  Therefore, taking
the first address from the first item on the list as the module's start
address and taking the second address from the last item as the module's
end address may not be a valid assumption to take.  In order to support
other operating systems,  I propose that we store this list of addresses in
the module object.  This list can be stored in a Java's vector object and
you can dynamically add and remove elements from this vector list.

With this change, one will need to modify two interfaces to ensure the picl
still works.
One will need to replace the Module::setModuleStartFinishAddress with
something like addModuleStartFinishAddress.  This new function should take
the provided start and finish address and add it to the addresses list.  I
noticed that the module is currently keeping track of two sets of
addresses, one set of start and finish address in integer format and
another set in string format.  You only need a vector list to maintain the
addresses in integer format.  I don't think you need to create another list
to mange the string format addresses as they are not used anywhere in the
code.  In fact, you can probably remove those private data members.  Of
course, you will also need to modify the callers of
Module::setModuleStartFinishAddress and make sure that correct info is
passed into the function.

Another function to modify is the Module::containsAddress interface.  You
will need to change this function so that it will have to parse through the
entire addresses list and see if the provided frame address is within any
of the ranges in the list.

Linda, as you mentioned in your previous note, you complained that the picl
is trying to assign the addresses into an integer.  At that time, I
suggested you to use Long to represent the addresses instead.  However,
Brian brought up issues about 64 bit machines on which the addresses may be
even bigger.  He suggested that we should use another type in Java,
BigInteger.  It is an immutable arbitrary precision integer type.  And it
supports all integer operators provided by Java's Integer type.  For more
info about this data type, you can look for it from java documentations for
java.math package.

Samantha Chan


Linda Xie <lxie_2002@xxxxxxxxx>@eclipse.org on 02/04/2002 03:16:27 PM

Please respond to cdt-debug-dev@xxxxxxxxxxx

Sent by:  cdt-debug-dev-admin@xxxxxxxxxxx


To:   cdt-debug-dev@xxxxxxxxxxx
cc:
Subject:  [cdt-debug-dev] Module class needs to be expanded


There is a critical thing I need to discuss with
cdt-debug-dev.  Currently CDT/debug assumes that a
module(shared lib or main) has only one address range
which isn't a generic case. Since an elf file can have
multiple text and data areas theoretically, Module
class should use two(at least) variables to describe
address ranges(for example textAddress and
dataAddress) and I think  LinkedList would be the data
type for these variables.



Linda



Back to the top