Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <cagney@gnu.org>
To: Jason Molenda <jmolenda@apple.com>
Cc: gdb-patches@sources.redhat.com, Jim Blandy <jimb@redhat.com>,
	Mark Kettenis <kettenis@jive.nl>, Eli Zaretskii <eliz@elta.co.il>,
	Devang Patel <dpatel@apple.com>
Subject: Re: RFA/patch stabs reader:  Recognize language hint in SO stab
Date: Thu, 05 Aug 2004 20:55:00 -0000	[thread overview]
Message-ID: <41129E97.4030207@gnu.org> (raw)
In-Reply-To: <890A6444-E71C-11D8-B4BD-000A9569836A@apple.com>

> 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


  reply	other threads:[~2004-08-05 20:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-05 20:08 Jason Molenda
2004-08-05 20:17 ` Jason Molenda
2004-08-05 20:55   ` Andrew Cagney [this message]
2004-08-24 20:45     ` Andrew Cagney
2004-08-25  1:05       ` Jason Molenda
2004-08-05 21:10   ` Michael Chastain
2004-08-06  8:54 ` Eli Zaretskii
2004-09-20 19:28   ` RFA/doc-patch " Jason Molenda
2004-09-21  3:43     ` Eli Zaretskii
2004-09-21 21:08       ` COMMITTED/doc-patch " Jason Molenda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41129E97.4030207@gnu.org \
    --to=cagney@gnu.org \
    --cc=dpatel@apple.com \
    --cc=eliz@elta.co.il \
    --cc=gdb-patches@sources.redhat.com \
    --cc=jimb@redhat.com \
    --cc=jmolenda@apple.com \
    --cc=kettenis@jive.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox