From mboxrd@z Thu Jan 1 00:00:00 1970 From: RDBrown@mira.net To: gdb@sources.redhat.com Subject: perl script for struct offsets etc Date: Wed, 24 Jan 2001 14:18:00 -0000 Message-id: X-SW-Source: 2001-01/msg00170.html The enclosed perl script generates a gdb command script from ptype output that shows the byte offset, length in bytes and cumulative fill byte count for each field of the class or structure. Where class/structure ordering isn't imposed, the output could be used to argue for an ordering that pushes alignment fill to the end or brings frequently referenced fields together for `better' cache usage. Any scripting support added to gdb should be able to do something like this directly. 501 /devel/spanopen/700 % gdb libff/librds.so GNU gdb 19990928 Copyright 1998 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu"... (gdb) ptype sql_proccolinfo_t type = class sql_proccolinfo_t { private: dh_i16_t dtor_flag; hm_hdl_t *hm_curhdl; public: slink sl; dh_u16_t pci_proccolid; procid_t pci_procid; tpe_rssid_t pci_rssid; char pci_col[36]; char pci_datatype[36]; typeid_t pci_typeid; sql_proccoltype_t pci_coltype; dh_i32_t pci_width; dh_i32_t pci_scale; dh_boolean pci_nonull; sql_dflt_t pci_dflttp; dh_char_t *pci_default; sql_proccolinfo_t & operator=(sql_proccolinfo_t const &); sql_proccolinfo_t(sql_proccolinfo_t const &); static void * operator new(unsigned int); static void * operator new(unsigned int, hm_hdl_t *); static void operator delete(void *); sql_proccolinfo_t(alloctype_t); sql_proccolinfo_t(hm_hdl_t *, alloctype_t); ~sql_proccolinfo_t(void); } (gdb) shell # xterm cut & paste 501 /devel/spanopen/700 % perl gdboff.pl > gdb.proccolinfo_t < type = class sql_proccolinfo_t { > private: > dh_i16_t dtor_flag; > hm_hdl_t *hm_curhdl; > public: > slink sl; > dh_u16_t pci_proccolid; > procid_t pci_procid; > tpe_rssid_t pci_rssid; > char pci_col[36]; > char pci_datatype[36]; > typeid_t pci_typeid; > sql_proccoltype_t pci_coltype; > dh_i32_t pci_width; > dh_i32_t pci_scale; > dh_boolean pci_nonull; > sql_dflt_t pci_dflttp; > dh_char_t *pci_default; > > sql_proccolinfo_t & operator=(sql_proccolinfo_t const &); > sql_proccolinfo_t(sql_proccolinfo_t const &); > static void * operator new(unsigned int); > static void * operator new(unsigned int, hm_hdl_t *); > static void operator delete(void *); > sql_proccolinfo_t(alloctype_t); > sql_proccolinfo_t(hm_hdl_t *, alloctype_t); > ~sql_proccolinfo_t(void); > } > EOF 502 /devel/spanopen/700 % exit # Leading `>'-s from bash. exit (gdb) source gdb.proccolinfo_t sizeof(sql_proccolinfo_t) 128 sql_proccolinfo_t.dtor_flag 0 2 0 sql_proccolinfo_t.hm_curhdl 4 4 2 sql_proccolinfo_t.sl 8 8 2 sql_proccolinfo_t.pci_proccolid 16 2 2 sql_proccolinfo_t.pci_procid 20 4 4 sql_proccolinfo_t.pci_rssid 24 4 4 sql_proccolinfo_t.pci_col 28 36 4 sql_proccolinfo_t.pci_datatype 64 36 4 sql_proccolinfo_t.pci_typeid 100 4 4 sql_proccolinfo_t.pci_coltype 104 4 4 sql_proccolinfo_t.pci_width 108 4 4 sql_proccolinfo_t.pci_scale 112 4 4 sql_proccolinfo_t.pci_nonull 116 1 4 sql_proccolinfo_t.pci_dflttp 120 4 7 sql_proccolinfo_t.pci_default 124 4 7 (gdb) q 502 /devel/spanopen/700 % exit # Generate a gdb script to display offset, length and cumulative fill bytes # for each field of a class or struct, # from the gdb ptype output of the class or struct. # eg #sizeof(xyz) 128 #xyz.dtor_flag 0 2 0 #xyz.hm_curhdl 4 4 2 # ... while (<>) { if (/^type = (?:class|struct) (\w+) {\s*$/) { $the_type = $1; printf "printf \"sizeof(%s)\\t%%d\\n\", sizeof(%s)\n", $the_type, $the_type; printf "set variable \$cumlen = 0\n"; } if (defined($the_type)) { if (/^}\s*$/) { undef $the_type; } elsif (/^(?:| p(?:rivate|public):)\s*$/) { } elsif (/ \**(\w+)(?:|\[\d+\]);\s*$/) { my($the_field) = $1; printf "set variable \$offset = (int)(&(((%s *)0)->%s))\nset variable \$fieldlen = sizeof(((%s *)0)->%s)\nprintf \"%s.%s\\t%%d\\t%%d\\t%%d\\n\", \$offset, \$fieldlen, \$offset - \$cumlen\nset variable \$cumlen += \$fieldlen\n", $the_type, $the_field, $the_type, $the_field, $the_type, $the_field; } elsif (/(?:[^; ]|\);)\s*$/) { } } } >From micrio@mv.com Wed Jan 24 19:01:00 2001 From: "Peter Reilley" To: Cc: "Jim MacGregor" Subject: Re: JTAG debug support for ARM Date: Wed, 24 Jan 2001 19:01:00 -0000 Message-id: <005901c0867b$1a696cb0$05d145cc@ppro> X-SW-Source: 2001-01/msg00171.html Content-length: 2262 There is nothing illegal about this site. I have done most of the Linux and Solaris code on this site. If you doubt this, ask them at their regular site www.macraigor.com The Wiggler is not supported under Linux and Solaris. The Wiggler is supported under Windows. Under Linux and Solaris the Raven and Ethernet products are supported. The site is still a work in progress so everything is not there yet but keep checking. Pete. -----Original Message----- From: Friedrich Beckmann To: gdb@sources.redhat.com Date: Wednesday, January 24, 2001 5:33 PM Subject: JTAG debug support for ARM >Hi, > >i have found a site http://www.ocdemon.com which offers the gnu >toolchain with support for wiggler/raven JTAG interfaces. I have not >tested this and would like to know if anybody has some experience with >this. The sources for the Wiggler drivers are not included in the >distribution. >Is there any person related to this site? I cannot find any name on the >sites pages. >Is there something illegal behind this? > >As far as I have figured it out, the standard gdb release supports the >ARM RDI interface. This requires the ANGEL software installed >(and is then connected via a serial interface). > >Optionally the OLD EmbeddedICE Box which can interpret the RDI commands >to JTAG >commands can be used. The new MultiICE debug box from ARM requires >software support on the host which is not available for linux at the >moment. > >There is a configure option --multi-ice in the gdb release which >lets me assume that the commercial GnuPRO tools from Redhat >have support for the MultiICE. The multi-ice-gdbserver seems not to >be under GNU license. > >The JEENI JTAG interface from http://www.episupport.com seems understand >the RDI commands >directly as the ARM EmbeddedICE does. So this is also usabled via the >gdi rdi interface. > > http://www.abatron.ch also offers a JTAG interface but with a dedicated >gdb driver >software for linux. gdb. > >Is anybody using the wiggler with gdb for the ARM7? > >Which software are you using? > >Is anybody out there who is putting effort in writing a GNU-licensed >remote interface >for a low-cost JTAG interface like the wiggler? > >Friedrich > > > >