From: Vladislav Ivanishin Date: Sun, 14 Jul 2019 13:19:29 +0000 (+0000) Subject: gdbhooks.py: dump-fn, dot-fn: cast ret values of fopen/fclose X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cbfde6ee68dab649e3cf86b0ae569f2fc6ef3900;p=gcc.git gdbhooks.py: dump-fn, dot-fn: cast ret values of fopen/fclose Work around the following (gdb) Python Exception '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 This is due to GDB not being able to pick up and use the return types from debug info for external declarations. 2019-07-14 Vladislav Ivanishin * gdbhooks.py (DumpFn.invoke): Add explicit casts of return values of fopen and fclose to their respective types. (DotFn.invoke): Ditto. From-SVN: r273480 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9b5cc7a5b5b..a9887b72e92 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-07-14 Vladislav Ivanishin + + * gdbhooks.py (DumpFn.invoke): Add explicit casts of return values of + fopen and fclose to their respective types. + (DotFn.invoke): Ditto. + 2019-07-14 Jan Hubicka * ipa-fnsummary.c (ipa_dump_hints): Do not dump array_index. diff --git a/gcc/gdbhooks.py b/gcc/gdbhooks.py index 191a5e2dfec..09802c9ce24 100644 --- a/gcc/gdbhooks.py +++ b/gcc/gdbhooks.py @@ -740,18 +740,17 @@ class DumpFn(gdb.Command): f.close() # Open file - fp = gdb.parse_and_eval("fopen (\"%s\", \"w\")" % filename) + fp = gdb.parse_and_eval("(FILE *) fopen (\"%s\", \"w\")" % filename) if fp == 0: print ("Could not open file: %s" % filename) return - fp = "(FILE *)%u" % fp # Dump function to file _ = gdb.parse_and_eval("dump_function_to_file (%s, %s, %u)" % (func, fp, flags)) # Close file - ret = gdb.parse_and_eval("fclose (%s)" % fp) + ret = gdb.parse_and_eval("(int) fclose (%s)" % fp) if ret != 0: print ("Could not close file: %s" % filename) return @@ -810,11 +809,10 @@ class DotFn(gdb.Command): # Close and reopen temp file to get C FILE* f.close() - fp = gdb.parse_and_eval("fopen (\"%s\", \"w\")" % filename) + fp = gdb.parse_and_eval("(FILE *) fopen (\"%s\", \"w\")" % filename) if fp == 0: print("Cannot open temp file") return - fp = "(FILE *)%u" % fp # Write graph to temp file _ = gdb.parse_and_eval("start_graph_dump (%s, \"\")" % fp) @@ -823,7 +821,7 @@ class DotFn(gdb.Command): _ = gdb.parse_and_eval("end_graph_dump (%s)" % fp) # Close temp file - ret = gdb.parse_and_eval("fclose (%s)" % fp) + ret = gdb.parse_and_eval("(int) fclose (%s)" % fp) if ret != 0: print("Could not close temp file: %s" % filename) return