2011-07-02 11:17:08     gdb/sim error : Cannot access memory

Document created by Aaronwu Employee on Oct 16, 2013
Version 1Show Document
  • View in full screen mode

2011-07-02 11:17:08     gdb/sim error : Cannot access memory

Matthew Getz (UNITED STATES)

Message: 102047   

 

Any pointers?

 

~/blackfin-sources/tools_test-elf/bin/bfin-elf-gdb se_all32bitopcodes.S.x

 

GNU gdb 6.6

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 "--host=x86_64-unknown-linux-gnu --target=bfin-elf"...

(gdb) target sim --environment operating

Connected to the simulator.

(gdb) load

Loading section .text, size 0x234 lma 0x0

Loading section .data, size 0x63e48 lma 0x1234

Start address 0xaa

Transfer rate: 3277792 bits in <1 sec.

(gdb) run

Starting program: /home/matthew/blackfin-sources/toolchain/binutils-2.17/sim/testsuite/sim/bfin/se_all32bitopcodes.S.x

fail

 

Program exited with code 01.

(gdb) disassemble usr

Dump of assembler code for function usr:

0x00000224 <usr+0>:    Cannot access memory at address 0x224

(gdb) x usr

0x224 <usr>:    Cannot access memory at address 0x224

 

 

How can I find the opcode which is failing?

 

?

QuoteReplyEditDelete

 

 

2011-07-02 12:54:30     Re: gdb/sim error : Cannot access memory

Mike Frysinger (UNITED STATES)

Message: 102048   

 

the way the sim works is that you cant access memory before "run" or after it exits.  so you'd want to set a breakpoint on the exit point so that it doesnt actually exit.

 

$ bfin-elf-gdb ./se_all32bitopcodes.S.x

(gdb) target sim --environment operating

Connected to the simulator.

(gdb) load

Loading section .text, size 0x234 lma 0x0

Loading section .data, size 0x63e48 lma 0x1234

Start address 0xaa

Transfer rate: 3277792 bits in <1 sec.

(gdb) b *fail_lvl

Breakpoint 1 at 0x216

(gdb) r

Starting program: /usr/local/src/blackfin/svn/toolchain/trunk/binutils-2.17/sim/testsuite/sim/bfin/se_all32bitopcodes.S.x

 

Breakpoint 1, 0x00000216 in fail_lvl ()

(gdb) dis usr

........

 

although to find out what you want to know, it might be faster to use a trace option:

$ bfin-elf-run --help | grep trace

 

the -t option is a good shortcut:

(gdb) target sim --environment operating -t

QuoteReplyEditDelete

 

 

2011-08-23 18:46:36     Re: gdb/sim error : Cannot access memory

Matthew Getz (UNITED STATES)

Message: 103096   

 

Ok - that's part of it... but there still seems to be something wrong in the sim...

 

 

 

matthew@Scott:~/blackfin-sources/toolchain/binutils-2.17/sim/testsuite/sim/bfin$ ~/blackfin-sources/tools_test-elf/bin/bfin-elf-gdb se_all32bitopcodes.S.xGNU gdb 6.6

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 "--host=x86_64-unknown-linux-gnu --target=bfin-elf"...

(gdb) target sim --environment operating

Connected to the simulator.

(gdb) load

Loading section .text, size 0x234 lma 0x0

Loading section .data, size 0x63e3c lma 0x1234

Start address 0xaa

Transfer rate: 3277696 bits in <1 sec.

(gdb) break fail_lvl

Breakpoint 1 at 0x230

(gdb) go

Undefined command: "go".  Try "help".

(gdb) run

Starting program: /home/matthew/blackfin-sources/toolchain/binutils-2.17/sim/testsuite/sim/bfin/se_all32bitopcodes.S.x

fail

 

Program exited with code 01.

(gdb) x *usr

0x224 <usr>:    0x0000c000

(gdb) disassemble usr

Dump of assembler code for function usr:

0x00000224 <usr+0>:    A1 = R0.L * R0.L, A0 = R0.L * R0.L;

0x00000228 <usr+4>:    P0.L = 0x218;        /* (536)    P0=0x0x218 <fail_lvl> */

0x0000022c <usr+8>:    P0.H = 0x0;        /* (  0)    P0=0x0x218 <fail_lvl> */

0x00000230 <usr+12>:    JUMP (P0);

0x00000232 <usr+14>:    NOP;

 

 

Which I know isn't correct, since I can run it in the "run" with tracing, and it gets past that ...

 

I tried nocache, but that doesn't seem to make a difference...

 

gdb) info mem

Using user-defined memory regions.

Num Enb Low Addr   High Addr  Attrs

3   y      0x00000000 0x00001000 rw nocache

(gdb) x usr

0x224 <usr>:    0x0000c000

 

 

Any ideas?

QuoteReplyEditDelete

 

 

2011-08-24 00:45:39     Re: gdb/sim error : Cannot access memory

Mike Frysinger (UNITED STATES)

Message: 103099   

 

i dont think so.  your application exited.  i think when you examine symbols after that, it's coming from the ELF, and not from what was in the sim's memory at the time of it exiting -- since that memory no longer exists.

Attachments

    Outcomes