Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Michael Haupt <m@haupz.de>
Cc: "gdb@sourceware.org" <gdb@sourceware.org>
Subject: Re: debugging custom array types
Date: Mon, 11 Feb 2013 17:02:00 -0000	[thread overview]
Message-ID: <20130211170221.GA16645@host2.jankratochvil.net> (raw)
In-Reply-To: <AF075507-9C9E-4D7A-A747-589E0074057E@haupz.de>

On Mon, 11 Feb 2013 17:51:36 +0100, Michael Haupt wrote:
> The internal layout of an array instance is as follows:
> +0    hub reference (reference to meta-information, e.g., class, vtable, ...)
> +8    length
> +12   beginning of array contents (offset depends on type, 12 is for char, for instance)

THis means the type length is stored in inferior memory.  I call it 'dynamic
type', FSF GDB does not support it, it is supported in
archer-jankratochvil-vla from
	http://sourceware.org/gdb/wiki/ArcherBranchManagement
or in any Fedora GDB.

But FSF GDB generally displays such arrays as pointers instead:

34	foo (int size) {
36	  char temp1[size];
FSF GDB:
(gdb) p temp1
$1 = 0x7fffffffd9e0 "XXX"
(gdb) ptype temp1
type = char []
archer-jankratochvil-vla:
(gdb) p temp1
$1 = "XXX"
(gdb) ptype temp1
type = char [26]


> The DWARF I'm generating right now looks as pasted at the end of this message.

Could you display it with GNU binutils "readelf -wi"?  There aren't the DWARF
expressions decoded so it is not easy to read what you have there.

BTW such dynamic types are in the archer-jankratochvil-vla branch above, for a
simple one see gdb.base/vla.exp.

 <1><12c>: Abbrev Number: 11 (DW_TAG_array_type)
    <12d>   DW_AT_type        : <0x49>  
 <2><135>: Abbrev Number: 12 (DW_TAG_subrange_type)
    <136>   DW_AT_type        : <0x34>  
    <13a>   DW_AT_upper_bound : 3 byte block: 91 48 6   (DW_OP_fbreg: -56; DW_OP_deref)
 <2><13e>: Abbrev Number: 0



Regards,
Jan


  reply	other threads:[~2013-02-11 17:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-11 16:51 Michael Haupt
2013-02-11 17:02 ` Jan Kratochvil [this message]
2013-02-13 10:50   ` Michael Haupt
2013-02-13 17:52     ` Tom Tromey
2013-02-14 13:27       ` Michael Haupt
2013-02-14 16:51         ` Tom Tromey
2013-02-13 17:59     ` Jan Kratochvil
2013-02-14 13:37       ` Michael Haupt
2013-02-14 13:44         ` Jan Kratochvil
2013-02-12 19:28 ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130211170221.GA16645@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb@sourceware.org \
    --cc=m@haupz.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox