Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] xstormy16-tdep.c: Set chars to unsigned
@ 2003-03-25 16:18 Corinna Vinschen
  2003-03-25 16:28 ` Andrew Cagney
  0 siblings, 1 reply; 7+ messages in thread
From: Corinna Vinschen @ 2003-03-25 16:18 UTC (permalink / raw)
  To: gdb-patches

Hi,

I've applied the below patch to xstormy16-tdep.  It resolves the FAILs
in charset.exp due to the different opinion of gdb and the xstormy16
target about sign of characters.

Corinna


2003-03-25  Corinna Vinschen  <vinschen@redhat.com>

        * xstormy16-tdep.c (xstormy16_gdbarch_init): Add call to
        set_gdbarch_char_signed.

Index: xstormy16-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/xstormy16-tdep.c,v
retrieving revision 1.32
diff -u -p -r1.32 xstormy16-tdep.c
--- xstormy16-tdep.c    24 Mar 2003 03:54:50 -0000      1.32
+++ xstormy16-tdep.c    25 Mar 2003 16:12:34 -0000
@@ -1106,6 +1106,7 @@ xstormy16_gdbarch_init (struct gdbarch_i
   set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
   set_gdbarch_breakpoint_from_pc (gdbarch, xstormy16_breakpoint_from_pc);
 
+  set_gdbarch_char_signed (gdbarch, 0);
   set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT);
   set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
   set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT);

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen@redhat.com


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

* Re: [PATCH] xstormy16-tdep.c: Set chars to unsigned
  2003-03-25 16:18 [PATCH] xstormy16-tdep.c: Set chars to unsigned Corinna Vinschen
@ 2003-03-25 16:28 ` Andrew Cagney
  2003-03-25 16:36   ` Corinna Vinschen
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Cagney @ 2003-03-25 16:28 UTC (permalink / raw)
  To: gdb-patches

Does this also fix some sizeof.exp failures?  That test is ment to check 
for this problem.

Andrew


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

* Re: [PATCH] xstormy16-tdep.c: Set chars to unsigned
  2003-03-25 16:28 ` Andrew Cagney
@ 2003-03-25 16:36   ` Corinna Vinschen
  2003-03-25 16:54     ` Andrew Cagney
  0 siblings, 1 reply; 7+ messages in thread
From: Corinna Vinschen @ 2003-03-25 16:36 UTC (permalink / raw)
  To: gdb-patches

On Tue, Mar 25, 2003 at 11:28:45AM -0500, Andrew Cagney wrote:
> Does this also fix some sizeof.exp failures?  That test is ment to check 
> for this problem.

XStormy16 has no sizeof.exp FAILs.

Corinna

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen@redhat.com


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

* Re: [PATCH] xstormy16-tdep.c: Set chars to unsigned
  2003-03-25 16:36   ` Corinna Vinschen
@ 2003-03-25 16:54     ` Andrew Cagney
  2003-03-25 17:07       ` Corinna Vinschen
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Cagney @ 2003-03-25 16:54 UTC (permalink / raw)
  To: Corinna Vinschen; +Cc: gdb-patches

> On Tue, Mar 25, 2003 at 11:28:45AM -0500, Andrew Cagney wrote:
> 
>> Does this also fix some sizeof.exp failures?  That test is ment to check 
>> for this problem.
> 
> 
> XStormy16 has no sizeof.exp FAILs.

These tests:

print/d (int) (char) -1
$11 = -1
(gdb) PASS: gdb.base/sizeof.exp: get value of (int) (char) -1 (-1)
print/d (int) (signed char) -1
$12 = -1
(gdb) PASS: gdb.base/sizeof.exp: get value of (int) (signed char) -1 (-1)
print/d (int) (unsigned char) -1
$13 = 255
(gdb) PASS: gdb.base/sizeof.exp: get value of (int) (unsigned char) -1 (255)
next
valueof ((int) (char) -1) == -1
118       printf ("valueof ((int) (signed char) -1) == %d\n", (int) 
(signed char) -1);
(gdb) PASS: gdb.base/sizeof.exp: check valueof (int) (char) -1 == -1
next
valueof ((int) (signed char) -1) == -1
119       printf ("valueof ((int) (unsigned char) -1) == %d\n", (int) 
(unsigned char) -1);
(gdb) PASS: gdb.base/sizeof.exp: check valueof (int) (signed char) -1 == -1
next
valueof ((int) (unsigned char) -1) == 255
121       return 0;
(gdb) PASS: gdb.base/sizeof.exp: check valueof (int) (unsigned char) -1 
== 255

are ment to ensure that GCC/target and GDB have a consistent idea the 
signness of a character.

If GDB was getting char's sign wrong, but those tests were passing, then 
there is a bug in that test case.

Can you please check this, and expand a little on exactly what the 
charsets.exp problem was.

Andrew



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

* Re: [PATCH] xstormy16-tdep.c: Set chars to unsigned
  2003-03-25 16:54     ` Andrew Cagney
