Recent

Author Topic: Assembler window is empty and "Cannot access memory at address <x>"  (Read 4320 times)

Cyrax

  • Hero Member
  • *****
  • Posts: 836
When debugging a simple console program, Assembler Window can't display disassembly at the start of main program.

Debug output window will display these error lines :
Code: Pascal  [Select][+][-]
  1. <-data-disassemble -s 134516676 -e 134516677 -- 0>
  2. ^error,msg="Cannot access memory at address 0x8048fc4"
  3. (gdb)
  4. <-data-disassemble -s 134516560 -e 134517088 -- 0>
  5. ^error,msg="Cannot access memory at address 0x8048f50"
  6. (gdb)
  7. <-data-disassemble -s 134516380 -e 134516381 -- 0>
  8. ^error,msg="Cannot access memory at address 0x8048e9c"
  9. (gdb)
  10. <-data-disassemble -s 134516264 -e 134516560 -- 0>
  11. ^error,msg="Cannot access memory at address 0x8048e28"
  12. (gdb)
  13. <-data-disassemble -s 134516676 -e 134516677 -- 0>
  14. ^error,msg="Cannot access memory at address 0x8048fc4"
  15. (gdb)
  16. <-data-disassemble -s 134516560 -e 134517088 -- 0>
  17. ^error,msg="Cannot access memory at address 0x8048f50"
  18. (gdb)
  19. <-data-disassemble -s 134516380 -e 134516381 -- 0>
  20. ^error,msg="Cannot access memory at address 0x8048e9c"
  21. (gdb)
  22.  

Only when stepping into subroutine at the different unit, Assembler Window will display correct disassembly. And when going back to main program, Assembler Window will show nothing.

This bad behaviour will disappear when adding additional clauses to the main program.

Attached test project (project1.zip) will demonstrate this problem. It will disappear, when you enable the define DEBUG_PADDING at the main source.

This was tested by building the attached test project as an 32-bit program on top 64-bit Arch Linux and debugging it via 32-bit Lazarus.

Attached extra files which are debug log from Lazarus and output from Debug output window (debug info.zip) and main program and unit1 assembler files.

I like to have confirmation from others if this is a bug? So I can report it to bug tracker.

I have FPC 3.3.1-r39935 and Lazarus 2.1.0 r59300.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9754
  • Debugger - SynEdit - and more
    • wiki
Re: Assembler window is empty and "Cannot access memory at address <x>"
« Reply #1 on: October 15, 2018, 11:42:54 pm »
I havent tested it myself, but it looks like an issue in GDB itself. Which version do you have?

By the looks at it, it is trying to disassemble some lines before the current PC. But that is in this case outside the executable.

Please report. (attach files to report too)

Code: [Select]
<< TCmdLineDebugger.ReadLn "~"\t0x08049000 - 0x080d2d70 is .text\n""
  << TCmdLineDebugger.ReadLn "~"\t0x080d3000 - 0x080e37f8 is .rodata\n""
  << TCmdLineDebugger.ReadLn "~"\t0x080e4000 - 0x08101590 is .data\n""
  << TCmdLineDebugger.ReadLn "~"\t0x08101670 - 0x08105a84 is .bss\n""

Code: [Select]
  >> TCmdLineDebugger.SendCmdLn "-data-disassemble -s 134516676 -e 134516677 -- 0"
  << TCmdLineDebugger.ReadLn "^error,msg="Cannot access memory at address 0x8048fc4""

0x8048fc4 is before 0x08049000

Cyrax

  • Hero Member
  • *****
  • Posts: 836
Re: Assembler window is empty and "Cannot access memory at address <x>"
« Reply #2 on: October 18, 2018, 08:00:39 pm »
GDB is 8.2 which comes from normal Arch Linux repositories.

Reported as https://bugs.freepascal.org/view.php?id=34430

 

TinyPortal © 2005-2018