Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - gdb + loading binary files: (11 Items)
   
gdb + loading binary files  
Hi,
Is there any way i can load a binary file to a specific address.

(gdb) target remote xxxx:1234
(gdb) load-file binary mybinfile 0x100000

Is something like this allowed (given the target endianness, it should load byte/word starting from address 0x100000)

I couldn't find anything on net.

L9h
Re: gdb + loading binary files  
Our current release doesn't support this.  Gdb 6.6 is being made 
available soon in the tools community project, maybe that supports it?

Linux 9Here wrote:
>
> Hi,
> Is there any way i can load a binary file to a specific address.
>
> (gdb) target remote xxxx:1234
> (gdb) load-file binary mybinfile 0x100000
>
> Is something like this allowed (given the target endianness, it should 
> load byte/word starting from address 0x100000)
>
> I couldn't find anything on net.
>
> L9h
>
> _______________________________________________
> General
> http://community.qnx.com/sf/go/post1828
>

-- 
cburgess@qnx.com

RE: gdb + loading binary files  
GDB 6.x supports the 'restore' command if you're using the GDB remote
protocol.

(gdb) help restore
Restore the contents of FILE to target memory.
Arguments are FILE OFFSET START END where all except FILE are optional.
OFFSET will be added to the base address of the file (default zero).
If START and END are given, only the file contents within that range
(file relative) will be restored to target memory.

> -----Original Message-----
> From: Colin Burgess [mailto:cburgess@qnx.com]
> Sent: Saturday, October 06, 2007 2:53 PM
> To: general-toolchain
> Subject: Re: gdb + loading binary files
> 
> Our current release doesn't support this.  Gdb 6.6 is being made
> available soon in the tools community project, maybe that supports it?
> 
> Linux 9Here wrote:
> >
> > Hi,
> > Is there any way i can load a binary file to a specific address.
> >
> > (gdb) target remote xxxx:1234
> > (gdb) load-file binary mybinfile 0x100000
> >
> > Is something like this allowed (given the target endianness, it should
> > load byte/word starting from address 0x100000)
> >
> > I couldn't find anything on net.
> >
> > L9h
> >
> > _______________________________________________
> > General
> > http://community.qnx.com/sf/go/post1828
> >
> 
> --
> cburgess@qnx.com
> 
> 
> 
> _______________________________________________
> General
> http://community.qnx.com/sf/go/post1833
Re: RE: gdb + loading binary files  
Bingo,
Just got gdb-6.6 compiled on my Linux box.
I'll try this
Re: gdb + loading binary files  
Ah, but you're not using the remote protocol, you're using the qnx 
protocol...

We do have a version of pdebug that supports the remote protocol though 
- you were wanting ARM as a platform, right?

I'll post a binary if you tell me which endian you want.  Note - I have 
never tried this with ARM, but MIPS and PPC work ok...

Linux 9Here wrote:
>
> Bingo,
> Just got gdb-6.6 compiled on my Linux box.
> I'll try this
>
> _______________________________________________
> General
> http://community.qnx.com/sf/go/post1872
>

-- 
cburgess@qnx.com

RE: gdb + loading binary files  
According to the original question this is the remote protocol.  Whether or
not that's correct is a different story.

Can you describe what you're trying to accomplish with this command?  

> -----Original Message-----
> From: Colin Burgess [mailto:cburgess@qnx.com]
> Sent: Tuesday, October 09, 2007 9:43 AM
> To: general-toolchain
> Subject: Re: gdb + loading binary files
> 
> Ah, but you're not using the remote protocol, you're using the qnx
> protocol...
> 
> We do have a version of pdebug that supports the remote protocol though
> - you were wanting ARM as a platform, right?
> 
> I'll post a binary if you tell me which endian you want.  Note - I have
> never tried this with ARM, but MIPS and PPC work ok...
> 
> Linux 9Here wrote:
> >
> > Bingo,
> > Just got gdb-6.6 compiled on my Linux box.
> > I'll try this
> >
> > _______________________________________________
> > General
> > http://community.qnx.com/sf/go/post1872
> >
> 
> --
> cburgess@qnx.com
> 
> 
> 
> _______________________________________________
> General
> http://community.qnx.com/sf/go/post1874
RE: gdb + loading binary files  
Let me explain what I would like to accomplish.
I want to use QEMU's Integrator/CP + ARM 926.
QEMU support booting with floppy/hdd/cdrom or linux kernel (I may have least explored this )
I would like to 
* invoke qemu with -S and -s switch
* connect arm gdb from host (my case Linux)
* load ipl to address 0x1000
* load startup+kernel to someother locations (say 0x00100000)
* set pc/r15 to 0x1000
* run

I have modified the serial driver to get the address through serial output port and do a setup_image and start_image on 
that address.
Let me know if it is possible, or anybody tried this. I haven't' yet tried the restore file command.

L9h
Re: RE: gdb + loading binary files  
sorry, i meant to say image_setup and image_start
Re: gdb + loading binary files  
Hmmm, why don't we make a mkifsf_bzImage filter and let QEMU's linux 
image loader do the hard work? ;-)

Linux 9Here wrote:
>
> Let me explain what I would like to accomplish.
> I want to use QEMU's Integrator/CP + ARM 926.
> QEMU support booting with floppy/hdd/cdrom or linux kernel (I may have 
> least explored this )
> I would like to
> * invoke qemu with -S and -s switch
> * connect arm gdb from host (my case Linux)
> * load ipl to address 0x1000
> * load startup+kernel to someother locations (say 0x00100000)
> * set pc/r15 to 0x1000
> * run
>
> I have modified the serial driver to get the address through serial 
> output port and do a setup_image and start_image on that address.
>
> Let me know if it is possible, or anybody tried this. I haven't' yet 
> tried the restore file command.
>
> L9h
>
> _______________________________________________
> General
> http://community.qnx.com/sf/go/post1892
>

-- 
cburgess@qnx.com

Re: gdb + loading binary files  
If there is going to be a filter like that it would be great, but time being this could be done by gdb script (if at all
 it is feasible) 
Re: gdb + loading binary files  
It looks (from the code) that you could simply create an elf image and 
it will load it

You will need to make an elf.boot - take the PPC elf.boot as an example.

If you look at hw/arm_boot.c it simply loads it into memory and sets 
r15/pc to the entry point marked in the elf.

Then you should be able to boot/debug wiht

qemu-system-arm -s -kernel myimage

Linux 9Here wrote:
>
> If there is going to be a filter like that it would be great, but time 
> being this could be done by gdb script (if at all it is feasible)
>
> _______________________________________________
> General
> http://community.qnx.com/sf/go/post1895
>

-- 
cburgess@qnx.com