This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] cleanup: Wunused corefile.c


On 13-02-01 04:31 PM, Aleksandar Ristovski wrote:
On 13-02-01 02:25 PM, Tom Tromey wrote:

I understand, but I think the hard part of this work is also the most useful part. What I mean is that it is certainly valuable to get all the simple cases fixed; but going through the trickier cases and writing proper fixes is the real benefit of enabling this warning -- finding and fixing real bugs. Making these warnings disappear is contrary to that.


I agree and I don't agree. I'm not shy from hard work, but I simply have limited time resources for contributing back to FSF.

I really believe making warnings disappear and turning on Wunused by
default would make a big difference worth "obscuring" a bug or two (they
are already obscure as we are not aware of them). Once Wunused is on by
default, there will not be creeping in of unused stuff any more.


But here is revised patch for corefile.c. Not that it represents any hard work or anything, but since I was at...


Thanks,


Aleksandar Ristovski
QNX Software Systems



ChangeLog:
  Aleksandar Ristovski  <aristovski@qnx.com>

* corefile.c (reopen_exec_file): Check return value from stat.



Sorry it should have been errno for strerror not res:

Index: gdb/corefile.c
===================================================================
RCS file: /cvs/src/src/gdb/corefile.c,v
retrieving revision 1.71
diff -u -p -r1.71 corefile.c
--- gdb/corefile.c      14 Jan 2013 21:03:54 -0000      1.71
+++ gdb/corefile.c      1 Feb 2013 21:48:42 -0000
@@ -149,7 +149,11 @@ reopen_exec_file (void)
   cleanups = make_cleanup (xfree, filename);
   res = stat (filename, &st);

-  if (exec_bfd_mtime && exec_bfd_mtime != st.st_mtime)
+  if (res != 0 && info_verbose)
+    warning (_("File %s could not be stat-ed (%s)\n"), filename,
+            strerror (errno));
+
+  if (res == 0 && exec_bfd_mtime && exec_bfd_mtime != st.st_mtime)
     exec_file_attach (filename, 0);
   else
     /* If we accessed the file since last opening it, close it now;




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]