Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* strange dereferencing behavior in gdb expressions
@ 2006-01-25 20:00 PAUL GILLIAM
  2006-01-26  0:41 ` Daniel Jacobowitz
  0 siblings, 1 reply; 2+ messages in thread
From: PAUL GILLIAM @ 2006-01-25 20:00 UTC (permalink / raw)
  To: gdb

This seems inconsistent: GDB says it can't access memory at an address,
but when given that address explicitly, it works fine.
        
        GDB was configured like this: CC='gcc -m64' ../src/configure
        (i.e. GDB
        is a 64-bit application)
        
        The target application is a 32-bit 'C' program.
        
        (gdb) show version
        GNU gdb 6.4.50.20060124-cvs
        ...
        This GDB was configured as "powerpc64-unknown-linux-gnu".
        (gdb) p/x *(*(0xffffc4a0)+4)
        Cannot access memory at address 0xffffc504
        (gdb) p/x *(int*)((*(int*)0xffffc4a0)+4)
        $42 = 0xfd7e67c
        (gdb) p/x *(0xffffc4a0)+4
        $43 = 0xffffc504
        (gdb) p/x *($43)
        Cannot access memory at address 0xffffc504
        (gdb) p/x *(0xffffc504)
        $44 = 0xfd7e67c
        (gdb)
        
Anyone what to hazard a guess as to what is going on?
        
Another clue: 
When GDB is configured like this: ../src/configure (i.e. GDB is a
32-bitapplication), we get this:
        
        (gdb) p/x *(*(0xffffc4a0)+4)
        $5 = 0xfd7e67c
        (gdb)
        
        
        
        
        


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

* Re: strange dereferencing behavior in gdb expressions
  2006-01-25 20:00 strange dereferencing behavior in gdb expressions PAUL GILLIAM
@ 2006-01-26  0:41 ` Daniel Jacobowitz
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2006-01-26  0:41 UTC (permalink / raw)
  To: PAUL GILLIAM; +Cc: gdb

On Wed, Jan 25, 2006 at 11:42:30AM -0800, PAUL GILLIAM wrote:
> This seems inconsistent: GDB says it can't access memory at an address,
> but when given that address explicitly, it works fine.
>         
>         GDB was configured like this: CC='gcc -m64' ../src/configure
>         (i.e. GDB
>         is a 64-bit application)
>         
>         The target application is a 32-bit 'C' program.
>         
>         (gdb) show version
>         GNU gdb 6.4.50.20060124-cvs
>         ...
>         This GDB was configured as "powerpc64-unknown-linux-gnu".
>         (gdb) p/x *(*(0xffffc4a0)+4)
>         Cannot access memory at address 0xffffc504
>         (gdb) p/x *(int*)((*(int*)0xffffc4a0)+4)
>         $42 = 0xfd7e67c
>         (gdb) p/x *(0xffffc4a0)+4
>         $43 = 0xffffc504
>         (gdb) p/x *($43)
>         Cannot access memory at address 0xffffc504
>         (gdb) p/x *(0xffffc504)
>         $44 = 0xfd7e67c
>         (gdb)
>         
> Anyone what to hazard a guess as to what is going on?

I've had this happen when memory_error truncates the address; might
want to set a breakpoint there, and see if one of them is sign extended
differently than the other due to their different types.

-- 
Daniel Jacobowitz
CodeSourcery


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

end of thread, other threads:[~2006-01-25 20:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-25 20:00 strange dereferencing behavior in gdb expressions PAUL GILLIAM
2006-01-26  0:41 ` Daniel Jacobowitz

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