Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] Fix gdb-gdb.py for flds_bnds copy-pastes
@ 2012-02-09  9:28 Jan Kratochvil
  2012-02-09  9:32 ` [no-commit-intention] Naive unnamed fields for main_type [Re: [patch] Fix gdb-gdb.py for flds_bnds copy-pastes] Jan Kratochvil
  2012-02-09 15:12 ` [patch] Fix gdb-gdb.py for flds_bnds copy-pastes Joel Brobecker
  0 siblings, 2 replies; 16+ messages in thread
From: Jan Kratochvil @ 2012-02-09  9:28 UTC (permalink / raw)
  To: gdb-patches; +Cc: Joel Brobecker

Hi,

one such a longstanding pain - accessing pretty-printed field name does not
work:

(gdb) p *type.main_type
$2 = 
{name = 0x0,
[...]
 field[0]:
 ########
  {name = 0x2115978 "i",
[...]
   bitpos = 0},
 cplus_stuff = 0xf33b80}
(gdb) p/r *type.main_type
$3 = {code = TYPE_CODE_STRUCT, [...]
  target_type = 0x0, flds_bnds = {fields = 0x21161f0, bounds = 0x21161f0},
                     ####################################################
  [...], func_stuff = 0xf33b80}}
(gdb) p type.main_type.field[0]
                       ########
There is no member named field.
###############################
(gdb) p type.main_type.fields[0]
                       #########
There is no member named fields.
################################
(gdb) p type.main_type.flds_bnds.fields[0]
                       ###################
$3 = {loc = {bitpos = 0, physaddr = 0, [...], name = 0x2115978 "i"}

Probably clear to check it in.  I had to `print/r' to suppress gdb-gdb.py to
ba able to access GDB types fields.


Thanks,
Jan


gdb/
2012-02-09  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb-gdb.py (StructMainTypePrettyPrinter) <struct_field_img>: Print
	flds_bnds.fields.
	(StructMainTypePrettyPrinter) <bounds_img>: Print flds_bnds.bounds.

--- a/gdb/gdb-gdb.py
+++ b/gdb/gdb-gdb.py
@@ -166,7 +166,7 @@ class StructMainTypePrettyPrinter:
         """Return an image of the main_type field number FIELDNO.
         """
         f = self.val['flds_bnds']['fields'][fieldno]
-        label = "field[%d]:" % fieldno
+        label = "flds_bnds.fields[%d]:" % fieldno
         if f['artificial']:
             label += " (artificial)"
         fields = []
@@ -186,7 +186,7 @@ class StructMainTypePrettyPrinter:
         high = str(b['high'])
         if b['high_undefined'] != 0:
             high += " (undefined)"
-        return "bounds = {%s, %s}" % (low, high)
+        return "flds_bnds.bounds = {%s, %s}" % (low, high)
     def type_specific_img(self):
         """Return a string image of the main_type type_specific union.
         Only the relevant component of that union is printed (based on


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

end of thread, other threads:[~2012-02-12 19:23 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-09  9:28 [patch] Fix gdb-gdb.py for flds_bnds copy-pastes Jan Kratochvil
2012-02-09  9:32 ` [no-commit-intention] Naive unnamed fields for main_type [Re: [patch] Fix gdb-gdb.py for flds_bnds copy-pastes] Jan Kratochvil
2012-02-09 15:16   ` Joel Brobecker
2012-02-09 15:37     ` Jan Kratochvil
2012-02-09 18:56       ` Eli Zaretskii
2012-02-10 18:05       ` Tom Tromey
2012-02-10 19:01         ` Jan Kratochvil
2012-02-10 19:22           ` Tom Tromey
2012-02-10 19:29             ` Jan Kratochvil
2012-02-12 10:20             ` Mark Kettenis
2012-02-12 19:23               ` Jan Kratochvil
2012-02-09 19:07     ` Alfred M. Szmidt
2012-02-09 19:23     ` Stan Shebs
2012-02-10 18:07       ` Tom Tromey
2012-02-09 15:12 ` [patch] Fix gdb-gdb.py for flds_bnds copy-pastes Joel Brobecker
2012-02-09 15:15   ` [commit] " Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox