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]

[PATCH][commit/obvious] Fix for PR gdb/16014


Hi,

There were two functions who were calling "sizeof" twice.

The first one, dw2_get_real_path from gdb/dwarf2read.c, was actually
making use of OBSTACK_CALLOC which already calls "sizeof" for its third
argument.

The second, download_tracepoint_1 from gdb/gdbserver/tracepoint.c, was
explicitly calling "sizeof" inside another "sizeof".

This patch fixes both functions.  Checked-in as obvious.

     https://sourceware.org/ml/gdb-cvs/2013-10/msg00099.html

Thanks,

-- 
Sergio

Index: gdb/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.16104
diff -u -r1.16104 ChangeLog
--- gdb/ChangeLog	16 Oct 2013 02:41:42 -0000	1.16104
+++ gdb/ChangeLog	16 Oct 2013 02:51:44 -0000
@@ -1,5 +1,11 @@
 2013-10-16  Sergio Durigan Junior  <sergiodj@redhat.com>
 
+	PR gdb/16014
+	* dwarf2read.c (dw2_get_real_path): Remove unnecessary call to
+	sizeof.
+
+2013-10-16  Sergio Durigan Junior  <sergiodj@redhat.com>
+
 	PR gdb/16042
 	* target.c (target_disable_btrace): Fix invalid return value for
 	void function.
Index: gdb/dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.843
diff -u -r1.843 dwarf2read.c
--- gdb/dwarf2read.c	9 Oct 2013 14:26:26 -0000	1.843
+++ gdb/dwarf2read.c	16 Oct 2013 02:51:45 -0000
@@ -3278,7 +3278,7 @@
 {
   if (qfn->real_names == NULL)
     qfn->real_names = OBSTACK_CALLOC (&objfile->objfile_obstack,
-				      qfn->num_file_names, sizeof (char *));
+				      qfn->num_file_names, char *);
 
   if (qfn->real_names[index] == NULL)
     qfn->real_names[index] = gdb_realpath (qfn->file_names[index]);
Index: gdb/gdbserver/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/ChangeLog,v
retrieving revision 1.776
diff -u -r1.776 ChangeLog
--- gdb/gdbserver/ChangeLog	2 Oct 2013 11:42:35 -0000	1.776
+++ gdb/gdbserver/ChangeLog	16 Oct 2013 02:51:46 -0000
@@ -1,3 +1,9 @@
+2013-10-16  Sergio Durigan Junior  <sergiodj@redhat.com>
+
+	PR gdb/16014
+	* tracepoint.c (download_tracepoint_1): Remove unnecessary double
+	call to sizeof.
+
 2013-10-02  Pedro Alves  <palves@redhat.com>
 
 	* server.c (process_serial_event): Don't output "GDBserver
Index: gdb/gdbserver/tracepoint.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/tracepoint.c,v
retrieving revision 1.83
diff -u -r1.83 tracepoint.c
--- gdb/gdbserver/tracepoint.c	5 Sep 2013 20:40:33 -0000	1.83
+++ gdb/gdbserver/tracepoint.c	16 Oct 2013 02:51:47 -0000
@@ -6023,7 +6023,7 @@
 
 	  if (ipa_action != 0)
 	    write_inferior_data_ptr
-	      (actions_array + i * sizeof (sizeof (*tpoint->actions)),
+	      (actions_array + i * sizeof (*tpoint->actions),
 	       ipa_action);
 	}
     }


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