This is the mail archive of the gdb@sources.redhat.com 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]

Re: A copy/save command ...


>From Daniel:
> Perhaps read/write?  But that's still not clear which way is which. 
> load/store would be perfect but load is already used.

>From FChE:
> and FORMAT could be some bfd-supported forms like "srec" or "binary".

Couldn't adding binary support to load be considered the same as thing
as "read"?

Then the opposite of load, is dump.

   load/dump FILE SECTIONS(S)

The trick is to create a way to specify the layout and format of the
desired sections.  Some sort of a reverse "info maint sections".

gdb> info maint sections
Exec file:
    `/h1/swarthou/prg/empty/empty1', file type elf32-powerpc.
    0x10000074->0x10000098 at 0x00000074: .text ALLOC LOAD READONLY CO
    0x10000098->0x10000098 at 0x00000098: .sdata2 ALLOC LOAD READONLY
    0x100100a0->0x100100b0 at 0x000000a0: .data ALLOC LOAD DATA HAS_CO
    0x100100b0->0x100100b0 at 0x000000b0: .sdata ALLOC LOAD DATA HAS_C
    0x100100b0->0x100100b0 at 0x000000b0: .sbss HAS_CONTENTS
    0x100100b0->0x100100c0 at 0x000000b0: .bss ALLOC
Core file:
    `/h1/swarthou/prg/empty/core', file type elf32-powerpc.
    0x00000000->0x00000654 at 0x000000b4: note0 READONLY HAS_CONTENTS
    0x00000000->0x000000c0 at 0x0000010c: .reg/14104 HAS_CONTENTS
    0x00000000->0x000000c0 at 0x0000010c: .reg HAS_CONTENTS
    0x00000000->0x00000108 at 0x00000600: .reg2/14104 HAS_CONTENTS
    0x00000000->0x00000108 at 0x00000600: .reg2 HAS_CONTENTS
    0x10000000->0x10000000 at 0x00001000: load1 ALLOC LOAD READONLY CO
    0x10010000->0x10011000 at 0x00001000: load2 ALLOC LOAD HAS_CONTENT
    0x7ffff000->0x80000000 at 0x00002000: load3 ALLOC LOAD CODE HAS_CO

 Then
gdb> load BINFILE1 .bss
 or
gdb> dump BINFILE2 load1
 would do the desired thing.

It would be natural to add core file support to load/dump too.

There is still the issue of how to specify the format (binary,
elf-core, elf-object, srec, or other bfd type).  Maybe some borrow
the syntax from objcopy or the loader.

- Ed

Ed.Swarthout@motorola.com
Somerset Design Center


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