This is the mail archive of the gdb-patches@sources.redhat.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]
Other format: [Raw text]

Re: RFA/patch stabs reader: Recognize language hint in SO stab


I knew I forgot something: Testing.

Can this be turned into a proper testcase? gdb.stabs/ I guess? The last thing we want is to accidently break this.


Andrew

I tested the patch on an x86 Linux box with gcc 3.4.0 with -gstabs+; there was no change with or without the patch. The compiler wasn't setting the desc field in the SO stabs, of course, so I made a small C++ program

#include <iostream>

int foo (int a);
int
main()
{
   int a = 10;
   std::cout << "hi there" << a << std::endl;
   return foo (a);
}

int foo (int a)
{
  return a + 5;
}


called "a.c", and modified the stabs by hand to


        .file   "a.c"
        .stabs  "/tmp/",100,0,0,.Ltext0
        .stabs  "a.c",100,0,4,.Ltext0

The value 4 is N_SO_CC. Without this change, this is what gdb looks like:

(gdb) b foo
Breakpoint 1 at 0x80488ed: file a.c, line 13.
(gdb) r
Starting program: /tmp/a.out
hi there10

Breakpoint 1, _Z3fooi (a=10) at a.c:14
14        return a + 5;
(gdb)


With this change, we get


(gdb) b foo
Breakpoint 1 at 0x80488ed: file a.c, line 14.
(gdb) r
Starting program: /tmp/a.out
hi there10

Breakpoint 1, foo (a=10) at a.c:14
14        return a + 5;
Current language:  auto; currently c++
(gdb)


Huzzah.


(obviously this is just an example of incorrect behavior -- when you're working with real C++ code the inability to detect the fact that it's a C++ program causes all sorts of problems.)

J


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