Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Koffee Lue" <klu2008@gmail.com>
To: gdb <gdb@sourceware.org>
Subject: Bug? GDB can't display c++ c'tor local variable.
Date: Fri, 14 Nov 2008 20:32:00 -0000	[thread overview]
Message-ID: <8440576b0811141231u55336182p8e16563889f4143e@mail.gmail.com> (raw)

Hi,

I found that GDB can't display local variables in a c++ constructor.

Please see the testing code below. When I stepped into the c'tor, and
typed ''info lo'', gdb responded "No locals.", however `tmp' is a
local with type int.

I searched on the web and somebody said it's a bug of gcc rather than
gdb. But that's for gcc 3.x years ago. (see:
http://gcc.gnu.org/ml/gcc-bugs/2007-08/msg00727.html)

Any hint???

Thanks!

Here's my system:
----------------------------------
Distributor ID: Ubuntu
Description:    Ubuntu 8.04.1
Release:        8.04
Codename:       hardy

g++ (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu3)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu".

----- testing code ------
     1  #include <iostream>
     2
     3  using namespace std;
     4
     5  class A {
     6      public:
     7          int a;
     8          A();
     9  };
    10
    11  A::A()
    12  {
    13      int tmp = 5;
    14      a = tmp;
    15      cout << "a= "<<a<<endl;
    16      cout << "tmp= "<<tmp<<endl;
    17  }
    18
    19  int main()
    20  {
    21      A x;
    22      return 0;
    23  }
    24


             reply	other threads:[~2008-11-14 20:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-14 20:32 Koffee Lue [this message]
2008-11-14 20:41 ` Daniel Jacobowitz

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=8440576b0811141231u55336182p8e16563889f4143e@mail.gmail.com \
    --to=klu2008@gmail.com \
    --cc=gdb@sourceware.org \
    /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