[PATCH] Function pointer var problem

Vladimir Prus ghost at cs.msu.su
Fri Jul 8 11:02:07 UTC 2005

consider the following definition

   int (*p3)(int) = (fp)0x000000AE;

KDevelop shows this variable just fine, but when I expand the 'p3' variable
item, I see:

   int (int)} 0xb7ee6e9 ....

as a value. Note the bogus type before the value (in particular, closing
brace without starting brace. The problem is that gdb returns this when
asked about the value:

   $1 = {int (int)} 0xb7ee6e9c <__DTOR_END__+4>

and looks like value parser thinks it's array, or something like that. This
behaviour is present in unmodified KDevelop3 from KDE 3.3, as well as in

GDBParser::getValue has this logic:

  if (*start == '{')
        return QCString(start+1, *buf - start -1);

This handles arrays nice, but chokes on the function pointer value. Any
ideas what should we do? I can change the logic so that we check if there's
'}' as last character, and if not, removing the {}-delimited part at the
beginning, just like is not done with leading "(unsigned int*)" for
pointers. The attached patch fixes the problem and still shows structures
and arrays fine.


At the same time, I've asked on gdb mailing list why braces, and not
parenthesis, is used in that case. But even if a change is made, it will be
a long time before kdevelop can expect that gdb behaves sensibly.

- Volodya
-------------- next part --------------
A non-text attachment was scrubbed...
Name: function_pointer.diff
Type: text/x-diff
Size: 2550 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20050708/022d75ed/attachment.bin>

More information about the KDevelop-devel mailing list