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]

RE: breakpoint at address on Atmel AVR - parsing



> -----Original Message-----
> From: Joel Brobecker
> Sent: Thursday, August 16, 2012 5:10 PM
> To: Petr Hluz?n
> Cc: gdb
> Subject: Re: breakpoint at address on Atmel AVR - parsing
> 
> > It seems GDB-7.4.91 badly parses program-space addresses given to
> > `break' and `disassemble' at Atmel AVR architecture: an "0x4d2"
> > becomes 0x8004d2.
> 
> As I understand it, this is a bit of an unfortunate "expected behavior"
> at the moment.
> 
> One possible way to fix it, I think, it to enhance the linespec module
> (used by the "break" command) and the "disassemble" command to automatically
> treat integer values as code addresses. For instance, in the case
> of the "disassemble" command, perhaps it would be sufficient to
> simply cast the value obtained after parsing to a code pointer,
> before extracting the value as an address:
> 
>   pc = value_as_address (parse_to_comma_and_eval (&arg));
> 
> After all, the command knows that the address should be code addresses,
> not data addresses.

Adding 0x800000 to all code-space addresses has been part of AVR GCC for many years, mainly to distinguish when an address is in the code space. The AVR is Harvard architecture with multiple address spaces, but GCC expects Von Neumann architecture with a single address space. The solution was to create a very high offset to indicate that the address was in code.

Eric Weddington
Atmel


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