Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2019-06

avr, fpdebug and dwarf

2 messages · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Martin Frb
Dimitrios Chr. Ioannidis wrote 13 lines
Hi,   I managed to use an official AVR debugger ( AVR Dragon ) with an official gdb-bridge ( Atmel Studio's atbackend.exe ) and I can start a debugging session from Lazarus, using a avr-gdb 8.3 ( or the official gdb from the Microchip (Atmel) AVR Toolchain ).   But what am I seeing ( see attached screenshot ) makes me to believe that fpdebug ( either dwarf 2 or dwarf 3 the results is the same ) doesn't know ( needs to know ? ... ) how to interpret the avr platform /architecture . Am I correct in my assumption ?   What is your opinion ?

Yes, fpdebug currently only knows intel.

I assume, this is a linux based platform?

components\fpdebug\fpdbglinuxclasses.pas TDbgLinuxThread.ReadThreadState And anything that then accesses the registers.
Registers need to be stored with the correct dwarf index. The index is used when reading any register based data (including any data relative to the stack / i.e. local var)

Note, that currently access to StackPointer/Base and InstructionPointer are hardcoded in other units too (using either the intel name, or the dwarf reg num for intel)
So that needs to be fixed...

The disassemble currently only does intel too.
Not sure if stepping relies on this. (i.e. identifying "call" instructions) Stepping needs to be reworked anyway.

Reply by email

Martin Frb
to Martin Frb
Martin Frb wrote 6 lines
Note, that currently access to StackPointer/Base and InstructionPointer are hardcoded in other units too (using either the intel name, or the dwarf reg num for intel) So that needs to be fixed...

I.e. you find code like

         if AController.CurrentProcess.Mode=dm32 then
           Reg := RegList.FindRegisterByDwarfIndex(8)
         else
           Reg := RegList.FindRegisterByDwarfIndex(16);

(evaluating the stack)

RegList should have methods:
.GetStackBase
.GetInstructionPointer

And reading the stack, may have to be moved to OS/CPU specific classes, if stack-frame layout may differ.

Reply by email