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]

[commit] Fix ARI regressions (Re: New ARI warning Sat Jan 21 01:55:38 UTC 2012)


> 369a370
> > gdb/inf-child.c:36: regression: stat.h: Do not include stat.h or sys/stat.h, instead include gdb_stat.h
> gdb/inf-child.c:36:#include <sys/stat.h>

> > gdb/linux-tdep.c:413: code: if assignment: An IF statement's expression contains an assignment (the GNU coding standard discourages this)
> gdb/linux-tdep.c:413:	  if (*p == '.' && (ep = strchr (p, '.')) != NULL)
> 938a922,923

> > gdb/target.c:3261: code: %p: Do not use printf(%p), instead use printf(%s,paddr()) to dump a target address, or host_address_to_string() for a host address
> gdb/target.c:3261:				"target_fileio_pwrite (%d,%p,%d,%s) "
> > gdb/target.c:3291: code: %p: Do not use printf(%p), instead use printf(%s,paddr()) to dump a target address, or host_address_to_string() for a host address
> gdb/target.c:3291:				"target_fileio_pread (%d,%p,%d,%s) "

Fixed by the patch below.

Tested on i386-linux, committed to mainline.

Bye,
Ulrich


ChangeLog:

	* inf-child.c: Include "gdb_stat.h" instead of <sys/stat.h>.
	* linux-tdep.c (linux_info_proc): Avoid ARI coding style warning.
	* target.c (target_fileio_pwrite): Remove buffer address from
	debug output.
	(target_fileio_pread): Likewise.

Index: gdb/inf-child.c
===================================================================
RCS file: /cvs/src/src/gdb/inf-child.c,v
retrieving revision 1.30
diff -u -p -r1.30 inf-child.c
--- gdb/inf-child.c	20 Jan 2012 09:47:32 -0000	1.30
+++ gdb/inf-child.c	23 Jan 2012 13:30:07 -0000
@@ -26,6 +26,7 @@
 #include "target.h"
 #include "inferior.h"
 #include "gdb_string.h"
+#include "gdb_stat.h"
 #include "inf-child.h"
 #include "gdb/fileio.h"
 
@@ -33,7 +34,6 @@
 #include <sys/param.h>		/* for MAXPATHLEN */
 #endif
 #include <sys/types.h>
-#include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
 
Index: gdb/linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-tdep.c,v
retrieving revision 1.15
diff -u -p -r1.15 linux-tdep.c
--- gdb/linux-tdep.c	20 Jan 2012 09:59:15 -0000	1.15
+++ gdb/linux-tdep.c	23 Jan 2012 13:30:08 -0000
@@ -402,7 +402,6 @@ linux_info_proc (struct gdbarch *gdbarch
 	{
 	  struct cleanup *cleanup = make_cleanup (xfree, data);
 	  const char *p = data;
-	  const char *ep;
 	  ULONGEST val;
 
 	  printf_filtered (_("Process: %s\n"),
@@ -410,10 +409,15 @@ linux_info_proc (struct gdbarch *gdbarch
 
 	  while (*p && isspace (*p))
 	    p++;
-	  if (*p == '(' && (ep = strchr (p, ')')) != NULL)
+	  if (*p == '(')
 	    {
-	      printf_filtered ("Exec file: %.*s\n", (int) (ep - p - 1), p + 1);
-	      p = ep + 1;
+	      const char *ep = strchr (p, ')');
+	      if (ep != NULL)
+		{
+		  printf_filtered ("Exec file: %.*s\n",
+				   (int) (ep - p - 1), p + 1);
+		  p = ep + 1;
+		}
 	    }
 
 	  while (*p && isspace (*p))
Index: gdb/target.c
===================================================================
RCS file: /cvs/src/src/gdb/target.c,v
retrieving revision 1.298
diff -u -p -r1.298 target.c
--- gdb/target.c	20 Jan 2012 09:49:01 -0000	1.298
+++ gdb/target.c	23 Jan 2012 13:30:09 -0000
@@ -3258,9 +3258,9 @@ target_fileio_pwrite (int fd, const gdb_
 
 	  if (targetdebug)
 	    fprintf_unfiltered (gdb_stdlog,
-				"target_fileio_pwrite (%d,%p,%d,%s) "
+				"target_fileio_pwrite (%d,...,%d,%s) "
 				"= %d (%d)\n",
-				fd, write_buf, len, pulongest (offset),
+				fd, len, pulongest (offset),
 				ret, ret != -1 ? 0 : *target_errno);
 	  return ret;
 	}
@@ -3288,9 +3288,9 @@ target_fileio_pread (int fd, gdb_byte *r
 
 	  if (targetdebug)
 	    fprintf_unfiltered (gdb_stdlog,
-				"target_fileio_pread (%d,%p,%d,%s) "
+				"target_fileio_pread (%d,...,%d,%s) "
 				"= %d (%d)\n",
-				fd, read_buf, len, pulongest (offset),
+				fd, len, pulongest (offset),
 				ret, ret != -1 ? 0 : *target_errno);
 	  return ret;
 	}

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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