This is the mail archive of the gdb@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Multiple personalities gdb?


Kevin Buettner writes:
 > On Apr 20,  4:35pm, Elena Zannoni wrote:
 > 
 > > I am wondering about these two constants:
 > > 
 > > gdb-stabs.h:41:#define	SECT_OFF_MAX	16	/* Count of possible values */
 > > 
 > > and 
 > > 
 > > symfile.h:64:#define MAX_SECTIONS 40
 > 
 > [...]
 > 
 > > Should MAX_SECTIONS == SECT_OFF_MAX ?
 > 
 > It seems reasonable.  (But see below.)
 > 

Yes, it should definitely be changed, I am now looking at gdb
debugging gdb itself. One of the shlib loaded has 17 sections, and in
default_symfile_offests it allocates only 16 objfile->section_offsets,
because it uses SECT_OFF_MAX.

I'll do a mini patch just for this.


 > > 
 > > As I understand it, SECT_OFF_MAX is the maximum value that a section
 > > index can have. Souldn't it at least be increased? I have seen
 > > sections with indexes higher than 16.
 > 
 > I was the one who changed the value of MAX_SECTIONS recently.  40
 > seemed big enough for my purposes, but in my opinion, this data
 > structure should really be dynamically sized/resized.
 > 
 > Since you've been changing struct section_addr_info recently, maybe
 > you could change it a little bit more...  Maybe to something along the
 > following lines:
 > 
 >     struct section_addr_info {
 >       int num_sections;
 >       struct section_addr_info_sections
 >       {
 > 	CORE_ADDR addr;
 > 	char *name;
 > 	int sectindex;
 >       } sections[1];
 >     };
 > 
 > Then when you need ``n'' sections, allocate as follows:
 > 
 >     struct section_addr_info saip;
 > 
 >     saip = xmalloc (sizeof (struct section_addr_info) 
 > 	            + (n - 1) * sizeof (struct section_addr_info_sections));
 >     saip->num_sections = n;
 >     ...
 > 
 > 

Yes, that should be done. When I get around to delete that 'other'
array...  I usually do things incrementally, otherwise I get very
confused in my sandbox (Cagney docet!).

Elena

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]