public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* Re: [RFC] display names of explicit typedefs for 'info types'
       [not found] <37197.5782713436$1277308354@news.gmane.org>
@ 2010-06-24 16:56 ` Tom Tromey
  2010-06-25  7:36   ` Pierre Muller
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2010-06-24 16:56 UTC (permalink / raw)
  To: Pierre Muller; +Cc: gdb-patches

>>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr> writes:

Pierre>   I was always puzzled by the fact that info types
Pierre> did sometime not list types that I knew existed.
Pierre>   The problem is that for types defined in C using `typedef '
Pierre> only the definition part was displayed, but not the name of 
Pierre> the type itself.

Thanks for finding this.

Pierre> (gdb) ptype my
Pierre> type = int
Pierre> Here again, the original typedef name is completely lost ...

I think this is expected.  You can see the typedef if you use 'whatis'
instead:

(gdb) whatis my
type = myint

Pierre> 2010-06-22  Pierre Muller  <muller@ics.u-strasbg.fr>
Pierre>         * c-typeprint.c (c_print_typedef): Append new type name for
Pierre> typedefs.

This is ok.  Thanks.

Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [RFC] display names of explicit typedefs for 'info types'
  2010-06-24 16:56 ` [RFC] display names of explicit typedefs for 'info types' Tom Tromey
@ 2010-06-25  7:36   ` Pierre Muller
  0 siblings, 0 replies; 4+ messages in thread
From: Pierre Muller @ 2010-06-25  7:36 UTC (permalink / raw)
  To: tromey; +Cc: gdb-patches

> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Tom Tromey
> Envoyé : Thursday, June 24, 2010 6:37 PM
> À : Pierre Muller
> Cc : gdb-patches@sourceware.org
> Objet : Re: [RFC] display names of explicit typedefs for 'info types'
> 
> >>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>
> writes:
> 
> Pierre>   I was always puzzled by the fact that info types
> Pierre> did sometime not list types that I knew existed.
> Pierre>   The problem is that for types defined in C using `typedef '
> Pierre> only the definition part was displayed, but not the name of
> Pierre> the type itself.
> 
> Thanks for finding this.
> 
> Pierre> (gdb) ptype my
> Pierre> type = int
> Pierre> Here again, the original typedef name is completely lost ...
> 
> I think this is expected.  You can see the typedef if you use 'whatis'
> instead:
> 
> (gdb) whatis my
> type = myint
> 
> Pierre> 2010-06-22  Pierre Muller  <muller@ics.u-strasbg.fr>
> Pierre>         * c-typeprint.c (c_print_typedef): Append new type name
> for
> Pierre> typedefs.
> 
> This is ok.  Thanks.


  Thanks for the approval,
patch committed in:
http://sourceware.org/ml/gdb-cvs/2010-06/msg00167.html

Pierre

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] display names of explicit typedefs for 'info types'
  2010-06-23 15:52 Pierre Muller
@ 2010-06-23 16:58 ` Michael Snyder
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Snyder @ 2010-06-23 16:58 UTC (permalink / raw)
  To: Pierre Muller; +Cc: gdb-patches

Pierre Muller wrote:
>   I was always puzzled by the fact that info types
> did sometime not list types that I knew existed.
>   The problem is that for types defined in C using `typedef '
> only the definition part was displayed, but not the name of 
> the type itself.
> 
>   This small patch fixes that 'mis-feature'...
> I was expecting lots of failures in the testsuite,
> but was surprised to find no change that I could relate to the patch...
> 
>   The following tiny example:
>>>>>> Start
> typedef volatile int volint;
> typedef int myint;
> 
> volint vol;
> myint my;
> 
> int
> main ()
> {
>   vol = 5;
>   my = 8;
>   return 0;
> }
>>>>>> End
> 
> gives currently (compiled with stabs debug info)
> typedef int; (Repeated twice)
> typedef volatile int;
> 
> With the patch, I get:
> typedef int;
> typedef int myint;
> typedef volatile int volint;
> 
> Note that the output of 'info var' is not really consistent:
> (gdb) info var
> myint my;
> volatile int vol;
> but this is not changed by my patch, and is the same as before..
> (gdb) ptype my
> type = int
> Here again, the original typedef name is completely lost ...
> 
> Comments welcome,
> 
> Pierre Muller
> Pascal language support maintainer for GDB

I think it's an incremental improvement.

