|
List Info
Thread: MI: getting qualified type name
|
|
| MI: getting qualified type name |

|
2006-04-13 17:26:46 |
That's odd. If I define some struct in a namespace myself,
like:
namespace bar
{
struct whatever
{
int someval;
};
};
then -var-create lists the type as bar::whatever. So it
must be
something funny about how "string" is defined,
rather than a general
bug or a decision to strip the namespace info.
(Note, however, if you are using stabs, you'll never get
the
namespace, since it isn't in the debug info. You probably
aren't
using stabs, but just to be clear...)
Jim
On Apr 13, 2006, at 1:20 AM, Vladimir Prus wrote:
>
> Hi,
> is it possible, using MI, to obtain fully qualified
type of a
> variable. Say,
> I have variable of type std::string. I want KDevelop to
invoke special
> display code for all variables of that type. However,
there's what
> MI gives
> me:
>
> (gdb) -var-create MYTEST * s
>
^done,name="MYTEST",numchild="2",typ
e="string"
> (gdb) -var-info-type MYTEST
>
> The name is not qualified, and it's not repliable to
invoke special
> display
> code for all types named 'string'. The only way to
obtain the desired
> information seems to be 'ptype' command, and parsing
output of that
> CLI
> command seems problematic.
>
> Any ideas?
>
> - Volodya
>
>
>
|
|
| MI: getting qualified type name |

|
2006-04-14 12:47:34 |
On Thu, Apr 13, 2006 at 10:26:46AM -0700, Jim Ingham wrote:
> That's odd. If I define some struct in a namespace
myself, like:
>
> namespace bar
> {
> struct whatever
> {
> int someval;
> };
> };
>
> then -var-create lists the type as bar::whatever. So
it must be
> something funny about how "string" is
defined, rather than a general
> bug or a decision to strip the namespace info.
It appears to be a bug involving typedefs. Try adding
"typedef
whatever zot" inside of namespace bar.
namespace bar
{
struct whatever
{
int someval;
};
typedef whatever zot;
};
(gdb) interpreter-exec mi "-var-create - * b"
^done,name="var2",numchild="1",type=
"bar::whatever"
(gdb)
(gdb) interpreter-exec mi "-var-create - * c"
^done,name="var3",numchild="1",type=
"zot"
(gdb)
I don't know what compiler you're using, Vladimir, but in
GCC 4.0.3
this appears to be a compiler bug. The typedef gets emitted
inside
main, not inside the namespace. Same in 3.3. Slightly
different,
but similar problem in 4.1.
This is now GCC PR 27160.
htt
p://gcc.gnu.org/bugzilla/show_bug.cgi?id=27160
> (Note, however, if you are using stabs, you'll never
get the
> namespace, since it isn't in the debug info. You
probably aren't
> using stabs, but just to be clear...)
Actually, IIRC, it does but poorly? Hmm, maybe not for this
case.
--
Daniel Jacobowitz
CodeSourcery
|
|
| MI: getting qualified type name |

|
2006-04-14 12:52:00 |
On Friday 14 April 2006 16:47, Daniel Jacobowitz wrote:
> namespace bar
> {
> struct whatever
> {
> int someval;
> };
> typedef whatever zot;
> };
>
> (gdb) interpreter-exec mi "-var-create - *
b"
>
^done,name="var2",numchild="1",type=
"bar::whatever"
> (gdb)
> (gdb) interpreter-exec mi "-var-create - *
c"
>
^done,name="var3",numchild="1",type=
"zot"
> (gdb)
>
> I don't know what compiler you're using, Vladimir,
but in GCC 4.0.3
> this appears to be a compiler bug. The typedef gets
emitted inside
> main, not inside the namespace. Same in 3.3. Slightly
different,
> but similar problem in 4.1.
>
> This is now GCC PR 27160.
> htt
p://gcc.gnu.org/bugzilla/show_bug.cgi?id=27160
Ah! I'm using 3.3 so it's affected by this bug. Thanks for
diagnosing, hope
it'll be fixed soon.
Thanks,
Volodya
|
|
[1-3]
|
|