On Fri, 2011-09-30 at 15:54 +0100, Martin wrote:
> On 30/09/2011 15:45, Joost van der Sluis wrote:
> > On Fri, 2011-09-30 at 21:47 +0800, Paul Ishenin wrote:
> >> 30.09.2011 21:02, Joost van der Sluis wrote:
> >>> Hi all,
> >>>
> >>> For all those who are interested in new debug-features of fpc and gdb, I
> >>> have cross-compiled a gdb-executable for Windows.
> >>>
> >>> It's based on the Fedora-16 branch from the Archer project. But I added
> >>> a few patches of my own, namely the patch to recognize methods, setting
> >>> case-sensitivity off by default and a patch to allow evaluating
> >>> method-values (without actually calling them.)
> >> How can this be possible? Some internal virtual machine?
> > Huh? The compilation of the Fedora-gdb-sources for Windows? Fedora comes
> > with an out-of-the-box mingw cross-compiler. (Not really a vm)
> >
> 
> I think this was about:
> > evaluating
> > method-values (without actually calling them.)
> 
> which got me curious too.

It's nothing important. It's just a very small bug in gdb that got
fixed.

> Now reading it again, does it mean:
> 1) gdb can (magically?) get the return value of a function/method, but 
> WITHOUT calling/invoking the function (e.g. for properties)
> 2) gdb can "evaluate" the type of a method. e.g return "ptype 
> Tfoo.Method" = "function(a:int): boolean"

The second. When you do 'p functionname' you get some background
information about the function. When you do 'p functionname()' it will
call the function.
This didn't work for methods, so 'p class.methodname()' did work while
'p class.methodname' didn't. That's what's fixed.

The (simple) patch is attached.

But what we could do now is write debuginfo for properties with getters
as if it is a function. The answer of 'p class.propertyname' will tell
you it's a function, which yould be called if you want to.


Joost
-- 
My Lazarus blog: http://www.lazarussupport.com/lazarus/weblog
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index d98b3a4..9d14a9e 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -391,6 +391,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
       break;
 
     case TYPE_CODE_FUNC:
+    case TYPE_CODE_METHOD:
       if (options->format)
 	{
 	  val_print_scalar_formatted (type, valaddr, embedded_offset,
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to