[PATCH] gdbhooks.py: dump-fn, dot-fn: cast ret values of fopen/fclose

Vladislav Ivanishin vlad@ispras.ru
Tue Jul 9 15:17:00 GMT 2019


Hi,

Without the patch, I see these error messages with gdb 8.3:

    (gdb) Python Exception <class 'gdb.error'> 'fclose@@GLIBC_2.2.5' has
    unknown return type; cast the call to its declared return type:
    (gdb) Error occurred in Python: 'fclose@@GLIBC_2.2.5' has unknown
    return type; cast the call to its declared return type

One doesn't have to use python to reproduce that: start debugging cc1
and issue

    (gdb) call fopen ("", "")

This actually looks like a GDB bug: from looking at cc1's (built with
either -g, or -ggdb3) DWARF with either dwarfdump, or readelf I see that
there is info about the return type (for fopen it's FILE *, and `ptype
FILE` in gdb gives the full struct).

Tom, you contributed the {dot,dump}-fn functions.  Do they still work
for you without the patch?  (And if so, do you happen to have debuginfo
for libc installed on you machine?)

I think, the patch itself is obvious (as a workaround).  I've only
tested it with the version of GDB I have (8.3, which is the latest
release), but expect this to work for older versions as well.

(Comparisons of gdb.Value's returned from parse_and_eval, like fp == 0
and their conversion to python strings in "%s" % fp work automagically.)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-gdbhooks.py-dump-fn-dot-fn-cast-ret-values-of-fopen-.patch
Type: text/x-patch
Size: 2011 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190709/3a9765b5/attachment.bin>
-------------- next part --------------
-- 
Vlad


More information about the Gcc-patches mailing list