public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* ptype output for multi-dimensional arrays using CTF
@ 2021-09-03 14:00 Indu Bhagat
  2021-09-03 14:13 ` Indu Bhagat
  0 siblings, 1 reply; 3+ messages in thread
From: Indu Bhagat @ 2021-09-03 14:00 UTC (permalink / raw)
  To: Weimin Pan; +Cc: gdb-patches

Hello Weimin,

I ran into the following behavior with GDB. It seems like a GDB/CTF issue.

Using gcc/trunk and binutils-gdb/trunk'ish :)

Thanks
Indu

-------------------------

$ cat typedef-array.c
typedef int A[2][3];
A a = {{4, 5, 6}, {7, 8, 9}};
$ gcc -gctf -c typedef-array.c
$ gdb typedef-array.o
...
(gdb) ptype A
type = int [3][2]
(gdb) ptype a
type = int [3][2]

$ objdump --ctf=.ctf typedef-array.o
  ...
   Variables:
     a -> 0x5: (kind 10) A (size 0x18) (aligned at 0x4) -> 0x4: (kind 4) 
int [2][3] (size 0x18) (aligned at 0x4) -> 0x3: (kind 4) int [2] (size 
0x8) (aligned at 0x4) -> 0x1: (kind 1) int (format 0x1) (size 0x4) 
(aligned at 0x4)

   Types:
   ...
     0x5: (kind 10) A (size 0x18) (aligned at 0x4) -> 0x4: (kind 4) int 
[2][3] (size 0x18) (aligned at 0x4) -> 0x3: (kind 4) int [2] (size 0x8) 
(aligned at 0x4) -> 0x1: (kind 1) int (format 0x1) (size 0x4) (aligned 
at 0x4)

As you see, objdump reports the type correctly.

For reference, here's what DWARF gives:

$ gcc -g -c typedef-array.c
$ gdb typedef-array.o

(gdb) ptype A
type = int [2][3]
(gdb) ptype a
type = int [2][3]

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

end of thread, other threads:[~2021-09-03 16:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-03 14:00 ptype output for multi-dimensional arrays using CTF Indu Bhagat
2021-09-03 14:13 ` Indu Bhagat
2021-09-03 16:39   ` Weimin Pan

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