public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/30204] New: RFE add an option to to ptype to print the decl file and decl line for a type
@ 2023-03-06 18:32 woodard at redhat dot com
2023-03-07 14:13 ` [Bug gdb/30204] " tromey at sourceware dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: woodard at redhat dot com @ 2023-03-06 18:32 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30204
Bug ID: 30204
Summary: RFE add an option to to ptype to print the decl file
and decl line for a type
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: woodard at redhat dot com
Target Milestone: ---
Sometimes when you are looking at a type it is hard to figure out where that
declaration actually came from. This is included in the DWARF, can you print it
out. Maybe add a flag to ptype that does this:
(gdb) help ptype
Print definition of type TYPE.
Usage: ptype[/FLAGS] TYPE | EXPRESSION
Argument may be any type (for example a type name defined by typedef,
or "struct STRUCT-TAG" or "class CLASS-NAME" or "union UNION-TAG"
or "enum ENUM-TAG") or an expression.
The selected stack frame's lexical context is used to look up the name.
Contrary to "whatis", "ptype" always unrolls any typedefs.
Available FLAGS are:
/r print in "raw" form; do not substitute typedefs
/m do not print methods defined in a class
/M print methods defined in a class
/t do not print typedefs defined in a class
/T print typedefs defined in a class
/o print offsets and sizes of fields in a struct (like pahole)
like /l include declaration file and line
according to fche this could probably be added to whatis_exp() in typeprint.c
if gdb's struct type in gdbtypes.h was modified to add the declfile and the
declline attributes.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug gdb/30204] RFE add an option to to ptype to print the decl file and decl line for a type
2023-03-06 18:32 [Bug gdb/30204] New: RFE add an option to to ptype to print the decl file and decl line for a type woodard at redhat dot com
@ 2023-03-07 14:13 ` tromey at sourceware dot org
2023-03-07 15:34 ` ssbssa at sourceware dot org
2023-03-08 0:54 ` woodard at redhat dot com
2 siblings, 0 replies; 4+ messages in thread
From: tromey at sourceware dot org @ 2023-03-07 14:13 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30204
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org
See Also| |https://sourceware.org/bugz
| |illa/show_bug.cgi?id=11796
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug gdb/30204] RFE add an option to to ptype to print the decl file and decl line for a type
2023-03-06 18:32 [Bug gdb/30204] New: RFE add an option to to ptype to print the decl file and decl line for a type woodard at redhat dot com
2023-03-07 14:13 ` [Bug gdb/30204] " tromey at sourceware dot org
@ 2023-03-07 15:34 ` ssbssa at sourceware dot org
2023-03-08 0:54 ` woodard at redhat dot com
2 siblings, 0 replies; 4+ messages in thread
From: ssbssa at sourceware dot org @ 2023-03-07 15:34 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30204
Hannes Domani <ssbssa at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ssbssa at sourceware dot org
--- Comment #1 from Hannes Domani <ssbssa at sourceware dot org> ---
Have you tried `info types`?
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug gdb/30204] RFE add an option to to ptype to print the decl file and decl line for a type
2023-03-06 18:32 [Bug gdb/30204] New: RFE add an option to to ptype to print the decl file and decl line for a type woodard at redhat dot com
2023-03-07 14:13 ` [Bug gdb/30204] " tromey at sourceware dot org
2023-03-07 15:34 ` ssbssa at sourceware dot org
@ 2023-03-08 0:54 ` woodard at redhat dot com
2 siblings, 0 replies; 4+ messages in thread
From: woodard at redhat dot com @ 2023-03-08 0:54 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30204
--- Comment #2 from Ben Woodard <woodard at redhat dot com> ---
"info types REGEX" can do what I need in many cases. However, it becomes rather
unhandy in C++ code where the number of types can be astronomically large. It
also doesn't associate it with a variable in the particular context the way
that ptype does. This can be particularly confusing when you have ABI
compatible but polymorphic C types defined differently in different compilation
units. For example a few days ago I was dealing with four different versions of
struct _Unwind_Context and the type changed depending on which function I
happened to be in. It was hard to know which one of the various versions of the
type I was using at any given time. That is why I think it would be nice if you
could do something like:
ptype/l variable and it would print the declaration file and line number in
addition to the normal output of ptype.
I do not have any particular attachment to /l in particular, I was thinking
"declaration location" 'l' for location but it could be 'd' for declaration or
something else that makes sense to people.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-03-08 0:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-06 18:32 [Bug gdb/30204] New: RFE add an option to to ptype to print the decl file and decl line for a type woodard at redhat dot com
2023-03-07 14:13 ` [Bug gdb/30204] " tromey at sourceware dot org
2023-03-07 15:34 ` ssbssa at sourceware dot org
2023-03-08 0:54 ` woodard at redhat dot com
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).