[fpc-devel] Calling virtual methods in GDB

Martin lazarus at mfriebe.de
Tue Sep 27 22:00:13 CEST 2011


On 27/09/2011 16:58, Joost van der Sluis wrote:
> Hi all,
>
> I've just committed a fix (r19253) which makes it possible to call
> virtual methods within GDB. (Or other Dwarf-debuggers, when they
> support that properly)
>
> Only problem is that when GDB is in Pascal mode, it won't work. I have
> written a patch for that
> (http://cygwin.com/ml/gdb/2011-09/msg00072.html) or you can set GDB to
> use C, and then call the virtual function.
Ah, cygwin => I have never tested the gdb from them. I always use the 
mingw version

>
> Note however that there still could be issues regarding the
> calling-convention. With a simple function returning an integer it
> works, however. ;)
>

In theory, it should be possible to prepare the stack, and set the pc 
via register modification? But, no, no, no, i do not think it is a good 
idea, and probably will bring more new problems.

But there is another issue to be looked into. I haven't done that yet.

- Breakpoints => if in the executed function, any breakpoints are hit...
- Exceptions => I know gdb has some features to restore the stackframe 
=> but I have no idea, if that relies on c-style stuff, or would work 
with fpc exceptions too.





More information about the fpc-devel mailing list