debugging - GDB doesn't disassemble program running in RAM correctly -
i have application compiled using gcc stm32f407 arm processor. linker stores in flash, executed in ram. small bootstrap program copies application flash ram , branches application's resethandler.
memcpy(appramstart, appflashstart, appramsize); // run application __asm volatile ( "ldr r1, =_app_ram_start\n\t" // load pointer application's vectors "add r1, #4\n\t" // increment vector pointer second entry (resethandler pointer) "ldr r2, [r1, #0x0]\n\t" // load resethandler address via vector pointer // bit[0] must 1 thumb instructions otherwise bus error occur. "bx r2" // jump resethandler - not return here );
this works ok, except when try debug application ram (using gdb eclipse) disassembly incorrect. curious thing debugger gets source code correct, , accept , halt on breakpoints have set. can single step source code lines. however, when single step assembly instructions, make no sense @ all. contains numerous undefined instructions. i'm assuming kind of alignment problem, looks correct me. suggestions?
it possible gdb relies on symbol table check instruction set mode can thumb(2)/arm. when move code ram can't find information , opts arm mode.
you can use set arm force-mode thumb
in gdb force thumb mode instruction.
as side note, if illegal instruction when debugging arm binary problem if not complete nonsense trying disassembly data parts.
i find strange tools doesn't try heuristic approach when disassembling arm binaries. in case of auto shouldn't hard try both modes , error count decide mode use last resort.
Comments
Post a Comment