Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 14860
Product:  
Component:  
Status: RESOLVED
Resolution: FIXED
Assigned To: Zack Weinberg <zackw@panix.com>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: Michael Elizabeth Chastain <mec.gnu@mindspring.com>
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
builtin.c C Source file which exhibits the problem text/plain 2004-04-06 02:08 48 bytes Edit
builtin.stabs+.20040323234000.s Good assembly output, gcc 2004-03-23 23:40:00 UTC text/plain 2004-04-06 02:10 632 bytes Edit
builtin.stabs+.20040324000000.s bad assembly output, gcc HEAD 2004-03-24 00:00:00 UTC text/plain 2004-04-06 02:13 430 bytes Edit
pr14680.diff pr14680.diff patch 2004-08-04 00:46 402 bytes Edit | Diff
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 14860 depends on: Show dependency tree
Show dependency graph
Bug 14860 blocks:

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: 2004-04-06 16:45 Opened: 2004-04-06 02:06
Here is a test program:

  char * pc;

  int main ()
  {
    return 0;
  }

Compile with gcc -gstabs+ -S.

Here are the stabs with gcc 2004-03-23 23:40:00 UTC

        .stabs  "char:t(0,2)=r(0,2);0;127;",128,0,0,0
        .stabs  "pc:G(0,16)=*(0,2)",32,0,1,0

Here are the stabs with gcc 2004-03-24 00:00:00 UTC

        .stabs  "pc:G(0,2)=*(0,3)=r(0,3);0;127;",32,0,1,0

The problem with the new stabs is that type (0,3) has no name.
So gdb cannot print this type:

  # gdb 6.0
  (gdb) ptype pc
  type = <invalid type code 7> *

I narrowed the regression down to this patch:

  2004-03-23  Zack Weinberg  <zack@codesourcery.com>

        PR 12267, 12391, 12560, 13129, 14114, 14133

This problem does not happen with -gdwarf-2.

This problem happens with gcc HEAD and gcc tree-ssa-20020619-branch.  It does
not happen with gcc gcc-3_4-branch or gcc gcc-3_3-branch.

I suspect that the problem is related to the removal of first_builtin_decl and
last_builtin_decl.  When I compile an empty program with the old compiler, there
are stab lines for about 20 builtin types (int, char, float, double, etc).  When
I compile an empty program with the new compiler, there are no such stab lines.

------- Comment #1 From Michael Elizabeth Chastain 2004-04-06 02:08 -------
Created an attachment (id=6039) [edit]
C Source file which exhibits the problem

------- Comment #2 From Michael Elizabeth Chastain 2004-04-06 02:10 -------
Created an attachment (id=6040) [edit]
Good assembly output, gcc 2004-03-23 23:40:00 UTC

Compile builtin.c with gcc -gstabs+ -S

------- Comment #3 From Michael Elizabeth Chastain 2004-04-06 02:13 -------
Created an attachment (id=6041) [edit]
bad assembly output, gcc HEAD 2004-03-24 00:00:00 UTC

Compile builtin.c with gcc -gstabs+ -S.

The problem is the lack of name for "char" type, so gdb prints "pointer to
char" as something like "pointer to <unknown integral type>".

------- Comment #4 From Andrew Pinski 2004-04-06 04:50 -------
Confirmed.

------- Comment #5 From Zack Weinberg 2004-04-06 16:44 -------
mine.  not critical, though.

------- Comment #6 From Andrew Pinski 2004-06-23 22:52 -------
This is very important to Darwin and other targets which use stabs still by
default.

------- Comment #7 From Andrew Pinski 2004-07-02 21:01 -------
As I said this effects darwin and some other targets like AIX too.

------- Comment #8 From Zack Weinberg 2004-08-04 00:46 -------
Subject: [PR 14860] candidate patch


Candidate patch for PR 14860.  It's remarkably simple - the builtin
types are not available to dbxout_init through its syms argument
(since C getdecls always returns 0) so c-decl.c's record_builtin_type
needs to call debug_hooks->type_decl.  And it even says so, in a
comment in dbxout.c which I wrote.  I somehow forgot to do the other
half.

I'll be testing this on a DWARF system (amd64-linux) as well as a
stabs system (powerpc-darwin) since this change is visible to all
debug info generators.

zw


------- Comment #9 From Zack Weinberg 2004-08-04 00:46 -------
Created an attachment (id=6875) [edit]

------- Comment #10 From Zack Weinberg 2004-08-04 01:05 -------
(From update of attachment 6875 [edit])
arrr, this be a patch, matey

------- Comment #11 From Zack Weinberg 2004-08-04 07:01 -------
dunno where the commit message went, but the patch is checked in now.

------- Comment #12 From Michael Elizabeth Chastain 2004-08-05 16:32 -------
Works great for me on native i686-pc-linux-gnu.

All my sample programs behave now.

I ran the gdb test suite with the usual battery:

  gdb 6.1.1, gdb HEAD
  gdb test suite HEAD with local modifications
  gcc 3.4.1, gcc HEAD 200407031, gcc HEAD 20040804
  dwarf-2 and stabs+

About 800 FAILs went away with -gstabs+ (out of 10_000 tests), and now gdb is
usable again.

Nothing regressed.  Color me happy.  Another cheer for Zack.

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug