This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

strange dereferencing behavior in gdb expressions


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)
        
        
        
        
        


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]