Difference between revisions of "FpGdbmiDebugger"

From Free Pascal wiki
Jump to navigationJump to search
(Header level 2 used instead of header 1 to match rest of wiki. Slight language fixes)
Line 1: Line 1:
{{Warning|FpGdbmiDebugger is still in alpha Development. It is advised not to use it for production. While using FpGdbmiDebugger problems such as the following (but not limited too) may occur:
+
{{Warning|FpGdbmiDebugger is still in alpha Development. It is advised not to use it for production. While using FpGdbmiDebugger problems including (but not limited to) the following may occur:
 
* Crashes of the IDE or Debugger
 
* Crashes of the IDE or Debugger
 
* Incorrect behaviour of the IDE or debugger
 
* Incorrect behaviour of the IDE or debugger
Line 17: Line 17:
 
__TOC__
 
__TOC__
  
= About =
+
== About ==
  
FpGdbmiDebugger is an extension of the GdbmiDebugger used by the IDE. Both debuggers are using GDB.  
+
FpGdbmiDebugger is an extension of the GdbmiDebugger used by the IDE. Both debuggers use GDB.  
  
FpGdbmiDebugger is intended to keep GDB as a back-end, so it can later be extended to use gdbserver for remote debugging. (An additional GDB free debugger will also be developed, and like FpGdbmiDebugger, it will be based on the FpDebug package)
+
FpGdbmiDebugger is intended to keep GDB as a back-end, so it can later be extended to use gdbserver for remote debugging. (An additional debugger that does not depend on GDB will also be developed, and like FpGdbmiDebugger, it will be based on the FpDebug package)
  
 
FpGdbmiDebugger is designed to perform some tasks without needing GDB:
 
FpGdbmiDebugger is designed to perform some tasks without needing GDB:
 
* Reading Line-Info, for displaying the blue gutter dots (working)
 
* Reading Line-Info, for displaying the blue gutter dots (working)
* Reading Dwarf to evaluate Locals and watches (partly done)<br>Reading data from the debuggee is done via gdb memread, but does not need gdb to have knowledge of pascal values. Except on Windows where data can be read directly.
+
* Reading Dwarf to evaluate Locals and watches (partly done)<br>Reading data from the debuggee is done via gdb memread, but does not need gdb to have knowledge of Pascal values. Except on Windows where data can be read directly.
* Reading Sackframes/traces (not yet done)
+
* Reading Stackframes/traces (not yet done)
 
* Disassemble (not yet done)
 
* Disassemble (not yet done)
  
 
FpGdbmiDebugger is not intended to perform execution control directly (this is left to gdb), such as stepping, and running between breakpoints. (For this there will be a gdb free debugger)
 
FpGdbmiDebugger is not intended to perform execution control directly (this is left to gdb), such as stepping, and running between breakpoints. (For this there will be a gdb free debugger)
  
= Testing =
+
== Testing ==
  
 
See progress for which features are implemented. Any feature not mentioned should be assumed not yet to be implemented.  
 
See progress for which features are implemented. Any feature not mentioned should be assumed not yet to be implemented.  
Line 44: Line 44:
  
  
= Progress =
+
== Progress ==
 
{{Warning| FpGdbmiDebugger only works with Dwarf 2 (+ dwarfsets)}}
 
{{Warning| FpGdbmiDebugger only works with Dwarf 2 (+ dwarfsets)}}
  
 
The following features should work
 
The following features should work
  
== code line indicators (blue dots in gutter)==
+
=== code line indicators (blue dots in gutter)===
  
== Locals ==
+
=== Locals ===
 
* except for currency type variables
 
* except for currency type variables
  
== Watches (partial) ==
+
=== Watches (partial) ===
  
 
Watches that are not implemented are handed to the normal GDB based evaluation, and the result will be prefixed with "{GDB:}"
 
Watches that are not implemented are handed to the normal GDB based evaluation, and the result will be prefixed with "{GDB:}"
Line 84: Line 84:
 
* = <> < > <= >= for int and float
 
* = <> < > <= >= for int and float
  
All calculation are currently done without overflow checking. Overflown results will be used without indication of this.
+
All calculations are currently done without overflow checking. Overflown results will be used without indication of this.
  
@ currently return typed pointers in the debugger. This matters for (@WordVar+2)^ , which increments by 2 words. (4 bytes)
+
@ currently returns typed pointers in the debugger. This matters for (@WordVar+2)^ , which increments by 2 words (4 bytes).
  
Fields in objects are ordered by base-class last. This means that in Foo:TFoo fields declared in TFoo are shown before fields in TObject (base). As a result field order does not represent memory layout (not sure if it actually is guaranteed with gdb)
+
Fields in objects are ordered by base-class last. This means that in Foo:TFoo fields declared in TFoo are shown before fields in TObject (base). As a result field order does not represent memory layout (not sure if it actually is guaranteed with gdb).
  
 
Setting in the watch properties:
 
Setting in the watch properties:

Revision as of 13:57, 3 May 2014

Warning-icon.png

Warning: FpGdbmiDebugger is still in alpha Development. It is advised not to use it for production. While using FpGdbmiDebugger problems including (but not limited to) the following may occur:

  • Crashes of the IDE or Debugger
  • Incorrect behaviour of the IDE or debugger
  • Display of incorrect Values

Light bulb  Note: FpGdbmiDebugger does not yet fix any of the following issues:

  • Properties can still not be shown
  • Watches can not call functions
  • Strings can not be distinguished from pchar
  • open array (in function params) are not handled




About

FpGdbmiDebugger is an extension of the GdbmiDebugger used by the IDE. Both debuggers use GDB.

FpGdbmiDebugger is intended to keep GDB as a back-end, so it can later be extended to use gdbserver for remote debugging. (An additional debugger that does not depend on GDB will also be developed, and like FpGdbmiDebugger, it will be based on the FpDebug package)

FpGdbmiDebugger is designed to perform some tasks without needing GDB:

  • Reading Line-Info, for displaying the blue gutter dots (working)
  • Reading Dwarf to evaluate Locals and watches (partly done)
    Reading data from the debuggee is done via gdb memread, but does not need gdb to have knowledge of Pascal values. Except on Windows where data can be read directly.
  • Reading Stackframes/traces (not yet done)
  • Disassemble (not yet done)

FpGdbmiDebugger is not intended to perform execution control directly (this is left to gdb), such as stepping, and running between breakpoints. (For this there will be a gdb free debugger)

Testing

See progress for which features are implemented. Any feature not mentioned should be assumed not yet to be implemented.

Do NOT report any unimplemented features.

To verify displayed watch values, a menu entry "Display GDB instead of FPDebug values" is available in the run menu (when the package is installed). This will be only while the package is in development.

To test FpGdbmiDebugger, install the package components/lazdebuggers/lazdebbugerfpgdbmi.lpk

There is also a testcase in that directory. Please read the comments in the *.sample files.


Progress

Warning-icon.png

Warning: FpGdbmiDebugger only works with Dwarf 2 (+ dwarfsets)

The following features should work

code line indicators (blue dots in gutter)

Locals

  • except for currency type variables

Watches (partial)

Watches that are not implemented are handed to the normal GDB based evaluation, and the result will be prefixed with "{GDB:}"

Watches include hint evaluation, and debug-inspector.


Improvements over the GDB based version:

Not yet implemented:

  • currency variables are incorrectly displayed
  • Strings are handled the same as on normal GDB (handled an PChar). s[1] will display result for string and for pchar.
  • unitname.identifier

The following expressions can be evaluated (if not listed, then it is not implemented)

  • simple terms (just an identifier)
  • typecasts
  • @ and ^ (address of and deref)
  • "^TFoo(x)" typecast x, as pointer to TFoo
  • () bracketed expression "a*(b+c)"
  • [] index for arrays, pointers, and pchar
  • . Foo.Bar access of members
  • constant numbers in decimal, hex ($), oct (&), bin (%)
  • +-*/ for int and float
  • +- for pointer+int
  • div for int
  • = <> < > <= >= for int and float

All calculations are currently done without overflow checking. Overflown results will be used without indication of this.

@ currently returns typed pointers in the debugger. This matters for (@WordVar+2)^ , which increments by 2 words (4 bytes).

Fields in objects are ordered by base-class last. This means that in Foo:TFoo fields declared in TFoo are shown before fields in TObject (base). As a result field order does not represent memory layout (not sure if it actually is guaranteed with gdb).

Setting in the watch properties:

  • RepeatCount for watches is not implemented
  • DisplayFormats (default, pointer, hex, structure, mem dump) are partly implemented
  • use instance class is implemented