Bug 10362 - lm32 simulator does not handle non-zero load address
Summary: lm32 simulator does not handle non-zero load address
Status: RESOLVED INVALID
Alias: None
Product: gdb
Classification: Unclassified
Component: sim (show other bugs)
Version: 6.8
: P2 normal
Target Milestone: 6.8
Assignee: jon
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-05 12:01 UTC by Sebastien Bourdeauducq
Modified: 2015-12-28 00:21 UTC (History)
2 users (show)

See Also:
Host: i686-linux-gnu
Target: lm32-unknown-elf
Build: i686-linux-gnu
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastien Bourdeauducq 2009-07-05 12:01:53 UTC
When trying to load a ELF binary into the LatticeMico32 (LM32) simulator with
non-zero load and start addresses, parts of GDB will still use the default zero
address and cause many commands (backtrace, info, ...) to fail or display wrong
results.

This can be seen when using those commands (Linux kernel loaded at 0x40000000):
lm32-elf-gdb vmlinux
target sim --memory-region 0x40000000,0x4000000
load
run 

Also, "info mem" does not report anything even though I think a memory region
should be defined at 0x40000000 - but I'm not familiar enough with gdb to decide
if it's a bug or not.
Comment 1 Sebastien Bourdeauducq 2009-07-05 12:03:32 UTC
I forgot to mention I'm using gdb-6.8.50.20090630

Comment 2 Mike Frysinger 2015-12-28 00:21:40 UTC
it's not clear to me what your expectations are.  the memory-region command does *not* change where code is loaded ... instead, it just connects a chunk of memory to the addr that you requested.  so when you use "memory-region 0x40000000,0x4000000", that connects a chunk of memory at address 0x40000000 with a length of 0x4000000 bytes.

the "load" command is used to control where to load the requested file -- since you didn't specify any arguments, it uses an offset of 0 (the default).

an example run:
$ ./gdb/gdb -q ./sim/testsuite/pass.s.x 
(gdb) target sim --memory-region 0x40000000,0x4000000
Connected to the simulator.
(gdb) load
Loading section .text, size 0x24 lma 0x0
Loading section .data, size 0x102a lma 0x1024
Start address 0x0
Transfer rate: 33392 bits in <1 sec.
(gdb) sim memory-info
Memory maps:
 memory region 0x40000000,0x4000000
 memory region 0x00000000,0x10000

i'm going to close this bug assuming that you're mixing up the behavior of the memory-region command.  please re-open with more details for us to look at (and attach some example ELFs for us to test with).