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]

Help: address vs pointer


Hi,

I have a problem with the address vs pointer circuitry in gdb for the AVR.

The AVR is a pure harvard architecture and furthermore the pc is an index to words (2 bytes). Instruction
pointers are also index to words.
In the ELF world, addresses are bytes indexes (and data addresses have a 0x80000 offset).


So far so good.

In gdb world, instruction addresses should be in bytes and thus so are arch_unwind_pc and arch_read_pc.
But arch_pointer_to_adress will multiply by 2 pointers to instructions and will add an offset for pointer
to data.


So what should be the type of the pc register ?
If it is a pointer to instructions, 'print $pc' would be wrong as it would be multiplied by 4 (once by
read_pc and once during evaluation).
If it is not a pointer to instructions, 'disass $pc $pc+4' would be wrong because an offset would be added
like for any non-instruction pointer value.


What did I miss ?

Tristan.


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