public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: Paul Koning <pkoning@equallogic.com>
Cc: gdb@sources.redhat.com
Subject: Re: trouble with gdb 5.3, gcc 3.4, mips, dwarf-2
Date: Tue, 22 Apr 2003 22:25:00 -0000	[thread overview]
Message-ID: <20030422222518.GA19823@nevyn.them.org> (raw)
In-Reply-To: <16037.49033.658180.401145@pkoning.dev.equallogic.com>

On Tue, Apr 22, 2003 at 06:17:45PM -0400, Paul Koning wrote:
> Gentlepeople,
> 
> I'm not sure how best to attack this so I'm starting here...
> 
> I have a slightly modified gdb 5.3 that's given me a bunch of nasty
> problems on a MIPS target.  Given what I'm seeing, it's unlikely that
> the local changes are the cause (minor tweaks to mips-tdep, plus a
> bunch of extensions -- but nothing in the guts of type handling or
> symbol table reading).
> 
> In the process of trying to look for solutions, I tried building a
> current snapshot of gcc for my target.  After some struggles, I have a
> build that worked (it doesn't execute -- but at least it links).
> 
> Gdb 5.3 acts very strangely as a result.  When I tried to cast a
> pointer to a C++ class type, it complained about a parse error.
> "ptype" explains why -- gdb didn't recognize the name as a class name,
> it took it for a function name.
> 
> I reduced it to a simple test case:
> 
> class test
> {
> public:
>     int z;
>     void foo(int i) 
>     {
>         z = i;
>     }
> };
> 
> class bar : public test
> {
> public:
>     int m;
>     int x;
>     bar(int);
>     void test(int i) 
>     {
>         m = i;
>     }
> };
> 
> bar::bar(int i)
> {
>     x = i;
>     m = i*3;
> }
> 
> int errno;
> int exit;
> bar *bp;
> 
> int main (int, char**)
> {
>     bp = new bar(16);
> }
> 
> Compiled with -gdwarf-2, I see this:
> 
> (gdb) ptype bar
> type = void (bar * const, int)
> 
> Compiled with -gstabs+, I get what I expect:
> 
> (gdb) ptype bar
> type = class bar : public test {
>   public:
>     int m;
>     int x;
> 
>     bar & operator=(bar const&);
>     bar(bar const&);
>     bar(int);
>     void test(int);
> }
> 
> Obviously this could be a gdb problem or a gcc problem.  How can I
> tell?  I've poked in both, but only around the edges.

GDB problem, I think, but I'm not quite sure.

The DWARF-2 info probably says that the name of the function is "bar". 
GDB doesn't put this together with other information to establish that
it's actually a method.  So in the global scope we have bar (typedef to
class bar) and bar (function), and GDB happens to pick the function.


> FWIW, the problems that drove me to try this experiment are:
> 
> 1. For some functions (involving C++ classes with templates and
>    multiple inheritance, that may or may not be relevant, I don't know
>    yet) breakpoints aren't hit.  Single stepping through the code
>    causes nonsensical line numbers to be displayed, jumping wildly
>    over several source files as the PC advances by one or two
>    instructions. 

The wild jumping I can't explain.  Not hitting breakpoints is about par
for the course right now.  We're working on C++ support, as time
permits.

> 2. We see a bunch of symtab vs. psymtab mismatch errors.  The easiest
>    way to see it is to issue "maint check-symtabs" on gdb startup; it
>    complains bitterly about large quantities of errors (all C++
>    mangled names).

Hmm, I haven't seen this.  I'll have to build a MIPS toolchain and take
a look; it may be a while before I have time.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

      reply	other threads:[~2003-04-22 22:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-22 22:18 Paul Koning
2003-04-22 22:25 ` Daniel Jacobowitz [this message]

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=20030422222518.GA19823@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=gdb@sources.redhat.com \
    --cc=pkoning@equallogic.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).