From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Elizabeth Chastain To: gdb-patches@sourceware.cygnus.com Subject: [RFA] "maint print psymbols" with large section tables Date: Wed, 28 Feb 2001 13:48:00 -0000 Message-id: <200102282148.NAA06598@bosch.cygnus.com> X-SW-Source: 2001-02/msg00524.html 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 * 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);