[PATCH] xstormy16-tdep.c: Set chars to unsigned

Corinna Vinschen vinschen@redhat.com
Tue Mar 25 17:07:00 GMT 2003


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



More information about the Gdb-patches mailing list