> 
> 2010-06-22  Pierre Muller  <muller@ics.u-strasbg.fr>
> 
>         * c-typeprint.c (c_print_typedef): Append new type name for
> typedefs.
> 
> Index: src/gdb/c-typeprint.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/c-typeprint.c,v
> retrieving revision 1.58
> diff -u -p -r1.58 c-typeprint.c
> --- src/gdb/c-typeprint.c       21 Jun 2010 18:01:50 -0000      1.58
> +++ src/gdb/c-typeprint.c       22 Jun 2010 22:36:06 -0000
> @@ -107,7 +107,8 @@ c_print_typedef (struct type *type, stru
>    type_print (type, "", stream, 0);
>    if (TYPE_NAME ((SYMBOL_TYPE (new_symbol))) == 0
>        || strcmp (TYPE_NAME ((SYMBOL_TYPE (new_symbol))),
> -                SYMBOL_LINKAGE_NAME (new_symbol)) != 0)
> +                SYMBOL_LINKAGE_NAME (new_symbol)) != 0
> +      || TYPE_CODE (SYMBOL_TYPE (new_symbol)) == TYPE_CODE_TYPEDEF)
>      fprintf_filtered (stream, " %s", SYMBOL_PRINT_NAME (new_symbol));
>    fprintf_filtered (stream, ";\n");
>  }
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RFC] display names of explicit typedefs for 'info types'
@ 2010-06-23 15:52 Pierre Muller
  2010-06-23 16:58 ` Michael Snyder
  0 siblings, 1 reply; 4+ messages in thread
From: Pierre Muller @ 2010-06-23 15:52 UTC (permalink / raw)
  To: gdb-patches

  I was always puzzled by the fact that info types
did sometime not list types that I knew existed.
  The problem is that for types defined in C using `typedef '
only the definition part was displayed, but not the name of 
the type itself.

  This small patch fixes that 'mis-feature'...
I was expecting lots of failures in the testsuite,
but was surprised to find no change that I could relate to the patch...

  The following tiny example:
>>>>>Start
typedef volatile int volint;
typedef int myint;

volint vol;
myint my;

int
main ()
{
  vol = 5;
  my = 8;
  return 0;
}
>>>>>End

gives currently (compiled with stabs debug info)
typedef int; (Repeated twice)
typedef volatile int;

With the patch, I get:
typedef int;
typedef int myint;
typedef volatile int volint;

Note that the output of 'info var' is not really consistent:
(gdb) info var
myint my;
volatile int vol;
but this is not changed by my patch, and is the same as before..
(gdb) ptype my
type = int
Here again, the original typedef name is completely lost ...

Comments welcome,

Pierre Muller
Pascal language support maintainer for GDB

2010-06-22  Pierre Muller  <muller@ics.u-strasbg.fr>

        * c-typeprint.c (c_print_typedef): Append new type name for
typedefs.

Index: src/gdb/c-typeprint.c
===================================================================
RCS file: /cvs/src/src/gdb/c-typeprint.c,v
retrieving revision 1.58
diff -u -p -r1.58 c-typeprint.c
--- src/gdb/c-typeprint.c       21 Jun 2010 18:01:50 -0000      1.58
+++ src/gdb/c-typeprint.c       22 Jun 2010 22:36:06 -0000
@@ -107,7 +107,8 @@ c_print_typedef (struct type *type, stru
   type_print (type, "", stream, 0);
   if (TYPE_NAME ((SYMBOL_TYPE (new_symbol))) == 0
       || strcmp (TYPE_NAME ((SYMBOL_TYPE (new_symbol))),
-                SYMBOL_LINKAGE_NAME (new_symbol)) != 0)
+                SYMBOL_LINKAGE_NAME (new_symbol)) != 0
+      || TYPE_CODE (SYMBOL_TYPE (new_symbol)) == TYPE_CODE_TYPEDEF)
     fprintf_filtered (stream, " %s", SYMBOL_PRINT_NAME (new_symbol));
   fprintf_filtered (stream, ";\n");
 }

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-06-25  7:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <37197.5782713436$1277308354@news.gmane.org>
2010-06-24 16:56 ` [RFC] display names of explicit typedefs for 'info types' Tom Tromey
2010-06-25  7:36   ` Pierre Muller
2010-06-23 15:52 Pierre Muller
2010-06-23 16:58 ` Michael Snyder

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).