Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* gdb.cp/userdef.exp, class reprensentation
@ 2008-10-13 11:39 Denis PILAT
  2008-10-13 11:52 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Denis PILAT @ 2008-10-13 11:39 UTC (permalink / raw)
  To: gdb-patches

Hi all
In gdb.cp/userdef.cc, you have the following class:

class Member
{
public:
  int z;
};


Which is semantically equivalent to the following and also printed like 
that using ptype.

struct Member {
    int z;
}


But the userdef.exp testsuite only expects gdb to return the 2nd 
semantic, which is fine with some gdb based debuggers, but not for all.
Here is a patch that allows both syntax.

Waiting for your feedback,
-- 
Denis

2008-10-13  Denis Pilat  <denis.pilat@st.com>

	* gdb.cp/userdef.exp: add a successful patern for for "ptype &*c".

Index: gdb.cp/userdef.exp
===================================================================
--- gdb.cp/userdef.exp  (revision 710)
+++ gdb.cp/userdef.exp  (working copy)
@@ -153,7 +153,14 @@
 gdb_test "print c" "\\\$\[0-9\]* = {m = {z = .*}}"
 gdb_test "print *c" "\\\$\[0-9\]* = \\(Member &\\) @$hex: {z = .*}"
 gdb_test "print &*c" "\\\$\[0-9\]* = \\(Member \\*\\) $hex"
-gdb_test "ptype &*c" "type = struct Member {\[\r\n \]+int z;\[\r\n\]+} &\\*"
+gdb_test_multiple "ptype &*c" "ptype &*c" {
+    -re "type = struct Member {\[\r\n \]+int z;\[\r\n\]+} &\\*.*$gdb_prompt $" {
+        pass "ptype &*c"
+    }
+    -re "type = class Member {\[\r\n \]+ public:\[\r\n \]+int z;\[\r\n\]+} &\\*.*$gdb_prompt $" {
+        pass "ptype &*c"
+    }
+}







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

* Re: gdb.cp/userdef.exp, class reprensentation
  2008-10-13 11:39 gdb.cp/userdef.exp, class reprensentation Denis PILAT
@ 2008-10-13 11:52 ` Daniel Jacobowitz
  2008-10-13 12:31   ` Denis PILAT
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2008-10-13 11:52 UTC (permalink / raw)
  To: Denis PILAT; +Cc: gdb-patches

On Mon, Oct 13, 2008 at 01:38:36PM +0200, Denis PILAT wrote:
> But the userdef.exp testsuite only expects gdb to return the 2nd  
> semantic, which is fine with some gdb based debuggers, but not for all.

What does "some gdb based debuggers" mean?  The testsuite is supposed
to accomodate the version of GDB it's shipped with, not other
versions.

> @@ -153,7 +153,14 @@
> gdb_test "print c" "\\\$\[0-9\]* = {m = {z = .*}}"

Also, this is whitespace-damaged.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: gdb.cp/userdef.exp, class reprensentation
  2008-10-13 11:52 ` Daniel Jacobowitz
@ 2008-10-13 12:31   ` Denis PILAT
  0 siblings, 0 replies; 3+ messages in thread
From: Denis PILAT @ 2008-10-13 12:31 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1173 bytes --]



Daniel Jacobowitz wrote:
> On Mon, Oct 13, 2008 at 01:38:36PM +0200, Denis PILAT wrote:
>   
>> But the userdef.exp testsuite only expects gdb to return the 2nd  
>> semantic, which is fine with some gdb based debuggers, but not for all.
>>     
>
> What does "some gdb based debuggers" mean?  The testsuite is supposed
> to accomodate the version of GDB it's shipped with, not other
> versions.
>   
I would have talked about compiler generated information. I have a 
compiler that generates debug information so that gdb prints this class 
as a class, and not a struct!
The target is not a native one but an internal ST one, but I guess that 
there are other targeted gdbs that behave the same, and this behavior is 
correct to me! My patch was just to let some gdbs avoid an error in the 
testsuite that is not a real error, unless there is a consensus that 
tells simple class must be represented as structures.

>   
>> @@ -153,7 +153,14 @@
>> gdb_test "print c" "\\\$\[0-9\]* = {m = {z = .*}}"
>>     
>
> Also, this is whitespace-damaged.
>   
Sorry, I don't see it, I re-attach my patch as a real attachment, may be 
my mailer did something wrong

-- 
Denis






[-- Attachment #2: userdef.exp.patch --]
[-- Type: text/plain, Size: 922 bytes --]

2008-10-13  Denis Pilat  <denis.pilat@st.com>

    * gdb.cp/userdef.exp: add a successful patern for for "ptype &*c". 

--- userdef.exp	2008-01-10 13:44:46.000000000 +0100
+++ /local/pd10/sts-gdb/trunk/sts-gdb/src/gdb/testsuite/gdb.cp/userdef.exp	2008-10-13 13:32:36.000000000 +0200
@@ -153,7 +153,14 @@ gdb_test "break A2::'operator +'" ".*Bre
 gdb_test "print c" "\\\$\[0-9\]* = {m = {z = .*}}"
 gdb_test "print *c" "\\\$\[0-9\]* = \\(Member &\\) @$hex: {z = .*}"
 gdb_test "print &*c" "\\\$\[0-9\]* = \\(Member \\*\\) $hex"
-gdb_test "ptype &*c" "type = struct Member {\[\r\n \]+int z;\[\r\n\]+} &\\*"
+gdb_test_multiple "ptype &*c" "ptype &*c" {
+    -re "type = struct Member {\[\r\n \]+int z;\[\r\n\]+} &\\*.*$gdb_prompt $" {
+        pass "ptype &*c"
+    }
+    -re "type = class Member {\[\r\n \]+ public:\[\r\n \]+int z;\[\r\n\]+} &\\*.*$gdb_prompt $" {
+        pass "ptype &*c"
+    }
+}
 
 gdb_exit
 return 0

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

end of thread, other threads:[~2008-10-13 12:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-13 11:39 gdb.cp/userdef.exp, class reprensentation Denis PILAT
2008-10-13 11:52 ` Daniel Jacobowitz
2008-10-13 12:31   ` Denis PILAT

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