List Info

Thread: x/i 0x204c5ac. seg fault




x/i 0x204c5ac. seg fault
user name
2006-04-28 13:12:47
On Fri, Apr 28, 2006 at 11:25:20AM +0100, Dave Korn wrote:
> (gdb) x/i 0x204c5ac
> 0x204c5ac:      Cannot access memory at address
0x204c5ac

You missed the trailing ".".

The problem arises for two reasons.

1.  c-exp.y:parse_number fails to handle sscanf errors; it
doesn't
    issue an error, but leaves the type unset.

2.  The system sscanf in glibc apparently rejects hex float.

-- 
Daniel Jacobowitz
CodeSourcery
x/i 0x204c5ac. seg fault
user name
2006-04-28 14:21:17
On 28 April 2006 14:13, Daniel Jacobowitz wrote:

> On Fri, Apr 28, 2006 at 11:25:20AM +0100, Dave Korn
wrote:
>> (gdb) x/i 0x204c5ac
>> 0x204c5ac:      Cannot access memory at address
0x204c5ac
> 
> You missed the trailing ".".

  Oooops!  Copy'n'paste error -vs- word-selection. 
Nonetheless:

dkrainbow /usr/build/obj-gdb/gdb> ./gdb
GNU gdb 6.4.50.20060329-cvs
Copyright (C) 2006 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-cygwin".
Setting up the environment for debugging gdb.
No symbol table is loaded.  Use the "file"
command.
No symbol table is loaded.  Use the "file"
command.
/usr/build/obj-gdb/gdb/.gdbinit:8: Error in sourced command
file:
No breakpoint number 0.
(gdb) x/i 0x204c5ac.
Invalid number "0x204c5ac.".
(gdb)

  

> The problem arises for two reasons.
> 
> 1.  c-exp.y:parse_number fails to handle sscanf errors;
it doesn't
>     issue an error, but leaves the type unset.
> 
> 2.  The system sscanf in glibc apparently rejects hex
float.

  That'll be the reason I can't reproduce it.  I'm on
cygwin, hence newlib
rather than glibc.


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

x/i 0x204c5ac. seg fault
user name
2006-04-28 15:10:54
Daniel Jacobowitz <drowfalse.org> writes:

> 2.  The system sscanf in glibc apparently rejects hex
float.

A valid hex float constant always contains a 'p' or 'P'.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwabsuse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg,
Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5
214B 8276 4ED5
"And now for something completely different."
x/i 0x204c5ac. seg fault
user name
2006-04-28 15:17:42
On Fri, Apr 28, 2006 at 05:10:54PM +0200, Andreas Schwab
wrote:
> Daniel Jacobowitz <drowfalse.org> writes:
> 
> > 2.  The system sscanf in glibc apparently rejects
hex float.
> 
> A valid hex float constant always contains a 'p' or
'P'.

OK, so it's 100% GDB's fault then.  Thanks for the
correction.
This should probably be an error.

-- 
Daniel Jacobowitz
CodeSourcery
x/i 0x204c5ac. seg fault
user name
2006-04-28 15:44:08
On 28 April 2006 16:18, Daniel Jacobowitz wrote:

> On Fri, Apr 28, 2006 at 05:10:54PM +0200, Andreas
Schwab wrote:
>> Daniel Jacobowitz <drowfalse.org> writes:
>> 
>>> 2.  The system sscanf in glibc apparently
rejects hex float.
>> 
>> A valid hex float constant always contains a 'p'
or 'P'.
> 
> OK, so it's 100% GDB's fault then.  Thanks for the
correction.
> This should probably be an error.

  And indeed perhaps the fact that newlib apparently
/doesn't/ return an error
should be considered a bug too.  Or perhaps newlib doesn't
support hex floats
and regards it as a hex integer constant and just stops
scanning at the
period, assuming it's part of the next field.  I'll try
and take a look
through the newlib source at the weekend unless someone on
the newlib list
[Cc'd in] comments that this is intended behaviour.

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )