aboutsummaryrefslogtreecommitdiff
path: root/gdb/c-lang.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2022-11-07 11:12:35 -0700
committerTom Tromey <tromey@adacore.com>2022-11-09 08:37:25 -0700
commit97e20099d3b02baafe244e975aebe09020d2ab34 (patch)
tree5209412e4df7a000e496de0c190b142ad89d2064 /gdb/c-lang.c
parentc2264c8f78f353daebce3086ae52b3c1cf2f0a8d (diff)
downloadgdb-97e20099d3b02baafe244e975aebe09020d2ab34.zip
gdb-97e20099d3b02baafe244e975aebe09020d2ab34.tar.gz
gdb-97e20099d3b02baafe244e975aebe09020d2ab34.tar.bz2
Allow 'ptype/o' for assembly
PR exp/28359 points out that 'ptype/o' does not work when the current language is "asm". I tracked this down to a hard-coded list of languages in typeprint.c. This patch replaces this list with a method on 'language_defn' instead. If all languages are ever updated to have this feature, the method could be removed; but in the meantime this lets each language control what happens. I looked at having each print_type method simply modify the flags itself, but this doesn't work very well with the feature that disables method-printing by default (but allows it via a flag). Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28359 Approved-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Keith Seitz <keiths@redhat.com>
Diffstat (limited to 'gdb/c-lang.c')
-rw-r--r--gdb/c-lang.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 36b4d1a..e15541f 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -816,6 +816,13 @@ public:
/* See language.h. */
+ bool can_print_type_offsets () const override
+ {
+ return true;
+ }
+
+ /* See language.h. */
+
void print_type (struct type *type, const char *varstring,
struct ui_file *stream, int show, int level,
const struct type_print_options *flags) const override
@@ -966,6 +973,13 @@ public:
/* See language.h. */
+ bool can_print_type_offsets () const override
+ {
+ return true;
+ }
+
+ /* See language.h. */
+
void print_type (struct type *type, const char *varstring,
struct ui_file *stream, int show, int level,
const struct type_print_options *flags) const override
@@ -1066,6 +1080,13 @@ public:
/* See language.h. */
+ bool can_print_type_offsets () const override
+ {
+ return true;
+ }
+
+ /* See language.h. */
+
void print_type (struct type *type, const char *varstring,
struct ui_file *stream, int show, int level,
const struct type_print_options *flags) const override
@@ -1118,6 +1139,13 @@ public:
/* See language.h. */
+ bool can_print_type_offsets () const override
+ {
+ return true;
+ }
+
+ /* See language.h. */
+
void print_type (struct type *type, const char *varstring,
struct ui_file *stream, int show, int level,
const struct type_print_options *flags) const override