* [RFA] "maint print psymbols" with large section tables
@ 2001-02-28 13:48 Michael Elizabeth Chastain
2001-03-01 0:47 ` Eli Zaretskii
0 siblings, 1 reply; 4+ messages in thread
From: Michael Elizabeth Chastain @ 2001-02-28 13:48 UTC (permalink / raw)
To: gdb-patches
This patch fixes "maint print psymbols" to work better with large
section offset tables. The existing code prints the whole section offset
tale all on one line, which is awkward when a section offset table has
900+ entries. (The code thinks it is wrapping lines, but wrap_here()
does no good when all the output is going to outfile).
The existing code also takes so long to execute that I saw timeout
failures in gdb.base/maint.exp. This is my motivation for changing
the code.
The new code prints only the non-zero entries of a section offset table,
one per line.
This does not fix PR gdb/29, but it it's a pre-requisite for fixing this
bug without casing a regression failure in maint.exp.
I tested this on Red Hat Linux 6.2 native and Solaris 2.6 native
using the FSF gcc compiler from cvs branch gcc-3_0-branch checked out
on 2001-02-28. I hand inspected the relevant sections of gdb.log and
compared before-and-after test results.
OK to apply?
===
2001-02-28 Michael Chastain <chastain@redhat.com>
* symmisc.c (dump_psymtab): Dump only the non-zero elements of
the section offset table.
Index: gdb/symmisc.c
===================================================================
RCS file: /cvs/src/src/gdb/symmisc.c,v
retrieving revision 1.4
diff -c -3 -p -r1.4 symmisc.c
*** gdb/symmisc.c 2000/12/15 01:01:50 1.4
--- gdb/symmisc.c 2001/02/28 20:41:36
***************
*** 1,5 ****
/* Do various things to symbol tables (other than lookup), for GDB.
! Copyright 1986, 1987, 1989, 1991-1996, 1998, 2000 Free Software Foundation, Inc.
This file is part of GDB.
--- 1,6 ----
/* Do various things to symbol tables (other than lookup), for GDB.
! Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1998,
! 2000, 2001 Free Software Foundation, Inc.
This file is part of GDB.
*************** dump_psymtab (struct objfile *objfile, s
*** 360,376 ****
fprintf_filtered (outfile, ")\n");
}
! fprintf_filtered (outfile, " Relocate symbols by ");
! for (i = 0; i < psymtab->objfile->num_sections; ++i)
! {
! if (i != 0)
! fprintf_filtered (outfile, ", ");
! wrap_here (" ");
! print_address_numeric (ANOFFSET (psymtab->section_offsets, i),
! 1,
! outfile);
! }
! fprintf_filtered (outfile, "\n");
fprintf_filtered (outfile, " Symbols cover text addresses ");
print_address_numeric (psymtab->textlow, 1, outfile);
--- 361,383 ----
fprintf_filtered (outfile, ")\n");
}
! fprintf_filtered (outfile, " Section offset table\n");
! {
! int empty = 1;
! for (i = 0; i < psymtab->objfile->num_sections; ++i)
! {
! CORE_ADDR offset = ANOFFSET (psymtab->section_offsets, i);
! if (offset != 0)
! {
! fprintf_filtered (outfile, "%5d ", i);
! print_address_numeric (offset, 1, outfile);
! fprintf_filtered (outfile, "\n");
! empty = 0;
! }
! }
! if (empty)
! fprintf_filtered (outfile, " (empty)\n");
! }
fprintf_filtered (outfile, " Symbols cover text addresses ");
print_address_numeric (psymtab->textlow, 1, outfile);
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [RFA] "maint print psymbols" with large section tables
2001-02-28 13:48 [RFA] "maint print psymbols" with large section tables Michael Elizabeth Chastain
@ 2001-03-01 0:47 ` Eli Zaretskii
2001-03-01 7:40 ` Andrew Cagney
0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2001-03-01 0:47 UTC (permalink / raw)
To: Michael Elizabeth Chastain; +Cc: gdb-patches
On Wed, 28 Feb 2001, Michael Elizabeth Chastain wrote:
> This patch fixes "maint print psymbols" to work better with large
> section offset tables. The existing code prints the whole section offset
> tale all on one line, which is awkward when a section offset table has
> 900+ entries. (The code thinks it is wrapping lines, but wrap_here()
> does no good when all the output is going to outfile).
>
> The existing code also takes so long to execute that I saw timeout
> failures in gdb.base/maint.exp. This is my motivation for changing
> the code.
>
> The new code prints only the non-zero entries of a section offset table,
> one per line.
I don't like removing features, unless we know for a fact that no one
uses them. In my experience, many times a feature is requested
shortly after it is removed ;-)
Is it possible that someone would want to see the zero entries as
well? If so, I think we should at least leave behind some option that
could be used to see all the entries, albeit in a different format
(one per line).
Also, if this patch is accepted, please update the docs of "maint print
psymbols" in gdb.texinfo. It should at least say that zero entries are
skipped.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] "maint print psymbols" with large section tables
2001-03-01 0:47 ` Eli Zaretskii
@ 2001-03-01 7:40 ` Andrew Cagney
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Cagney @ 2001-03-01 7:40 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Michael Elizabeth Chastain, gdb-patches
> I don't like removing features, unless we know for a fact that no one
> uses them. In my experience, many times a feature is requested
> shortly after it is removed ;-)
Yes, fwiw, I agree. I think ``maint print psymbols'' should print the
table. Not just the bits that might be interesting. It is an internal
command to dump an entire data structure.
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] "maint print psymbols" with large section tables
@ 2001-03-01 12:44 Michael Elizabeth Chastain
0 siblings, 0 replies; 4+ messages in thread
From: Michael Elizabeth Chastain @ 2001-03-01 12:44 UTC (permalink / raw)
To: eliz; +Cc: gdb-patches
Eli Zaretskii writes:
> It doesn't have the zeo entries.
That's true. I don't think it needs the zero entries, because all
the non-zero entries have index numbers.
My use case is:
Sun Ultrasparc 60
Solaris 2.6 native
target program with 945 sections (namely, gdb itself)
gdb built with SECT_OFF_MAX=1024, MAX_SECTIONS=1024
(gdb) break main
(gdb) run
(gdb) maint print psymbols xx.psym
"maint print psymbols" takes 23 seconds to execute and produces a 7.1
megabyte output file. 74% of that output file is the zero entries in
section offset tables.
On a slower machine (400 MHz Intel PII) with bigger section tables (2048
lines), "maint print psymbols" takes so long to run that gdb.base/maint.exp
times out and fails.
> I'm not opposed to the change in the format of the output. My
> reservations were only about omitting part of the symbol entries.
You mean section table entries -- I'm not touching symbols at all.
Michael
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-03-01 12:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-28 13:48 [RFA] "maint print psymbols" with large section tables Michael Elizabeth Chastain
2001-03-01 0:47 ` Eli Zaretskii
2001-03-01 7:40 ` Andrew Cagney
2001-03-01 12:44 Michael Elizabeth Chastain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox