[Lazarus] RE : Issuing debug commands from the ide.

Martin lazarus at mfriebe.de
Fri Jun 1 16:09:59 CEST 2012


On 01/06/2012 14:47, Ludo Brands wrote:
>> Have you tried to compile the IDE with DBG_WITH_DEBUGGER_DEBUG
>>    defined?
>>
>> It does exactly the above. It has been there a very long time.
>>
> No didn't know about that define. I didn't encounter anything like that and
> I actualy did search for somehting like that before starting to do any
> coding. Searching for the define in the files I opened in the IDE only
> brings up the conditional declaration of  function GetDebugger: TDebugger;.
did you include the debugger directory?

> So it seems I have been working in a completely different area of the code.
> Where would I enter teh debugger commands when using
> DBG_WITH_DEBUGGER_DEBUG?
In the "Debug output" window. Where all the gdb stuff is.

>>> If anybody is interested in this, I'll submit it to mantis.
>>>
>> Not sure of the use of that?
>> What data do you want to display?
>>
> I have had too many cases where I had to use the gdb command line to debug
> code. Reason why I wanted to do something about it.
> Examples:
> - wrote a while ago a fpc program that had to do some stack walking. Hence
> the x/20x $sp example.
http://imagebin.org/214731

memory dump of $pc^

> - searching in and displaying a particular memory area that is in pascal
> just a pointer. When tracing in assembler there are many cases where I would
> like to now the contents of the memory area pointed to by a register.
see above

> - tried to get to the VMT of a COM interface yesterday

You need to dig into FPC, to find the offset .

Not sure how to bes do in, as you need to get tthe interface from the 
objecht first, I guess?

Here is how the instance class name is gotten

-data-evaluate-expression (^^^char(self)^+3)^

the 2 inner ^^ are just pointer. There could be any type. Wouldn't need 
to be char.
The first address of the object points to the VMT, in the VMT the 
pointer to the name (shortstring) is the 3 entry


To try stuff like that, the "Evaluate/Modify" window is quite good too.


> - info fun with partial function names
Not sure what you mean:
But you know the debug inspector (context menu on watches) shows the 
objects method (if they are avail)

> - set a breakpoint at non fpc code (dll exported symbols for example)
We have address breakpoints, you can set them in the disassembler.

or "Add" > "Address BrkPoint" and enter address. Either context menu in 
breakpoint list, or main menu "Run"
http://wiki.lazarus.freepascal.org/IDE_Window:Breakpoints

There are watch point too, if your hardware supports it


> - etc.
>
> Non of this is to debug the debugger.
>

Right, there are features in gdb, that the IDE does not yet support 
(e.g. attach/ detach)

Better to implement the features ....

But feel free to use that define





More information about the Lazarus mailing list