@ 2003-03-25 17:07       ` Corinna Vinschen
  2003-03-25 23:24         ` Andrew Cagney
  0 siblings, 1 reply; 7+ messages in thread
From: Corinna Vinschen @ 2003-03-25 17:07 UTC (permalink / raw)
  To: gdb-patches

On Tue, Mar 25, 2003 at 11:54:01AM -0500, Andrew Cagney wrote:
> >On Tue, Mar 25, 2003 at 11:28:45AM -0500, Andrew Cagney wrote:
> These tests:
> 
> print/d (int) (char) -1
> $11 = -1
> [...]

are looking pretty normal:

print/d (int) (char) -1^M
$11 = 255^M
(gdb) PASS: gdb.base/sizeof.exp: get value of (int) (char) -1 (255)
print/d (int) (signed char) -1^M
$12 = -1^M
(gdb) PASS: gdb.base/sizeof.exp: get value of (int) (signed char) -1 (-1)
print/d (int) (unsigned char) -1^M
$13 = 255^M
(gdb) PASS: gdb.base/sizeof.exp: get value of (int) (unsigned char) -1 (255)
next^M
valueof ((int) (char) -1) == 255^M
118       printf ("valueof ((int) (signed char) -1) == %d\n", (int) (signed char) -1);^M
(gdb) PASS: gdb.base/sizeof.exp: check valueof (int) (char) -1 == 255
next^M
valueof ((int) (signed char) -1) == -1^M
119       printf ("valueof ((int) (unsigned char) -1) == %d\n", (int) (unsigned char) -1);^M
(gdb) PASS: gdb.base/sizeof.exp: check valueof (int) (signed char) -1 == -1
next^M
valueof ((int) (unsigned char) -1) == 255^M
121       return 0;^M

> Can you please check this, and expand a little on exactly what the 
> charsets.exp problem was.

The characters returned from the application's strings were unsigned,
the characters evaluated in gdb internally were signed e. g.:

print 'A'^M    
$3 = -63 'A'^M
(gdb) PASS: gdb.base/charset.exp: parse character literal in ibm1047
print 'A' == ibm1047_string[8]^M
$4 = 0^M
(gdb) FAIL: gdb.base/charset.exp: check value of parsed character literal in ibm1047

This is solved with my patch.

Corinna

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen@redhat.com


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

* Re: [PATCH] xstormy16-tdep.c: Set chars to unsigned
  2003-03-25 17:07       ` Corinna Vinschen
@ 2003-03-25 23:24         ` Andrew Cagney
  2003-03-26  9:13           ` Corinna Vinschen
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Cagney @ 2003-03-25 23:24 UTC (permalink / raw)
  To: gdb-patches


>> These tests:
>> 
>> print/d (int) (char) -1
>> $11 = -1
>> [...]
> 
> 
> are looking pretty normal:
> 
> print/d (int) (char) -1^M
> $11 = 255^M

But were they normal before this patch?  I.e., did the patch affect this 
test's results?

If they didn't then there is a bug in the sizeof.exp test since it is 
ment to check that GDB/target agree on the basics.

Andrew



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

* Re: [PATCH] xstormy16-tdep.c: Set chars to unsigned
  2003-03-25 23:24         ` Andrew Cagney
@ 2003-03-26  9:13           ` Corinna Vinschen
  0 siblings, 0 replies; 7+ messages in thread
From: Corinna Vinschen @ 2003-03-26  9:13 UTC (permalink / raw)
  To: gdb-patches

On Tue, Mar 25, 2003 at 06:24:07PM -0500, Andrew Cagney wrote:
> >print/d (int) (char) -1^M
> >$11 = 255^M
> 
> But were they normal before this patch?  I.e., did the patch affect this 
> test's results?

No, these tests returned the same results with and without my patch.

> If they didn't then there is a bug in the sizeof.exp test since it is 
> ment to check that GDB/target agree on the basics.

Just a guess:  The sizeof tests are using numerical constants.  The
charset tests are using character strings.  The evaluation is subtly
different in that the evaluation of character strings require the
target being active.  There's a part of interaction not required for
the tests used in sizeof.exp.

Corinna

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen@redhat.com


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

end of thread, other threads:[~2003-03-26  9:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-25 16:18 [PATCH] xstormy16-tdep.c: Set chars to unsigned Corinna Vinschen
2003-03-25 16:28 ` Andrew Cagney
2003-03-25 16:36   ` Corinna Vinschen
2003-03-25 16:54     ` Andrew Cagney
2003-03-25 17:07       ` Corinna Vinschen
2003-03-25 23:24         ` Andrew Cagney
2003-03-26  9:13           ` Corinna Vinschen

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