* Re: [PATCH] Debugging Vector Types [not found] <547BC9E3-4C03-4724-8BB5-BB1A99BB3625@apple.com> @ 2005-04-23 0:13 ` Geoffrey Keating 2005-04-23 0:36 ` Devang Patel 0 siblings, 1 reply; 5+ messages in thread From: Geoffrey Keating @ 2005-04-23 0:13 UTC (permalink / raw) To: Devang Patel; +Cc: gcc-patches, gdb Devang Patel <dpatel@apple.com> writes: > GCC encodes Vector Types as an array of N elements (at least, in > STABS format). This means, GDB is not able to distinguish it from a > normal Array. And these may lead to confusing output from GDB. One of > our user reported that for > > vector unsigned char a = (vector unsigned char) ( > 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 ); > > gdb prints > > (gdb) print a > $1 = "\001\002\003\004\005\006\a\b\t\n\v\f\r\016\017\020" > > If following is used > > vector unsigned char a = (vector unsigned char) ( > 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p' ); > > then gdb prints > > (gdb) print a > $1 = "abcdefghijklmnop" > > but, it's not vector! > > If GCC provides GDB some kind of hints then GDB may be able to > display something meaningful. This patch attaches "attribute vector" > to the stabs string used to represent vector types. I am told that > GDB ignores attributes that it does not recognize. So we can update > GCC independently. I tested small test cases and our darwin GDB does > not get offended by this additional attribute. > > * dbxout.c (dbxout_type): Emit attribute vector. > * config/darwin.h (DBX_USE_VECTOR_ATTRIBUTE): Define. > * doc/tm.texi (DBX_USE_VECTOR_ATTRIBUTE): Document. > > * gcc.dg/stabs-attrib-vect.c: New test. > > Bootstrapped and tested on powerpc-darwin. > OK for mainline ? - I don't think this should be Darwin-specific. Shouldn't everyone have it? It's not like it can break Solaris dbx or something, unless people are using vector types, in which case IMO they should just use GDB. - You need to update stabs.texi, which I think lives in GDB. (It's the only stabs documentation we have, so keeping it up-to-date is important!) Other than that the patch seems reasonable enough to me. The GDB people may have some more comments, so I've CCed them. GDB people: As I understand the patch, what it does is add '@V;' to the end to the stab for the type, so it looks like "vi:(0,16)=@V;". ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Debugging Vector Types 2005-04-23 0:13 ` [PATCH] Debugging Vector Types Geoffrey Keating @ 2005-04-23 0:36 ` Devang Patel 2005-04-23 0:51 ` Geoff Keating 0 siblings, 1 reply; 5+ messages in thread From: Devang Patel @ 2005-04-23 0:36 UTC (permalink / raw) To: Geoffrey Keating; +Cc: gcc-patches, gdb On Apr 22, 2005, at 5:14 PM, Geoffrey Keating wrote: > Devang Patel <dpatel@apple.com> writes: > >> GCC encodes Vector Types as an array of N elements (at least, in >> STABS format). This means, GDB is not able to distinguish it from a >> normal Array. And these may lead to confusing output from GDB. One of >> our user reported that for >> >> vector unsigned char a = (vector unsigned char) ( >> 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 ); >> >> gdb prints >> >> (gdb) print a >> $1 = "\001\002\003\004\005\006\a\b\t\n\v\f\r\016\017\020" >> >> If following is used >> >> vector unsigned char a = (vector unsigned char) ( >> 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p' ); >> >> then gdb prints >> >> (gdb) print a >> $1 = "abcdefghijklmnop" >> >> but, it's not vector! >> >> If GCC provides GDB some kind of hints then GDB may be able to >> display something meaningful. This patch attaches "attribute vector" >> to the stabs string used to represent vector types. I am told that >> GDB ignores attributes that it does not recognize. So we can update >> GCC independently. I tested small test cases and our darwin GDB does >> not get offended by this additional attribute. >> >> * dbxout.c (dbxout_type): Emit attribute vector. >> * config/darwin.h (DBX_USE_VECTOR_ATTRIBUTE): Define. >> * doc/tm.texi (DBX_USE_VECTOR_ATTRIBUTE): Document. >> >> * gcc.dg/stabs-attrib-vect.c: New test. >> >> Bootstrapped and tested on powerpc-darwin. >> OK for mainline ? > > - I don't think this should be Darwin-specific. Shouldn't everyone > have it? > It's not like it can break Solaris dbx or something, unless > people are > using vector types, in which case IMO they should just use GDB. I was just playing safe. > - You need to update stabs.texi, which I think lives in GDB. (It's > the only stabs documentation we have, so keeping it up-to-date is > important!) The doc version I have already lists it as an extension. --- > There is an AIX extension for type attributes. Following the `=' > are any number of type attributes. Each one starts with `@' and > ends with `;'. Debuggers, including AIX's dbx and GDB 4.10, skip > any type attributes they do not recognize. GDB 4.9 and other > versions of dbx may not do this. Because of a conflict with C++ > (see section GNU C++ Stabs), new attributes should not be defined > which begin with a digit, `(', or `-'; GDB may be unable to > distinguish those from the C++ type descriptor `@'. The attributes > are: > > aboundary > boundary is an integer specifying the alignment. I assume it > applies to all variables of this type. > pinteger > Pointer class (for checking). Not sure what this means, or how > integer is interpreted. > P > Indicate this is a packed type, meaning that structure fields or > array elements are placed more closely in memory, to save memory at > the expense of speed. > ssize > Size in bits of a variable of this type. This is fully supported by > GDB 4.11 and later. > S > Indicate that this type is a string instead of an array of > characters, or a bitstring instead of a set. It doesn't change the > layout of the data being represented, but does enable the debugger > to know which type it is. > V > Indicate that this type is a vector instead of an array. The only > major difference between vectors and arrays is that vectors are > passed by value instead of by reference (vector coprocessor > extension). --- > Other than that the patch seems reasonable enough to me. > > The GDB people may have some more comments, so I've CCed them. > > GDB people: As I understand the patch, what it does is add '@V;' to > the end to the stab for the type, so it looks like "vi:(0,16)=@V;". - Devang ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Debugging Vector Types 2005-04-23 0:36 ` Devang Patel @ 2005-04-23 0:51 ` Geoff Keating 2005-04-24 22:35 ` Daniel Jacobowitz 0 siblings, 1 reply; 5+ messages in thread From: Geoff Keating @ 2005-04-23 0:51 UTC (permalink / raw) To: Devang Patel; +Cc: gcc-patches, gdb On 22/04/2005, at 5:36 PM, Devang Patel wrote: > > On Apr 22, 2005, at 5:14 PM, Geoffrey Keating wrote: > >> - I don't think this should be Darwin-specific. Shouldn't everyone >> have it? >> It's not like it can break Solaris dbx or something, unless people >> are >> using vector types, in which case IMO they should just use GDB. > > I was just playing safe. I don't think there's any reason to (but if anyone else does, speak up!) Could you send a version of the patch which adds the extension for every platform? Then wait until, say, Tuesday so that people have a chance to object, and if there are no objections you can just commit it. >> - You need to update stabs.texi, which I think lives in GDB. (It's >> the only stabs documentation we have, so keeping it up-to-date is >> important!) > > The doc version I have already lists it as an extension. Excellent, then there's no need for any changes there. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Debugging Vector Types 2005-04-23 0:51 ` Geoff Keating @ 2005-04-24 22:35 ` Daniel Jacobowitz 2005-04-25 2:19 ` Devang Patel 0 siblings, 1 reply; 5+ messages in thread From: Daniel Jacobowitz @ 2005-04-24 22:35 UTC (permalink / raw) To: Geoff Keating; +Cc: Devang Patel, gcc-patches, gdb On Fri, Apr 22, 2005 at 05:52:14PM -0700, Geoff Keating wrote: > I don't think there's any reason to (but if anyone else does, speak up!) I agree; please don't make this Darwin-specific. > >>- You need to update stabs.texi, which I think lives in GDB. (It's > >> the only stabs documentation we have, so keeping it up-to-date is > >> important!) > > > >The doc version I have already lists it as an extension. > > Excellent, then there's no need for any changes there. Yes, in fact GDB already accepts this attribute for stabs. -- Daniel Jacobowitz CodeSourcery, LLC ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Debugging Vector Types 2005-04-24 22:35 ` Daniel Jacobowitz @ 2005-04-25 2:19 ` Devang Patel 0 siblings, 0 replies; 5+ messages in thread From: Devang Patel @ 2005-04-25 2:19 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: Geoff Keating, gcc-patches, gdb [-- Attachment #1: Type: text/plain, Size: 784 bytes --] On Apr 24, 2005, at 3:35 PM, Daniel Jacobowitz wrote: > On Fri, Apr 22, 2005 at 05:52:14PM -0700, Geoff Keating wrote: >> I don't think there's any reason to (but if anyone else does, >> speak up!) > > I agree; please don't make this Darwin-specific. > >>>> - You need to update stabs.texi, which I think lives in GDB. (It's >>>> the only stabs documentation we have, so keeping it up-to-date is >>>> important!) >>> >>> The doc version I have already lists it as an extension. >> >> Excellent, then there's no need for any changes there. > > Yes, in fact GDB already accepts this attribute for stabs. OK. I'll check-in this smaller patch tomorrow. * dbxout.c (dbxout_type): Emit attribute vector. * gcc.dg/stabs-attrib-vect-darwin.c: New test. - Devang [-- Attachment #2: stabs_vector.take2.diff --] [-- Type: application/octet-stream, Size: 2499 bytes --] Index: dbxout.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/dbxout.c,v retrieving revision 1.227 diff -Idpatel.pbxuser -c -3 -p -r1.227 dbxout.c *** dbxout.c 12 Apr 2005 20:39:04 -0000 1.227 --- dbxout.c 25 Apr 2005 02:11:19 -0000 *************** dbxout_type (tree type, int full) *** 1652,1662 **** tree tem; tree main_variant; static int anonymous_type_number = 0; if (TREE_CODE (type) == VECTOR_TYPE) ! /* The frontend feeds us a representation for the vector as a struct ! containing an array. Pull out the array type. */ ! type = TREE_TYPE (TYPE_FIELDS (TYPE_DEBUG_REPRESENTATION_TYPE (type))); /* If there was an input error and we don't really have a type, avoid crashing and write something that is at least valid --- 1652,1666 ---- tree tem; tree main_variant; static int anonymous_type_number = 0; + bool vector_type = false; if (TREE_CODE (type) == VECTOR_TYPE) ! { ! /* The frontend feeds us a representation for the vector as a struct ! containing an array. Pull out the array type. */ ! type = TREE_TYPE (TYPE_FIELDS (TYPE_DEBUG_REPRESENTATION_TYPE (type))); ! vector_type = true; ! } /* If there was an input error and we don't really have a type, avoid crashing and write something that is at least valid *************** dbxout_type (tree type, int full) *** 1991,1996 **** --- 1995,2006 ---- break; } + if (vector_type) + { + have_used_extensions = 1; + stabstr_S ("@V;"); + } + /* Output "a" followed by a range type definition for the index type of the array followed by a reference to the target-type. Index: testsuite/gcc.dg/stabs-attrib-vect-darwin.c =================================================================== RCS file: testsuite/gcc.dg/stabs-attrib-vect-darwin.c diff -N testsuite/gcc.dg/stabs-attrib-vect-darwin.c *** /dev/null 1 Jan 1970 00:00:00 -0000 --- testsuite/gcc.dg/stabs-attrib-vect-darwin.c 25 Apr 2005 02:11:21 -0000 *************** *** 0 **** --- 1,11 ---- + /* Test Attribute Vector associated with vectory type stabs. */ + /* { dg-do compile { target powerpc*-*-darwin* } } */ + /* { dg-options "-gstabs -fno-eliminate-unused-debug-types -faltivec" } */ + + int main () + { + vector int vi = { 6,7,8,9 }; + return 0; + } + + /* { dg-final { scan-assembler ".stabs.*vi\:\\(0,16\\)=\@V" } } */ Index: testsuite/gcc.dg/stabs-attrib-vect.c [-- Attachment #3: Type: text/plain, Size: 1 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-04-25 2:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <547BC9E3-4C03-4724-8BB5-BB1A99BB3625@apple.com>
2005-04-23 0:13 ` [PATCH] Debugging Vector Types Geoffrey Keating
2005-04-23 0:36 ` Devang Patel
2005-04-23 0:51 ` Geoff Keating
2005-04-24 22:35 ` Daniel Jacobowitz
2005-04-25 2:19 ` Devang Patel
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox