public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] readelf: Don't allocate string with asprintf, but reuse buffer with sprintf.
@ 2018-06-04 17:05 Mark Wielaard
  2018-06-06 20:37 ` Mark Wielaard
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Wielaard @ 2018-06-04 17:05 UTC (permalink / raw)
  To: elfutils-devel; +Cc: Mark Wielaard

Since we are single threaded we can just use a static result buffer for
format_dwarf_addr as long as we make sure to print the result before
calling format_dwarf_addr again. This removes lots of malloc/free calls.

On my machine eu-readelf -N --debug-dump=info libxul.so
goes from 57 seconds to 55 seconds.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 src/ChangeLog |  20 +++++++
 src/readelf.c | 182 ++++++++++++++++++++++++----------------------------------
 2 files changed, 96 insertions(+), 106 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 9ee9650..37e2471 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,25 @@
 2018-06-04  Mark Wielaard  <mark@klomp.org>
 
+	* readelf (format_result): New static char pointer.
+	(format_result_size): New static size_t.
+	(format_dwarf_addr): Calculate max string size, reuse format_result
+	if possible, otherwise realloc. Use sprintf on result, not asprintf.
+	(print_ops): Don't free format_dwarf_addr, make sure result is
+	printed before calling format_dwarf_addr again.
+	(print_debug_addr_section): Likewise.
+	(print_debug_aranges_section): Likewise.
+	(print_debug_rnglists_section): Likewise.
+	(print_debug_ranges_section): Likewise.
+	(print_debug_frame_section): Likewise.
+	(attr_callback): Likewise.
+	(print_decoded_line_section): Likewise.
+	(print_debug_line_section): Likewise.
+	(print_debug_loclists_section): Likewise.
+	(print_debug_loc_section): Likewise.
+	(print_gdb_index_section): Likewsie.
+
+2018-06-04  Mark Wielaard  <mark@klomp.org>
+
 	* readelf.c (yes_str): New static char pointer.
 	(no_str): Likewise.
 	(main): Set yes_str and no_str using gettext.
diff --git a/src/readelf.c b/src/readelf.c
index 81d1094..8f37f17 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -3695,6 +3695,9 @@ print_attributes (Ebl *ebl, const GElf_Ehdr *ehdr)
 }
 
 
+static char *format_result = NULL;
+static size_t format_result_size = 0;
+
 static char *
 format_dwarf_addr (Dwfl_Module *dwflmod,
 		   int address_size, Dwarf_Addr address, Dwarf_Addr raw)
@@ -3724,56 +3727,71 @@ format_dwarf_addr (Dwfl_Module *dwflmod,
     }
 
   char *result;
+  size_t max_size = ((name != NULL ? strlen (name) : 0)
+		     + (scn != NULL ? strlen (scn) : 0)
+		     + (2 + 8 * 2) * 2 + 6);
+  if (max_size > format_result_size)
+    {
+      max_size *= 2; /* A bit more, so we don't immediately realloc again.  */
+      result = realloc (format_result, max_size);
+      if (result == NULL)
+	error (EXIT_FAILURE, 0, _("memory exhausted"));
+      format_result_size = max_size;
+      format_result = result;
+    }
+  else
+    result = format_result;
+
   if ((name != NULL
        ? (off != 0
 	  ? (scn != NULL
 	     ? (address_size == 0
-		? asprintf (&result,
-			    gettext ("%s+%#" PRIx64 " <%s+%#" PRIx64 ">"),
-			    scn, address, name, off)
-		: asprintf (&result,
-			    gettext ("%s+%#0*" PRIx64 " <%s+%#" PRIx64 ">"),
-			    scn, 2 + address_size * 2, address,
-			    name, off))
+		? sprintf (result,
+			   "%s+%#" PRIx64 " <%s+%#" PRIx64 ">",
+			   scn, address, name, off)
+		: sprintf (result,
+			   "%s+%#0*" PRIx64 " <%s+%#" PRIx64 ">",
+			   scn, 2 + address_size * 2, address,
+			   name, off))
 	     : (address_size == 0
-		? asprintf (&result,
-			    gettext ("%#" PRIx64 " <%s+%#" PRIx64 ">"),
-			    address, name, off)
-		: asprintf (&result,
-			    gettext ("%#0*" PRIx64 " <%s+%#" PRIx64 ">"),
-			    2 + address_size * 2, address,
-			    name, off)))
+		? sprintf (result,
+			   "%#" PRIx64 " <%s+%#" PRIx64 ">",
+			   address, name, off)
+		: sprintf (result,
+			   "%#0*" PRIx64 " <%s+%#" PRIx64 ">",
+			   2 + address_size * 2, address,
+			   name, off)))
 	  : (scn != NULL
 	     ? (address_size == 0
-		? asprintf (&result,
-			    gettext ("%s+%#" PRIx64 " <%s>"),
-			    scn, address, name)
-		: asprintf (&result,
-			    gettext ("%s+%#0*" PRIx64 " <%s>"),
-			    scn, 2 + address_size * 2, address, name))
+		? sprintf (result,
+			   "%s+%#" PRIx64 " <%s>",
+			   scn, address, name)
+		: sprintf (result,
+			   "%s+%#0*" PRIx64 " <%s>",
+			   scn, 2 + address_size * 2, address, name))
 	     : (address_size == 0
-		? asprintf (&result,
-			    gettext ("%#" PRIx64 " <%s>"),
-			    address, name)
-		: asprintf (&result,
-			    gettext ("%#0*" PRIx64 " <%s>"),
-			    2 + address_size * 2, address, name))))
+		? sprintf (result,
+			   "%#" PRIx64 " <%s>",
+			   address, name)
+		: sprintf (result,
+			   "%#0*" PRIx64 " <%s>",
+			   2 + address_size * 2, address, name))))
        : (scn != NULL
 	  ? (address_size == 0
-	     ? asprintf (&result,
-			 gettext ("%s+%#" PRIx64),
-			 scn, address)
-	     : asprintf (&result,
-			 gettext ("%s+%#0*" PRIx64),
-			 scn, 2 + address_size * 2, address))
+	     ? sprintf (result,
+			"%s+%#" PRIx64,
+			scn, address)
+	     : sprintf (result,
+			"%s+%#0*" PRIx64,
+			scn, 2 + address_size * 2, address))
 	  : (address_size == 0
-	     ? asprintf (&result,
-			 "%#" PRIx64,
-			 address)
-	     : asprintf (&result,
-			 "%#0*" PRIx64,
-			 2 + address_size * 2, address)))) < 0)
-    error (EXIT_FAILURE, 0, _("memory exhausted"));
+	     ? sprintf (result,
+			"%#" PRIx64,
+			address)
+	     : sprintf (result,
+			"%#0*" PRIx64,
+			2 + address_size * 2, address)))) < 0)
+    error (EXIT_FAILURE, 0, _("sprintf failure"));
 
   return result;
 }
@@ -4355,7 +4373,6 @@ print_ops (Dwfl_Module *dwflmod, Dwarf *dbg, int indent, int indentrest,
 	  char *a = format_dwarf_addr (dwflmod, 0, addr, addr);
 	  printf ("%*s[%2" PRIuMAX "] %s %s\n",
 		  indent, "", (uintmax_t) offset, op_name, a);
-	  free (a);
 
 	  offset += 1 + addrsize;
 	  break;
@@ -4501,7 +4518,6 @@ print_ops (Dwfl_Module *dwflmod, Dwarf *dbg, int indent, int indentrest,
 	    {
 	      a = format_dwarf_addr (dwflmod, 0, addr, addr);
 	      printf ("%s\n", a);
-	      free (a);
 	    }
 	  break;
 
@@ -5287,7 +5303,6 @@ print_debug_addr_section (Dwfl_Module *dwflmod __attribute__ ((unused)),
 	  char *a = format_dwarf_addr (dwflmod, address_size,
 				       addr, addr);
 	  printf ("%s\n", a);
-	  free (a);
 	}
       printf ("\n");
 
@@ -5505,16 +5520,14 @@ print_debug_aranges_section (Dwfl_Module *dwflmod __attribute__ ((unused)),
 
 	  char *b = format_dwarf_addr (dwflmod, address_size, range_address,
 				       range_address);
+	  printf ("   %s", b);
 	  char *e = format_dwarf_addr (dwflmod, address_size,
 				       range_address + range_length - 1,
 				       range_length);
 	  if (segment_size != 0)
-	    printf (gettext ("   %s..%s (%" PRIx64 ")\n"), b, e,
-		    (uint64_t) segment);
+	    printf ("..%s (%" PRIx64 ")\n", e, (uint64_t) segment);
 	  else
-	    printf (gettext ("   %s..%s\n"), b, e);
-	  free (b);
-	  free (e);
+	    printf ("..%s\n", e);
 	}
 
     next_table:
@@ -5664,7 +5677,6 @@ print_debug_rnglists_section (Dwfl_Module *dwflmod,
 	  else
 	    printf (gettext (" CU [%6" PRIx64 "] base: %s\n"),
 		    dwarf_dieoffset (&cudie), basestr);
-	  free (basestr);
 	}
       else
 	printf (gettext (" Not associated with a CU.\n"));
@@ -5750,7 +5762,6 @@ print_debug_rnglists_section (Dwfl_Module *dwflmod,
 		      a1 = format_dwarf_addr (dwflmod, address_size,
 					      addr, addr);
 		      printf ("      %s\n", a1);
-		      free (a1);
 		    }
 		}
 	      break;
@@ -5777,12 +5788,10 @@ print_debug_rnglists_section (Dwfl_Module *dwflmod,
 		    {
 		      a1 = format_dwarf_addr (dwflmod, address_size,
 					      addr1, addr1);
+		      printf ("      %s..\n", a1);
 		      a2 = format_dwarf_addr (dwflmod, address_size,
 					      addr2 - 1, addr2);
-		      printf ("      %s..\n", a1);
 		      printf ("      %s\n", a2);
-		      free (a1);
-		      free (a2);
 		    }
 		}
 	      break;
@@ -5809,12 +5818,10 @@ print_debug_rnglists_section (Dwfl_Module *dwflmod,
 		      addr2 = addr1 + op2;
 		      a1 = format_dwarf_addr (dwflmod, address_size,
 					      addr1, addr1);
+		      printf ("      %s..\n", a1);
 		      a2 = format_dwarf_addr (dwflmod, address_size,
 					      addr2 - 1, addr2);
-		      printf ("      %s..\n", a1);
 		      printf ("      %s..\n", a2);
-		      free (a1);
-		      free (a2);
 		    }
 		}
 	      break;
@@ -5832,12 +5839,10 @@ print_debug_rnglists_section (Dwfl_Module *dwflmod,
 		  op1 += base;
 		  op2 += base;
 		  a1 = format_dwarf_addr (dwflmod, address_size, op1, op1);
+		  printf ("      %s..\n", a1);
 		  a2 = format_dwarf_addr (dwflmod, address_size,
 					  op2 - 1, op2);
-		  printf ("      %s..\n", a1);
 		  printf ("      %s\n", a2);
-		  free (a1);
-		  free (a2);
 		}
 	      break;
 
@@ -5860,7 +5865,6 @@ print_debug_rnglists_section (Dwfl_Module *dwflmod,
 		{
 		  a1 = format_dwarf_addr (dwflmod, address_size, base, base);
 		  printf ("      %s\n", a1);
-		  free (a1);
 		}
 	      break;
 
@@ -5883,12 +5887,10 @@ print_debug_rnglists_section (Dwfl_Module *dwflmod,
 	      if (! print_unresolved_addresses)
 		{
 		  a1 = format_dwarf_addr (dwflmod, address_size, op1, op1);
+		  printf ("      %s..\n", a1);
 		  a2 = format_dwarf_addr (dwflmod, address_size,
 					  op2 - 1, op2);
-		  printf ("      %s..\n", a1);
 		  printf ("      %s\n", a2);
-		  free (a1);
-		  free (a2);
 		}
 	      break;
 
@@ -5912,13 +5914,12 @@ print_debug_rnglists_section (Dwfl_Module *dwflmod,
 	      if (! print_unresolved_addresses)
 		{
 		  a1 = format_dwarf_addr (dwflmod, address_size, op1, op1);
+		  printf ("      %s..\n", a1);
+
 		  op2 = op1 + op2;
 		  a2 = format_dwarf_addr (dwflmod, address_size,
 					  op2 - 1, op2);
-		  printf ("      %s..\n", a1);
 		  printf ("      %s\n", a2);
-		  free (a1);
-		  free (a2);
 		}
 	      break;
 
@@ -5990,7 +5991,6 @@ print_debug_ranges_section (Dwfl_Module *dwflmod,
 	  else
 	    printf (gettext ("\n CU [%6" PRIx64 "] base: %s\n"),
 		    dwarf_dieoffset (&cudie), basestr);
-	  free (basestr);
 	}
       last_cu = cu;
 
@@ -6019,7 +6019,6 @@ print_debug_ranges_section (Dwfl_Module *dwflmod,
 	{
 	  char *b = format_dwarf_addr (dwflmod, address_size, end, end);
 	  printf (gettext (" [%6tx] base address\n          %s\n"), offset, b);
-	  free (b);
 	  base = end;
 	}
       else if (begin == 0 && end == 0) /* End of list entry.  */
@@ -6041,12 +6040,10 @@ print_debug_ranges_section (Dwfl_Module *dwflmod,
 	    {
 	      char *b = format_dwarf_addr (dwflmod, address_size, base + begin,
 					   base + begin);
+	      printf ("          %s..\n", b);
 	      char *e = format_dwarf_addr (dwflmod, address_size,
 					   base + end - 1, base + end);
-	      printf ("          %s..\n", b);
 	      printf ("          %s\n", e);
-	      free (b);
-	      free (e);
 	    }
 
 	  first = false;
@@ -6818,7 +6815,6 @@ print_debug_frame_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
 		  "   initial_location:         %s",
 		  offset, (uint64_t) unit_length,
 		  cie->cie_offset, (uint64_t) cie_id, a);
-	  free (a);
 	  if ((fde_encoding & 0x70) == DW_EH_PE_pcrel)
 	    {
 	      vma_base = (((uint64_t) shdr->sh_offset
@@ -6986,7 +6982,6 @@ attr_callback (Dwarf_Attribute *attrp, void *arg)
 	    printf ("           %*s%-20s (%s) %s\n",
 		    (int) (level * 2), "", dwarf_attr_name (attr),
 		    dwarf_form_name (form), a);
-	  free (a);
 	}
       break;
 
@@ -7331,7 +7326,6 @@ attr_callback (Dwarf_Attribute *attrp, void *arg)
 	  printf ("           %*s%-20s (%s) %" PRIuMAX " (%s)\n",
 		  (int) (level * 2), "", dwarf_attr_name (attr),
 		  dwarf_form_name (form), (uintmax_t) num, a);
-	  free (a);
 	}
       else
 	{
@@ -7843,7 +7837,6 @@ print_decoded_line_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
 		  (epilogue_begin ? 'E' : ' '),
 		  (endseq ? '*' : ' '),
 		  disc, isa, lineop, a);
-	  free (a);
 
 	  if (endseq)
 	    printf("\n");
@@ -8535,7 +8528,6 @@ print_debug_line_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
 		printf (gettext ("\
  special opcode %u: address+%u = %s, line%+d = %zu\n"),
 			opcode, op_addr_advance, a, line_increment, line);
-	      free (a);
 	    }
 	  else if (opcode == 0)
 	    {
@@ -8577,7 +8569,6 @@ print_debug_line_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
 		  {
 		    char *a = format_dwarf_addr (dwflmod, 0, address, address);
 		    printf (gettext (" set address to %s\n"), a);
-		    free (a);
 		  }
 		  break;
 
@@ -8650,7 +8641,6 @@ print_debug_line_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
 		    else
 		      printf (gettext (" advance address by %u to %s\n"),
 			      op_addr_advance, a);
-		    free (a);
 		  }
 		  break;
 
@@ -8710,7 +8700,6 @@ print_debug_line_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
 		      printf (gettext ("\
  advance address by constant %u to %s\n"),
 			      op_addr_advance, a);
-		    free (a);
 		  }
 		  break;
 
@@ -8728,7 +8717,6 @@ print_debug_line_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
 		    printf (gettext ("\
  advance address by fixed value %u to %s\n"),
 			    u128, a);
-		    free (a);
 		  }
 		  break;
 
@@ -8895,7 +8883,6 @@ print_debug_loclists_section (Dwfl_Module *dwflmod,
 	  else
 	    printf (gettext (" CU [%6" PRIx64 "] base: %s\n"),
 		    dwarf_dieoffset (&cudie), basestr);
-	  free (basestr);
 	}
       else
 	printf (gettext (" Not associated with a CU.\n"));
@@ -8981,7 +8968,6 @@ print_debug_loclists_section (Dwfl_Module *dwflmod,
 		      a1 = format_dwarf_addr (dwflmod, address_size,
 					      addr, addr);
 		      printf ("      %s\n", a1);
-		      free (a1);
 		    }
 		}
 	      break;
@@ -9008,12 +8994,10 @@ print_debug_loclists_section (Dwfl_Module *dwflmod,
 		    {
 		      a1 = format_dwarf_addr (dwflmod, address_size,
 					      addr1, addr1);
+		      printf ("      %s..\n", a1);
 		      a2 = format_dwarf_addr (dwflmod, address_size,
 					      addr2 - 1, addr2);
-		      printf ("      %s..\n", a1);
 		      printf ("      %s\n", a2);
-		      free (a1);
-		      free (a2);
 		    }
 		}
 	      if ((uint64_t) (nexthdr - readp) < 1)
@@ -9048,12 +9032,10 @@ print_debug_loclists_section (Dwfl_Module *dwflmod,
 		      addr2 = addr1 + op2;
 		      a1 = format_dwarf_addr (dwflmod, address_size,
 					      addr1, addr1);
+		      printf ("      %s..\n", a1);
 		      a2 = format_dwarf_addr (dwflmod, address_size,
 					      addr2 - 1, addr2);
-		      printf ("      %s..\n", a1);
 		      printf ("      %s..\n", a2);
-		      free (a1);
-		      free (a2);
 		    }
 		}
 	      if ((uint64_t) (nexthdr - readp) < 1)
@@ -9079,12 +9061,10 @@ print_debug_loclists_section (Dwfl_Module *dwflmod,
 		  op1 += base;
 		  op2 += base;
 		  a1 = format_dwarf_addr (dwflmod, address_size, op1, op1);
+		  printf ("      %s..\n", a1);
 		  a2 = format_dwarf_addr (dwflmod, address_size,
 					  op2 - 1, op2);
-		  printf ("      %s..\n", a1);
 		  printf ("      %s\n", a2);
-		  free (a1);
-		  free (a2);
 		}
 	      if ((uint64_t) (nexthdr - readp) < 1)
 		goto invalid_entry;
@@ -9126,7 +9106,6 @@ print_debug_loclists_section (Dwfl_Module *dwflmod,
 		{
 		  a1 = format_dwarf_addr (dwflmod, address_size, base, base);
 		  printf ("      %s\n", a1);
-		  free (a1);
 		}
 	      break;
 
@@ -9149,12 +9128,10 @@ print_debug_loclists_section (Dwfl_Module *dwflmod,
 	      if (! print_unresolved_addresses)
 		{
 		  a1 = format_dwarf_addr (dwflmod, address_size, op1, op1);
+		  printf ("      %s..\n", a1);
 		  a2 = format_dwarf_addr (dwflmod, address_size,
 					  op2 - 1, op2);
-		  printf ("      %s..\n", a1);
 		  printf ("      %s\n", a2);
-		  free (a1);
-		  free (a2);
 		}
 	      if ((uint64_t) (nexthdr - readp) < 1)
 		goto invalid_entry;
@@ -9186,13 +9163,12 @@ print_debug_loclists_section (Dwfl_Module *dwflmod,
 	      if (! print_unresolved_addresses)
 		{
 		  a1 = format_dwarf_addr (dwflmod, address_size, op1, op1);
+		  printf ("      %s..\n", a1);
+
 		  op2 = op1 + op2;
 		  a2 = format_dwarf_addr (dwflmod, address_size,
 					  op2 - 1, op2);
-		  printf ("      %s..\n", a1);
 		  printf ("      %s\n", a2);
-		  free (a1);
-		  free (a2);
 		}
 	      if ((uint64_t) (nexthdr - readp) < 1)
 		goto invalid_entry;
@@ -9274,7 +9250,6 @@ print_debug_loc_section (Dwfl_Module *dwflmod,
 	else
 	  printf (gettext ("\n CU [%6" PRIx64 "] base: %s\n"),
 		  dwarf_dieoffset (&cudie), basestr);
-	free (basestr);
        }
       last_cu = cu;
 
@@ -9403,7 +9378,6 @@ print_debug_loc_section (Dwfl_Module *dwflmod,
 	{
 	  char *b = format_dwarf_addr (dwflmod, address_size, end, end);
 	  printf (gettext (" [%6tx] base address\n          %s\n"), offset, b);
-	  free (b);
 	  base = end;
 	}
       else if (begin == 0 && end == 0) /* End of list entry.  */
@@ -9429,12 +9403,10 @@ print_debug_loc_section (Dwfl_Module *dwflmod,
 	      Dwarf_Addr dae = use_base ? base + end : end;
 	      char *b = format_dwarf_addr (dwflmod, address_size,
 					   dab, dab);
+	      printf ("          %s..\n", b);
 	      char *e = format_dwarf_addr (dwflmod, address_size,
 					   dae - 1, dae);
-	      printf ("          %s..\n", b);
 	      printf ("          %s\n", e);
-	      free (b);
-	      free (e);
 	    }
 
 	  if (endp - readp <= (ptrdiff_t) len)
@@ -10694,11 +10666,9 @@ print_gdb_index_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
       readp += 4;
 
       char *l = format_dwarf_addr (dwflmod, 8, low, low);
+      printf (" [%4zu] %s..", n, l);
       char *h = format_dwarf_addr (dwflmod, 8, high - 1, high);
-      printf (" [%4zu] %s..%s, CU index: %5" PRId32 "\n",
-	      n, l, h, idx);
-      free (l);
-      free (h);
+      printf ("%s, CU index: %5" PRId32 "\n", h, idx);
       n++;
     }
 
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] readelf: Don't allocate string with asprintf, but reuse buffer with sprintf.
  2018-06-04 17:05 [PATCH] readelf: Don't allocate string with asprintf, but reuse buffer with sprintf Mark Wielaard
@ 2018-06-06 20:37 ` Mark Wielaard
  2018-06-07 21:44   ` Mark Wielaard
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Wielaard @ 2018-06-06 20:37 UTC (permalink / raw)
  To: elfutils-devel

On Mon, Jun 04, 2018 at 07:05:16PM +0200, Mark Wielaard wrote:
> Since we are single threaded we can just use a static result buffer for
> format_dwarf_addr as long as we make sure to print the result before
> calling format_dwarf_addr again. This removes lots of malloc/free calls.
> 
> On my machine eu-readelf -N --debug-dump=info libxul.so
> goes from 57 seconds to 55 seconds.

Pushed to master.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] readelf: Don't allocate string with asprintf, but reuse buffer with sprintf.
  2018-06-06 20:37 ` Mark Wielaard
@ 2018-06-07 21:44   ` Mark Wielaard
  2018-06-07 21:45     ` [PATCH 1/2] libdw: Make sure that address_size and offset_size are 4 or 8 bytes Mark Wielaard
  2018-06-07 21:46     ` [PATCH 2/2] readelf: Turn format_print_dwarf into print_dwarf_addr Mark Wielaard
  0 siblings, 2 replies; 7+ messages in thread
From: Mark Wielaard @ 2018-06-07 21:44 UTC (permalink / raw)
  To: elfutils-devel

On Mon, Jun 04, 2018 at 07:05:16PM +0200, Mark Wielaard wrote:
> Since we are single threaded we can just use a static result buffer for
> format_dwarf_addr as long as we make sure to print the result before
> calling format_dwarf_addr again. This removes lots of malloc/free calls.

Almost as soon as I checked this in the afl fuzzer detected that we
assumed addresses are max 8 bytes (64bits). So it presented us with
a CU that has an address size of 136 bytes... We dutifully try to
print that large an address into a buffer that has room for just 8
and crash...

First, we should just make sure to always use 32 or 64 bit addresses
(and offsets). There is too much code that really relies on them being
either 4 bytes or 8 bytes.

[PATCH 1/2] libdw: Make sure that address_size and offset_size are 4

Second, it is not really necessary to create a buffer, sprintf into it,
then use that buffer to printf to stdio. Just do it directly.

[PATCH 2/2] readelf: Turn format_print_dwarf into print_dwarf_addr.

Cheers,

Mark

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] libdw: Make sure that address_size and offset_size are 4 or 8 bytes.
  2018-06-07 21:44   ` Mark Wielaard
@ 2018-06-07 21:45     ` Mark Wielaard
  2018-06-09  8:35       ` Mark Wielaard
  2018-06-07 21:46     ` [PATCH 2/2] readelf: Turn format_print_dwarf into print_dwarf_addr Mark Wielaard
  1 sibling, 1 reply; 7+ messages in thread
From: Mark Wielaard @ 2018-06-07 21:45 UTC (permalink / raw)
  To: elfutils-devel; +Cc: Mark Wielaard

When interning a CU make sure that address_size and offset_size are
either 4 or 8 bytes. We really don't (want to) handle any other size.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 libdw/ChangeLog      |  6 ++++++
 libdw/libdw_findcu.c | 13 +++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index b569393..9d0b484 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,9 @@
+2018-06-07  Mark Wielaard  <mark@klomp.org>
+
+	* libdw_findcu.c (__libdw_intern_next_unit): Report DWARF_E_VERSION,
+	not DWARF_E_INVALID_DWARF on unknown version. Set address_size and
+	offset_size to 8 when unknown.
+
 2018-06-06  Mark Wielaard  <mark@klomp.org>
 
 	* libdwP.h (__libdw_dieabbrev): Check DIE addr falls in cu.
diff --git a/libdw/libdw_findcu.c b/libdw/libdw_findcu.c
index 2f5c6c4..ed74423 100644
--- a/libdw/libdw_findcu.c
+++ b/libdw/libdw_findcu.c
@@ -120,14 +120,23 @@ __libdw_intern_next_unit (Dwarf *dbg, bool debug_types)
     return NULL;
 
   /* We only know how to handle the DWARF version 2 through 5 formats.
-     For v4 debug types we only handle version 4. */
+     For v4 debug types we only handle version 4.  */
   if (unlikely (version < 2) || unlikely (version > 5)
       || (debug_types && unlikely (version != 4)))
     {
-      __libdw_seterrno (DWARF_E_INVALID_DWARF);
+      __libdw_seterrno (DWARF_E_VERSION);
       return NULL;
     }
 
+  /* We only handle 32 or 64 bit (4 or 8 byte) addresses and offsets.
+     Just assume we are dealing with 64bit in case the size is "unknown".
+     Too much code assumes if it isn't 4 then it is 8 (or the other way
+     around).  */
+  if (unlikely (address_size != 4 && address_size != 8))
+    address_size = 8;
+  if (unlikely (offset_size != 4 && offset_size != 8))
+    offset_size = 8;
+
   /* Invalid or truncated debug section data?  */
   size_t sec_idx = debug_types ? IDX_debug_types : IDX_debug_info;
   Elf_Data *data = dbg->sectiondata[sec_idx];
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/2] readelf: Turn format_print_dwarf into print_dwarf_addr.
  2018-06-07 21:44   ` Mark Wielaard
  2018-06-07 21:45     ` [PATCH 1/2] libdw: Make sure that address_size and offset_size are 4 or 8 bytes Mark Wielaard
@ 2018-06-07 21:46     ` Mark Wielaard
  2018-06-09  8:38       ` Mark Wielaard
  1 sibling, 1 reply; 7+ messages in thread
From: Mark Wielaard @ 2018-06-07 21:46 UTC (permalink / raw)
  To: elfutils-devel; +Cc: Mark Wielaard

We don't really need to setup a buffer, print into it and then print it
out to stdout. Simplify the code by directly printing the address (and
symbol name).

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 src/ChangeLog            |  20 +++
 src/readelf.c            | 423 +++++++++++++++++++++--------------------------
 tests/run-readelf-loc.sh |  52 +++---
 3 files changed, 238 insertions(+), 257 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index cdc4720..778238e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,23 @@
+2018-06-07  Mark Wielaard  <mark@klomp.org>
+
+	* readelf.c (format_result): Removed.
+	(format_result_size): Removed.
+	(format_dwarf_addr): Renamed to...
+	(print_dwarf_addr): ...this. Simply call printf, don't setup buffer,
+	don't call sprintf.
+	(print_ops): Use print_dwarf_addr instead of format_dwarf_addr.
+	(print_debug_addr_section): Likewise.
+	(print_debug_aranges_section): Likewise.
+	(print_debug_rnglists_section): Likewise.
+	(print_debug_ranges_section): Likewise.
+	(print_debug_frame_section): Likewise.
+	(attr_callback): Likewise.
+	(print_decoded_line_section): Likewise.
+	(print_debug_line_section): Likewise.
+	(print_debug_loclists_section): Likewise.
+	(print_debug_loc_section): Likewise.
+	(print_gdb_index_section): Likewsie.
+
 2018-06-05  Mark Wielaard  <mark@klomp.org>
 
 	* readelf.c (print_debug_addr_section): Set unit_length always to
diff --git a/src/readelf.c b/src/readelf.c
index eac5eac..f9514a1 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -3705,12 +3705,9 @@ print_attributes (Ebl *ebl, const GElf_Ehdr *ehdr)
 }
 
 
-static char *format_result = NULL;
-static size_t format_result_size = 0;
-
-static char *
-format_dwarf_addr (Dwfl_Module *dwflmod,
-		   int address_size, Dwarf_Addr address, Dwarf_Addr raw)
+void
+print_dwarf_addr (Dwfl_Module *dwflmod,
+		  int address_size, Dwarf_Addr address, Dwarf_Addr raw)
 {
   /* See if there is a name we can give for this address.  */
   GElf_Sym sym;
@@ -3736,76 +3733,41 @@ format_dwarf_addr (Dwfl_Module *dwflmod,
 	     : dwfl_module_relocation_info (dwflmod, i, NULL));
     }
 
-  char *result;
-  size_t max_size = ((name != NULL ? strlen (name) : 0)
-		     + (scn != NULL ? strlen (scn) : 0)
-		     + (2 + 8 * 2) * 2 + 6);
-  if (max_size > format_result_size)
-    {
-      max_size *= 2; /* A bit more, so we don't immediately realloc again.  */
-      result = realloc (format_result, max_size);
-      if (result == NULL)
-	error (EXIT_FAILURE, 0, _("memory exhausted"));
-      format_result_size = max_size;
-      format_result = result;
-    }
-  else
-    result = format_result;
-
   if ((name != NULL
        ? (off != 0
 	  ? (scn != NULL
 	     ? (address_size == 0
-		? sprintf (result,
-			   "%s+%#" PRIx64 " <%s+%#" PRIx64 ">",
-			   scn, address, name, off)
-		: sprintf (result,
-			   "%s+%#0*" PRIx64 " <%s+%#" PRIx64 ">",
-			   scn, 2 + address_size * 2, address,
-			   name, off))
+		? printf ("%s+%#" PRIx64 " <%s+%#" PRIx64 ">",
+			  scn, address, name, off)
+		: printf ("%s+%#0*" PRIx64 " <%s+%#" PRIx64 ">",
+			  scn, 2 + address_size * 2, address,
+			  name, off))
 	     : (address_size == 0
-		? sprintf (result,
-			   "%#" PRIx64 " <%s+%#" PRIx64 ">",
-			   address, name, off)
-		: sprintf (result,
-			   "%#0*" PRIx64 " <%s+%#" PRIx64 ">",
-			   2 + address_size * 2, address,
-			   name, off)))
+		? printf ("%#" PRIx64 " <%s+%#" PRIx64 ">",
+			  address, name, off)
+		: printf ("%#0*" PRIx64 " <%s+%#" PRIx64 ">",
+			  2 + address_size * 2, address,
+			  name, off)))
 	  : (scn != NULL
 	     ? (address_size == 0
-		? sprintf (result,
-			   "%s+%#" PRIx64 " <%s>",
-			   scn, address, name)
-		: sprintf (result,
-			   "%s+%#0*" PRIx64 " <%s>",
+		? printf ("%s+%#" PRIx64 " <%s>", scn, address, name)
+		: printf ("%s+%#0*" PRIx64 " <%s>",
 			   scn, 2 + address_size * 2, address, name))
 	     : (address_size == 0
-		? sprintf (result,
-			   "%#" PRIx64 " <%s>",
-			   address, name)
-		: sprintf (result,
-			   "%#0*" PRIx64 " <%s>",
-			   2 + address_size * 2, address, name))))
+		? printf ("%#" PRIx64 " <%s>", address, name)
+		: printf ("%#0*" PRIx64 " <%s>",
+			  2 + address_size * 2, address, name))))
        : (scn != NULL
 	  ? (address_size == 0
-	     ? sprintf (result,
-			"%s+%#" PRIx64,
-			scn, address)
-	     : sprintf (result,
-			"%s+%#0*" PRIx64,
-			scn, 2 + address_size * 2, address))
+	     ? printf ("%s+%#" PRIx64, scn, address)
+	     : printf ("%s+%#0*" PRIx64, scn, 2 + address_size * 2, address))
 	  : (address_size == 0
-	     ? sprintf (result,
-			"%#" PRIx64,
-			address)
-	     : sprintf (result,
-			"%#0*" PRIx64,
-			2 + address_size * 2, address)))) < 0)
+	     ? printf ("%#" PRIx64, address)
+	     : printf ("%#0*" PRIx64, 2 + address_size * 2, address)))) < 0)
     error (EXIT_FAILURE, 0, _("sprintf failure"));
-
-  return result;
 }
 
+
 static const char *
 dwarf_tag_string (unsigned int tag)
 {
@@ -4380,9 +4342,10 @@ print_ops (Dwfl_Module *dwflmod, Dwarf *dbg, int indent, int indentrest,
 	  data += addrsize;
 	  CONSUME (addrsize);
 
-	  char *a = format_dwarf_addr (dwflmod, 0, addr, addr);
-	  printf ("%*s[%2" PRIuMAX "] %s %s\n",
-		  indent, "", (uintmax_t) offset, op_name, a);
+	  printf ("%*s[%2" PRIuMAX "] %s ",
+		  indent, "", (uintmax_t) offset, op_name);
+	  print_dwarf_addr (dwflmod, 0, addr, addr);
+	  printf ("\n");
 
 	  offset += 1 + addrsize;
 	  break;
@@ -4526,8 +4489,8 @@ print_ops (Dwfl_Module *dwflmod, Dwarf *dbg, int indent, int indentrest,
 	    printf ("???\n");
 	  else
 	    {
-	      a = format_dwarf_addr (dwflmod, 0, addr, addr);
-	      printf ("%s\n", a);
+	      print_dwarf_addr (dwflmod, 0, addr, addr);
+	      printf ("\n");
 	    }
 	  break;
 
@@ -5307,9 +5270,8 @@ print_debug_addr_section (Dwfl_Module *dwflmod __attribute__ ((unused)),
 	  Dwarf_Addr addr = read_addr_unaligned_inc (address_size, dbg,
 						     readp);
 	  printf (" [%*u] ", digits, index++);
-	  char *a = format_dwarf_addr (dwflmod, address_size,
-				       addr, addr);
-	  printf ("%s\n", a);
+	  print_dwarf_addr (dwflmod, address_size, addr, addr);
+	  printf ("\n");
 	}
       printf ("\n");
 
@@ -5525,16 +5487,17 @@ print_debug_aranges_section (Dwfl_Module *dwflmod __attribute__ ((unused)),
 	  if (range_address == 0 && range_length == 0 && segment == 0)
 	    break;
 
-	  char *b = format_dwarf_addr (dwflmod, address_size, range_address,
-				       range_address);
-	  printf ("   %s", b);
-	  char *e = format_dwarf_addr (dwflmod, address_size,
-				       range_address + range_length - 1,
-				       range_length);
+	  printf ("   ");
+	  print_dwarf_addr (dwflmod, address_size, range_address,
+			    range_address);
+	  printf ("..");
+	  print_dwarf_addr (dwflmod, address_size,
+			    range_address + range_length - 1,
+			    range_length);
 	  if (segment_size != 0)
-	    printf ("..%s (%" PRIx64 ")\n", e, (uint64_t) segment);
+	    printf (" (%" PRIx64 ")\n", (uint64_t) segment);
 	  else
-	    printf ("..%s\n", e);
+	    printf ("\n");
 	}
 
     next_table:
@@ -5674,16 +5637,16 @@ print_debug_rnglists_section (Dwfl_Module *dwflmod,
 		      &cu_base, &cu)
 	  || split_dwarf_cu_base (dbg, &cu, &cu_base))
 	{
-	  char *basestr = format_dwarf_addr (dwflmod, address_size,
-					     cu_base, cu_base);
 	  Dwarf_Die cudie;
 	  if (dwarf_cu_die (cu, &cudie,
 			    NULL, NULL, NULL, NULL,
 			    NULL, NULL) == NULL)
-	    printf (gettext (" Unknown CU base: %s\n"), basestr);
+	    printf (gettext (" Unknown CU base: "));
 	  else
-	    printf (gettext (" CU [%6" PRIx64 "] base: %s\n"),
-		    dwarf_dieoffset (&cudie), basestr);
+	    printf (gettext (" CU [%6" PRIx64 "] base: "),
+		    dwarf_dieoffset (&cudie));
+	  print_dwarf_addr (dwflmod, address_size, cu_base, cu_base);
+	  printf ("\n");
 	}
       else
 	printf (gettext (" Not associated with a CU.\n"));
@@ -5727,7 +5690,6 @@ print_debug_rnglists_section (Dwfl_Module *dwflmod,
 	{
 	  uint8_t kind = *readp++;
 	  uint64_t op1, op2;
-	  char *a1, *a2;
 
 	  /* Skip padding.  */
 	  if (start_of_list && kind == DW_RLE_end_of_list)
@@ -5766,9 +5728,9 @@ print_debug_rnglists_section (Dwfl_Module *dwflmod,
 		    printf ("      ???\n");
 		  else
 		    {
-		      a1 = format_dwarf_addr (dwflmod, address_size,
-					      addr, addr);
-		      printf ("      %s\n", a1);
+		      printf ("      ");
+		      print_dwarf_addr (dwflmod, address_size, addr, addr);
+		      printf ("\n");
 		    }
 		}
 	      break;
@@ -5793,12 +5755,12 @@ print_debug_rnglists_section (Dwfl_Module *dwflmod,
 		    }
 		  else
 		    {
-		      a1 = format_dwarf_addr (dwflmod, address_size,
-					      addr1, addr1);
-		      printf ("      %s..\n", a1);
-		      a2 = format_dwarf_addr (dwflmod, address_size,
-					      addr2 - 1, addr2);
-		      printf ("      %s\n", a2);
+		      printf ("      ");
+		      print_dwarf_addr (dwflmod, address_size, addr1, addr1);
+		      printf ("..\n      ");
+		      print_dwarf_addr (dwflmod, address_size,
+					addr2 - 1, addr2);
+		      printf ("\n");
 		    }
 		}
 	      break;
@@ -5823,12 +5785,12 @@ print_debug_rnglists_section (Dwfl_Module *dwflmod,
 		  else
 		    {
 		      addr2 = addr1 + op2;
-		      a1 = format_dwarf_addr (dwflmod, address_size,
-					      addr1, addr1);
-		      printf ("      %s..\n", a1);
-		      a2 = format_dwarf_addr (dwflmod, address_size,
-					      addr2 - 1, addr2);
-		      printf ("      %s..\n", a2);
+		      printf ("      ");
+		      print_dwarf_addr (dwflmod, address_size, addr1, addr1);
+		      printf ("..\n      ");
+		      print_dwarf_addr (dwflmod, address_size,
+					addr2 - 1, addr2);
+		      printf ("\n");
 		    }
 		}
 	      break;
@@ -5845,11 +5807,11 @@ print_debug_rnglists_section (Dwfl_Module *dwflmod,
 		{
 		  op1 += base;
 		  op2 += base;
-		  a1 = format_dwarf_addr (dwflmod, address_size, op1, op1);
-		  printf ("      %s..\n", a1);
-		  a2 = format_dwarf_addr (dwflmod, address_size,
-					  op2 - 1, op2);
-		  printf ("      %s\n", a2);
+		  printf ("      ");
+		  print_dwarf_addr (dwflmod, address_size, op1, op1);
+		  printf ("..\n      ");
+		  print_dwarf_addr (dwflmod, address_size, op2 - 1, op2);
+		  printf ("\n");
 		}
 	      break;
 
@@ -5870,8 +5832,9 @@ print_debug_rnglists_section (Dwfl_Module *dwflmod,
 	      printf (" 0x%" PRIx64 "\n", base);
 	      if (! print_unresolved_addresses)
 		{
-		  a1 = format_dwarf_addr (dwflmod, address_size, base, base);
-		  printf ("      %s\n", a1);
+		  printf ("      ");
+		  print_dwarf_addr (dwflmod, address_size, base, base);
+		  printf ("\n");
 		}
 	      break;
 
@@ -5893,11 +5856,11 @@ print_debug_rnglists_section (Dwfl_Module *dwflmod,
 	      printf (" 0x%" PRIx64 "..0x%" PRIx64 "\n", op1, op2);
 	      if (! print_unresolved_addresses)
 		{
-		  a1 = format_dwarf_addr (dwflmod, address_size, op1, op1);
-		  printf ("      %s..\n", a1);
-		  a2 = format_dwarf_addr (dwflmod, address_size,
-					  op2 - 1, op2);
-		  printf ("      %s\n", a2);
+		  printf ("      ");
+		  print_dwarf_addr (dwflmod, address_size, op1, op1);
+		  printf ("..\n      ");
+		  print_dwarf_addr (dwflmod, address_size, op2 - 1, op2);
+		  printf ("\n");
 		}
 	      break;
 
@@ -5920,13 +5883,12 @@ print_debug_rnglists_section (Dwfl_Module *dwflmod,
 	      printf (" 0x%" PRIx64 ", %" PRIx64 "\n", op1, op2);
 	      if (! print_unresolved_addresses)
 		{
-		  a1 = format_dwarf_addr (dwflmod, address_size, op1, op1);
-		  printf ("      %s..\n", a1);
-
 		  op2 = op1 + op2;
-		  a2 = format_dwarf_addr (dwflmod, address_size,
-					  op2 - 1, op2);
-		  printf ("      %s\n", a2);
+		  printf ("      ");
+		  print_dwarf_addr (dwflmod, address_size, op1, op1);
+		  printf ("..\n      ");
+		  print_dwarf_addr (dwflmod, address_size, op2 - 1, op2);
+		  printf ("\n");
 		}
 	      break;
 
@@ -5988,16 +5950,16 @@ print_debug_ranges_section (Dwfl_Module *dwflmod,
 
       if (last_cu != cu)
 	{
-	  char *basestr = format_dwarf_addr (dwflmod, address_size,
-					     base, base);
 	  Dwarf_Die cudie;
 	  if (dwarf_cu_die (cu, &cudie,
 			    NULL, NULL, NULL, NULL,
 			    NULL, NULL) == NULL)
-	    printf (gettext ("\n Unknown CU base: %s\n"), basestr);
+	    printf (gettext ("\n Unknown CU base: "));
 	  else
-	    printf (gettext ("\n CU [%6" PRIx64 "] base: %s\n"),
-		    dwarf_dieoffset (&cudie), basestr);
+	    printf (gettext ("\n CU [%6" PRIx64 "] base: "),
+		    dwarf_dieoffset (&cudie));
+	  print_dwarf_addr (dwflmod, address_size, base, base);
+	  printf ("\n");
 	}
       last_cu = cu;
 
@@ -6024,8 +5986,9 @@ print_debug_ranges_section (Dwfl_Module *dwflmod,
 
       if (begin == (Dwarf_Addr) -1l) /* Base address entry.  */
 	{
-	  char *b = format_dwarf_addr (dwflmod, address_size, end, end);
-	  printf (gettext (" [%6tx] base address\n          %s\n"), offset, b);
+	  printf (gettext (" [%6tx] base address\n          "), offset);
+	  print_dwarf_addr (dwflmod, address_size, end, end);
+	  printf ("\n");
 	  base = end;
 	}
       else if (begin == 0 && end == 0) /* End of list entry.  */
@@ -6045,12 +6008,13 @@ print_debug_ranges_section (Dwfl_Module *dwflmod,
 	  printf ("range %" PRIx64 ", %" PRIx64 "\n", begin, end);
 	  if (! print_unresolved_addresses)
 	    {
-	      char *b = format_dwarf_addr (dwflmod, address_size, base + begin,
-					   base + begin);
-	      printf ("          %s..\n", b);
-	      char *e = format_dwarf_addr (dwflmod, address_size,
-					   base + end - 1, base + end);
-	      printf ("          %s\n", e);
+	      printf ("          ");
+	      print_dwarf_addr (dwflmod, address_size, base + begin,
+			        base + begin);
+	      printf ("..\n          ");
+	      print_dwarf_addr (dwflmod, address_size,
+				base + end - 1, base + end);
+	      printf ("\n");
 	    }
 
 	  first = false;
@@ -6815,13 +6779,13 @@ print_debug_frame_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
 			 + (base - (const unsigned char *) data->d_buf)
 			 - bias);
 
-	  char *a = format_dwarf_addr (dwflmod, cie->address_size,
-				       pc_start, initial_location);
 	  printf ("\n [%6tx] FDE length=%" PRIu64 " cie=[%6tx]\n"
 		  "   CIE_pointer:              %" PRIu64 "\n"
-		  "   initial_location:         %s",
+		  "   initial_location:         ",
 		  offset, (uint64_t) unit_length,
-		  cie->cie_offset, (uint64_t) cie_id, a);
+		  cie->cie_offset, (uint64_t) cie_id);
+	  print_dwarf_addr (dwflmod, cie->address_size,
+			    pc_start, initial_location);
 	  if ((fde_encoding & 0x70) == DW_EH_PE_pcrel)
 	    {
 	      vma_base = (((uint64_t) shdr->sh_offset
@@ -6974,21 +6938,21 @@ attr_callback (Dwarf_Attribute *attrp, void *arg)
 	      /* Don't ABORT, it might be other attributes can be resolved.  */
 	      return DWARF_CB_OK;
 	    }
-	  char *a = format_dwarf_addr (cbargs->dwflmod, cbargs->addrsize,
-				       addr, addr);
 	  if (form != DW_FORM_addr )
 	    {
 	      Dwarf_Word index;
 	      if (dwarf_formudata (attrp, &index) != 0)
 		goto attrval_out;
-	      printf ("           %*s%-20s (%s) [%" PRIx64 "] %s\n",
+	      printf ("           %*s%-20s (%s) [%" PRIx64 "] ",
 		      (int) (level * 2), "", dwarf_attr_name (attr),
-		      dwarf_form_name (form), index, a);
+		      dwarf_form_name (form), index);
 	    }
 	  else
-	    printf ("           %*s%-20s (%s) %s\n",
+	    printf ("           %*s%-20s (%s) ",
 		    (int) (level * 2), "", dwarf_attr_name (attr),
-		    dwarf_form_name (form), a);
+		    dwarf_form_name (form));
+	  print_dwarf_addr (cbargs->dwflmod, cbargs->addrsize, addr, addr);
+	  printf ("\n");
 	}
       break;
 
@@ -7328,11 +7292,11 @@ attr_callback (Dwarf_Attribute *attrp, void *arg)
       Dwarf_Addr highpc;
       if (attr == DW_AT_high_pc && dwarf_highpc (cbargs->die, &highpc) == 0)
 	{
-	  char *a = format_dwarf_addr (cbargs->dwflmod, cbargs->addrsize,
-				       highpc, highpc);
-	  printf ("           %*s%-20s (%s) %" PRIuMAX " (%s)\n",
+	  printf ("           %*s%-20s (%s) %" PRIuMAX " (",
 		  (int) (level * 2), "", dwarf_attr_name (attr),
-		  dwarf_form_name (form), (uintmax_t) num, a);
+		  dwarf_form_name (form), (uintmax_t) num);
+	  print_dwarf_addr (cbargs->dwflmod, cbargs->addrsize, highpc, highpc);
+	  printf (")\n");
 	}
       else
 	{
@@ -7834,16 +7798,17 @@ print_decoded_line_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
 	  dwarf_linediscriminator (line, &disc);
 
 	  /* End sequence is special, it is one byte past.  */
-	  char *a = format_dwarf_addr (dwflmod, address_size,
-				       address - (endseq ? 1 : 0), address);
-	  printf ("  %4d:%-3d %c%c%c%c%c %4d %3d %2d %s\n",
+	  printf ("  %4d:%-3d %c%c%c%c%c %4d %3d %2d ",
 		  lineno, colno,
 		  (statement ? 'S' : ' '),
 		  (block ? 'B' : ' '),
 		  (prologue_end ? 'P' : ' '),
 		  (epilogue_begin ? 'E' : ' '),
 		  (endseq ? '*' : ' '),
-		  disc, isa, lineop, a);
+		  disc, isa, lineop);
+	  print_dwarf_addr (dwflmod, address_size,
+			    address - (endseq ? 1 : 0), address);
+	  printf ("\n");
 
 	  if (endseq)
 	    printf("\n");
@@ -8525,16 +8490,15 @@ print_debug_line_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
 	      line += line_increment;
 	      advance_pc ((opcode - opcode_base) / line_range);
 
-	      char *a = format_dwarf_addr (dwflmod, 0, address, address);
+	      printf (gettext (" special opcode %u: address+%u = "),
+		      opcode, op_addr_advance);
+	      print_dwarf_addr (dwflmod, 0, address, address);
 	      if (show_op_index)
-		printf (gettext ("\
- special opcode %u: address+%u = %s, op_index = %u, line%+d = %zu\n"),
-			opcode, op_addr_advance, a, op_index,
-			line_increment, line);
+		printf (gettext (", op_index = %u, line%+d = %zu\n"),
+			op_index, line_increment, line);
 	      else
-		printf (gettext ("\
- special opcode %u: address+%u = %s, line%+d = %zu\n"),
-			opcode, op_addr_advance, a, line_increment, line);
+		printf (gettext (", line%+d = %zu\n"),
+			line_increment, line);
 	    }
 	  else if (opcode == 0)
 	    {
@@ -8574,8 +8538,9 @@ print_debug_line_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
 		  else
 		    address = read_8ubyte_unaligned_inc (dbg, linep);
 		  {
-		    char *a = format_dwarf_addr (dwflmod, 0, address, address);
-		    printf (gettext (" set address to %s\n"), a);
+		    printf (gettext (" set address to "));
+		    print_dwarf_addr (dwflmod, 0, address, address);
+		    printf ("\n");
 		  }
 		  break;
 
@@ -8640,14 +8605,12 @@ print_debug_line_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
 		  get_uleb128 (u128, linep, lineendp);
 		  advance_pc (u128);
 		  {
-		    char *a = format_dwarf_addr (dwflmod, 0, address, address);
+		    printf (gettext (" advance address by %u to "),
+			    op_addr_advance);
+		    print_dwarf_addr (dwflmod, 0, address, address);
 		    if (show_op_index)
-		      printf (gettext ("\
- advance address by %u to %s, op_index to %u\n"),
-			      op_addr_advance, a, op_index);
-		    else
-		      printf (gettext (" advance address by %u to %s\n"),
-			      op_addr_advance, a);
+		      printf (gettext (", op_index to %u"), op_index);
+		    printf ("\n");
 		  }
 		  break;
 
@@ -8698,15 +8661,12 @@ print_debug_line_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
 
 		  advance_pc ((255 - opcode_base) / line_range);
 		  {
-		    char *a = format_dwarf_addr (dwflmod, 0, address, address);
+		    printf (gettext (" advance address by constant %u to "),
+			    op_addr_advance);
+		    print_dwarf_addr (dwflmod, 0, address, address);
 		    if (show_op_index)
-		      printf (gettext ("\
- advance address by constant %u to %s, op_index to %u\n"),
-			      op_addr_advance, a, op_index);
-		    else
-		      printf (gettext ("\
- advance address by constant %u to %s\n"),
-			      op_addr_advance, a);
+		      printf (gettext (", op_index to %u"), op_index);
+		    printf ("\n");
 		  }
 		  break;
 
@@ -8720,10 +8680,11 @@ print_debug_line_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
 		  address += u128;
 		  op_index = 0;
 		  {
-		    char *a = format_dwarf_addr (dwflmod, 0, address, address);
 		    printf (gettext ("\
- advance address by fixed value %u to %s\n"),
-			    u128, a);
+ advance address by fixed value %u to \n"),
+			    u128);
+		    print_dwarf_addr (dwflmod, 0, address, address);
+		    printf ("\n");
 		  }
 		  break;
 
@@ -8880,16 +8841,16 @@ print_debug_loclists_section (Dwfl_Module *dwflmod,
 		      &cu_base, &cu)
 	  || split_dwarf_cu_base (dbg, &cu, &cu_base))
 	{
-	  char *basestr = format_dwarf_addr (dwflmod, address_size,
-					     cu_base, cu_base);
 	  Dwarf_Die cudie;
 	  if (dwarf_cu_die (cu, &cudie,
 			    NULL, NULL, NULL, NULL,
 			    NULL, NULL) == NULL)
-	    printf (gettext (" Unknown CU base: %s\n"), basestr);
+	    printf (gettext (" Unknown CU base: "));
 	  else
-	    printf (gettext (" CU [%6" PRIx64 "] base: %s\n"),
-		    dwarf_dieoffset (&cudie), basestr);
+	    printf (gettext (" CU [%6" PRIx64 "] base: "),
+		    dwarf_dieoffset (&cudie));
+	  print_dwarf_addr (dwflmod, address_size, cu_base, cu_base);
+	  printf ("\n");
 	}
       else
 	printf (gettext (" Not associated with a CU.\n"));
@@ -8933,7 +8894,6 @@ print_debug_loclists_section (Dwfl_Module *dwflmod,
 	{
 	  uint8_t kind = *readp++;
 	  uint64_t op1, op2, len;
-	  char *a1, *a2;
 
 	  /* Skip padding.  */
 	  if (start_of_list && kind == DW_LLE_end_of_list)
@@ -8972,9 +8932,9 @@ print_debug_loclists_section (Dwfl_Module *dwflmod,
 		    printf ("      ???\n");
 		  else
 		    {
-		      a1 = format_dwarf_addr (dwflmod, address_size,
-					      addr, addr);
-		      printf ("      %s\n", a1);
+		      printf ("      ");
+		      print_dwarf_addr (dwflmod, address_size, addr, addr);
+		      printf ("\n");
 		    }
 		}
 	      break;
@@ -8999,12 +8959,12 @@ print_debug_loclists_section (Dwfl_Module *dwflmod,
 		    }
 		  else
 		    {
-		      a1 = format_dwarf_addr (dwflmod, address_size,
-					      addr1, addr1);
-		      printf ("      %s..\n", a1);
-		      a2 = format_dwarf_addr (dwflmod, address_size,
-					      addr2 - 1, addr2);
-		      printf ("      %s\n", a2);
+		      printf ("      ");
+		      print_dwarf_addr (dwflmod, address_size, addr1, addr1);
+		      printf ("..\n      ");
+		      print_dwarf_addr (dwflmod, address_size,
+					addr2 - 1, addr2);
+		      printf ("\n");
 		    }
 		}
 	      if ((uint64_t) (nexthdr - readp) < 1)
@@ -9037,12 +8997,12 @@ print_debug_loclists_section (Dwfl_Module *dwflmod,
 		  else
 		    {
 		      addr2 = addr1 + op2;
-		      a1 = format_dwarf_addr (dwflmod, address_size,
-					      addr1, addr1);
-		      printf ("      %s..\n", a1);
-		      a2 = format_dwarf_addr (dwflmod, address_size,
-					      addr2 - 1, addr2);
-		      printf ("      %s..\n", a2);
+		      printf ("      ");
+		      print_dwarf_addr (dwflmod, address_size, addr1, addr1);
+		      printf ("..\n      ");
+		      print_dwarf_addr (dwflmod, address_size,
+					addr2 - 1, addr2);
+		      printf ("\n");
 		    }
 		}
 	      if ((uint64_t) (nexthdr - readp) < 1)
@@ -9067,11 +9027,11 @@ print_debug_loclists_section (Dwfl_Module *dwflmod,
 		{
 		  op1 += base;
 		  op2 += base;
-		  a1 = format_dwarf_addr (dwflmod, address_size, op1, op1);
-		  printf ("      %s..\n", a1);
-		  a2 = format_dwarf_addr (dwflmod, address_size,
-					  op2 - 1, op2);
-		  printf ("      %s\n", a2);
+		  printf ("      ");
+		  print_dwarf_addr (dwflmod, address_size, op1, op1);
+		  printf ("..\n      ");
+		  print_dwarf_addr (dwflmod, address_size, op2 - 1, op2);
+		  printf ("\n");
 		}
 	      if ((uint64_t) (nexthdr - readp) < 1)
 		goto invalid_entry;
@@ -9111,8 +9071,9 @@ print_debug_loclists_section (Dwfl_Module *dwflmod,
 	      printf (" 0x%" PRIx64 "\n", base);
 	      if (! print_unresolved_addresses)
 		{
-		  a1 = format_dwarf_addr (dwflmod, address_size, base, base);
-		  printf ("      %s\n", a1);
+		  printf ("      ");
+		  print_dwarf_addr (dwflmod, address_size, base, base);
+		  printf ("\n");
 		}
 	      break;
 
@@ -9134,11 +9095,11 @@ print_debug_loclists_section (Dwfl_Module *dwflmod,
 	      printf (" 0x%" PRIx64 "..0x%" PRIx64 "\n", op1, op2);
 	      if (! print_unresolved_addresses)
 		{
-		  a1 = format_dwarf_addr (dwflmod, address_size, op1, op1);
-		  printf ("      %s..\n", a1);
-		  a2 = format_dwarf_addr (dwflmod, address_size,
-					  op2 - 1, op2);
-		  printf ("      %s\n", a2);
+		  printf ("      ");
+		  print_dwarf_addr (dwflmod, address_size, op1, op1);
+		  printf ("..\n      ");
+		  print_dwarf_addr (dwflmod, address_size, op2 - 1, op2);
+		  printf ("\n");
 		}
 	      if ((uint64_t) (nexthdr - readp) < 1)
 		goto invalid_entry;
@@ -9169,13 +9130,12 @@ print_debug_loclists_section (Dwfl_Module *dwflmod,
 	      printf (" 0x%" PRIx64 ", %" PRIx64 "\n", op1, op2);
 	      if (! print_unresolved_addresses)
 		{
-		  a1 = format_dwarf_addr (dwflmod, address_size, op1, op1);
-		  printf ("      %s..\n", a1);
-
 		  op2 = op1 + op2;
-		  a2 = format_dwarf_addr (dwflmod, address_size,
-					  op2 - 1, op2);
-		  printf ("      %s\n", a2);
+		  printf ("      ");
+		  print_dwarf_addr (dwflmod, address_size, op1, op1);
+		  printf ("..\n      ");
+		  print_dwarf_addr (dwflmod, address_size, op2 - 1, op2);
+		  printf ("\n");
 		}
 	      if ((uint64_t) (nexthdr - readp) < 1)
 		goto invalid_entry;
@@ -9247,16 +9207,16 @@ print_debug_loc_section (Dwfl_Module *dwflmod,
 
       if (last_cu != cu)
        {
-	char *basestr = format_dwarf_addr (dwflmod, address_size,
-					   base, base);
 	Dwarf_Die cudie;
 	if (dwarf_cu_die (cu, &cudie,
 			  NULL, NULL, NULL, NULL,
 			  NULL, NULL) == NULL)
-	  printf (gettext ("\n Unknown CU base: %s\n"), basestr);
+	  printf (gettext ("\n Unknown CU base: "));
 	else
-	  printf (gettext ("\n CU [%6" PRIx64 "] base: %s\n"),
-		  dwarf_dieoffset (&cudie), basestr);
+	  printf (gettext ("\n CU [%6" PRIx64 "] base: "),
+		  dwarf_dieoffset (&cudie));
+	print_dwarf_addr (dwflmod, address_size, base, base);
+	printf ("\n");
        }
       last_cu = cu;
 
@@ -9383,8 +9343,9 @@ print_debug_loc_section (Dwfl_Module *dwflmod,
 
       if (begin == (Dwarf_Addr) -1l) /* Base address entry.  */
 	{
-	  char *b = format_dwarf_addr (dwflmod, address_size, end, end);
-	  printf (gettext (" [%6tx] base address\n          %s\n"), offset, b);
+	  printf (gettext (" [%6tx] base address\n          "), offset);
+	  print_dwarf_addr (dwflmod, address_size, end, end);
+	  printf ("\n");
 	  base = end;
 	}
       else if (begin == 0 && end == 0) /* End of list entry.  */
@@ -9408,12 +9369,11 @@ print_debug_loc_section (Dwfl_Module *dwflmod,
 	    {
 	      Dwarf_Addr dab = use_base ? base + begin : begin;
 	      Dwarf_Addr dae = use_base ? base + end : end;
-	      char *b = format_dwarf_addr (dwflmod, address_size,
-					   dab, dab);
-	      printf ("          %s..\n", b);
-	      char *e = format_dwarf_addr (dwflmod, address_size,
-					   dae - 1, dae);
-	      printf ("          %s\n", e);
+	      printf ("          ");
+	      print_dwarf_addr (dwflmod, address_size, dab, dab);
+	      printf ("..\n          ");
+	      print_dwarf_addr (dwflmod, address_size, dae - 1, dae);
+	      printf ("\n");
 	    }
 
 	  if (endp - readp <= (ptrdiff_t) len)
@@ -10672,10 +10632,11 @@ print_gdb_index_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
       uint32_t idx = read_4ubyte_unaligned (dbg, readp);
       readp += 4;
 
-      char *l = format_dwarf_addr (dwflmod, 8, low, low);
-      printf (" [%4zu] %s..", n, l);
-      char *h = format_dwarf_addr (dwflmod, 8, high - 1, high);
-      printf ("%s, CU index: %5" PRId32 "\n", h, idx);
+      printf (" [%4zu] ", n);
+      print_dwarf_addr (dwflmod, 8, low, low);
+      printf ("..");
+      print_dwarf_addr (dwflmod, 8, high - 1, high);
+      printf (", CU index: %5" PRId32 "\n", idx);
       n++;
     }
 
diff --git a/tests/run-readelf-loc.sh b/tests/run-readelf-loc.sh
index bf676f2..8594b54 100755
--- a/tests/run-readelf-loc.sh
+++ b/tests/run-readelf-loc.sh
@@ -536,11 +536,11 @@ Table at Offset 0x0:
   Offset: 30, Index: 24
     startx_length f, a
       0x0000000000401160 <foo>..
-      0x0000000000401169 <foo+0x9>..
+      0x0000000000401169 <foo+0x9>
         [ 0] reg5
     startx_length 0, 2a
       0x000000000040116a <foo+0xa>..
-      0x0000000000401193 <foo+0x33>..
+      0x0000000000401193 <foo+0x33>
         [ 0] entry_value:
              [ 0] reg5
         [ 3] stack_value
@@ -549,61 +549,61 @@ Table at Offset 0x0:
   Offset: 3e, Index: 32
     startx_length 11, 12
       0x000000000040117b <foo+0x1b>..
-      0x000000000040118c <foo+0x2c>..
+      0x000000000040118c <foo+0x2c>
         [ 0] addrx [18] 0x404038 <m>
     end_of_list
 
   Offset: 45, Index: 39
     startx_length 11, 6
       0x000000000040117b <foo+0x1b>..
-      0x0000000000401180 <foo+0x20>..
+      0x0000000000401180 <foo+0x20>
         [ 0] reg5
     end_of_list
 
   Offset: 4b, Index: 3f
     startx_length 11, c
       0x000000000040117b <foo+0x1b>..
-      0x0000000000401186 <foo+0x26>..
+      0x0000000000401186 <foo+0x26>
         [ 0] reg5
     startx_length 1, 4
       0x0000000000401189 <foo+0x29>..
-      0x000000000040118c <foo+0x2c>..
+      0x000000000040118c <foo+0x2c>
         [ 0] reg5
     end_of_list
 
   Offset: 56, Index: 4a
     startx_length 4, 6
       0x0000000000401181 <foo+0x21>..
-      0x0000000000401186 <foo+0x26>..
+      0x0000000000401186 <foo+0x26>
         [ 0] reg5
     startx_length 1, 4
       0x0000000000401189 <foo+0x29>..
-      0x000000000040118c <foo+0x2c>..
+      0x000000000040118c <foo+0x2c>
         [ 0] reg5
     end_of_list
 
   Offset: 61, Index: 55
     startx_length 4, c
       0x0000000000401181 <foo+0x21>..
-      0x000000000040118c <foo+0x2c>..
+      0x000000000040118c <foo+0x2c>
         [ 0] reg5
     end_of_list
 
   Offset: 67, Index: 5b
     startx_length 2, 6
       0x000000000040118d <foo+0x2d>..
-      0x0000000000401192 <foo+0x32>..
+      0x0000000000401192 <foo+0x32>
         [ 0] reg5
     end_of_list
 
   Offset: 6d, Index: 61
     startx_length 9, f
       0x00000000004011a0 <baz>..
-      0x00000000004011ae <baz+0xe>..
+      0x00000000004011ae <baz+0xe>
         [ 0] reg5
     startx_length 5, 2
       0x00000000004011af <baz+0xf>..
-      0x00000000004011b0 <baz+0x10>..
+      0x00000000004011b0 <baz+0x10>
         [ 0] entry_value:
              [ 0] reg5
         [ 3] stack_value
@@ -612,7 +612,7 @@ Table at Offset 0x0:
   Offset: 7b, Index: 6f
     startx_length 9, 10
       0x00000000004011a0 <baz>..
-      0x00000000004011af <baz+0xf>..
+      0x00000000004011af <baz+0xf>
         [ 0] reg5
     end_of_list
 
@@ -642,11 +642,11 @@ Table at Offset 0x0:
   Offset: 28, Index: 1c
     startx_length 2, 14
       0x0000000000401060 <main>..
-      0x0000000000401073 <main+0x13>..
+      0x0000000000401073 <main+0x13>
         [ 0] reg5
     startx_length 4, c
       0x0000000000401074 <main+0x14>..
-      0x000000000040107f <main+0x1f>..
+      0x000000000040107f <main+0x1f>
         [ 0] entry_value:
              [ 0] reg5
         [ 3] stack_value
@@ -655,11 +655,11 @@ Table at Offset 0x0:
   Offset: 36, Index: 2a
     startx_length 2, 18
       0x0000000000401060 <main>..
-      0x0000000000401077 <main+0x17>..
+      0x0000000000401077 <main+0x17>
         [ 0] reg4
     startx_length 7, 6
       0x0000000000401078 <main+0x18>..
-      0x000000000040107d <main+0x1d>..
+      0x000000000040107d <main+0x1d>
         [ 0] entry_value:
              [ 0] reg4
         [ 3] stack_value
@@ -668,18 +668,18 @@ Table at Offset 0x0:
   Offset: 44, Index: 38
     startx_length 3, 7
       0x0000000000401071 <main+0x11>..
-      0x0000000000401077 <main+0x17>..
+      0x0000000000401077 <main+0x17>
         [ 0] reg0
     end_of_list
 
   Offset: 4a, Index: 3e
     startx_length d, 8
       0x00000000004011c0 <calc>..
-      0x00000000004011c7 <calc+0x7>..
+      0x00000000004011c7 <calc+0x7>
         [ 0] reg5
     startx_length e, 23
       0x00000000004011c8 <calc+0x8>..
-      0x00000000004011ea <calc+0x2a>..
+      0x00000000004011ea <calc+0x2a>
         [ 0] entry_value:
              [ 0] reg5
         [ 3] stack_value
@@ -688,22 +688,22 @@ Table at Offset 0x0:
   Offset: 58, Index: 4c
     startx_length f, b
       0x00000000004011d8 <calc+0x18>..
-      0x00000000004011e2 <calc+0x22>..
+      0x00000000004011e2 <calc+0x22>
         [ 0] reg0
     end_of_list
 
   Offset: 5e, Index: 52
     startx_length f, 2
       0x00000000004011d8 <calc+0x18>..
-      0x00000000004011d9 <calc+0x19>..
+      0x00000000004011d9 <calc+0x19>
         [ 0] reg1
     startx_length 10, 5
       0x00000000004011da <calc+0x1a>..
-      0x00000000004011de <calc+0x1e>..
+      0x00000000004011de <calc+0x1e>
         [ 0] reg5
     startx_length 0, 4
       0x00000000004011df <calc+0x1f>..
-      0x00000000004011e2 <calc+0x22>..
+      0x00000000004011e2 <calc+0x22>
         [ 0] entry_value:
              [ 0] reg5
         [ 3] deref_size 1
@@ -717,11 +717,11 @@ Table at Offset 0x0:
   Offset: 79, Index: 6d
     startx_length f, 2
       0x00000000004011d8 <calc+0x18>..
-      0x00000000004011d9 <calc+0x19>..
+      0x00000000004011d9 <calc+0x19>
         [ 0] reg1
     startx_length 10, 9
       0x00000000004011da <calc+0x1a>..
-      0x00000000004011e2 <calc+0x22>..
+      0x00000000004011e2 <calc+0x22>
         [ 0] reg5
     end_of_list
 
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] libdw: Make sure that address_size and offset_size are 4 or 8 bytes.
  2018-06-07 21:45     ` [PATCH 1/2] libdw: Make sure that address_size and offset_size are 4 or 8 bytes Mark Wielaard
@ 2018-06-09  8:35       ` Mark Wielaard
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Wielaard @ 2018-06-09  8:35 UTC (permalink / raw)
  To: elfutils-devel

On Thu, 2018-06-07 at 23:44 +0200, Mark Wielaard wrote:
> When interning a CU make sure that address_size and offset_size are
> either 4 or 8 bytes. We really don't (want to) handle any other size.

Pushed to master.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] readelf: Turn format_print_dwarf into print_dwarf_addr.
  2018-06-07 21:46     ` [PATCH 2/2] readelf: Turn format_print_dwarf into print_dwarf_addr Mark Wielaard
@ 2018-06-09  8:38       ` Mark Wielaard
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Wielaard @ 2018-06-09  8:38 UTC (permalink / raw)
  To: elfutils-devel

On Thu, 2018-06-07 at 23:44 +0200, Mark Wielaard wrote:
> We don't really need to setup a buffer, print into it and then print it
> out to stdout. Simplify the code by directly printing the address (and
> symbol name).

Pushed to master, including a description of the other little change in
it:

    This also showed a small error in the output of DW_LLE_startx_length.
    It had two unintended trailing dots.

diff --git a/tests/ChangeLog b/tests/ChangeLog
index 587e2ac..a2adfee 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,7 @@
+2018-06-07  Mark Wielaard  <mark@klomp.org>
+
+       * run-readelf-loc.sh: Fix expected output for startx_length.
+

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-06-09  8:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-04 17:05 [PATCH] readelf: Don't allocate string with asprintf, but reuse buffer with sprintf Mark Wielaard
2018-06-06 20:37 ` Mark Wielaard
2018-06-07 21:44   ` Mark Wielaard
2018-06-07 21:45     ` [PATCH 1/2] libdw: Make sure that address_size and offset_size are 4 or 8 bytes Mark Wielaard
2018-06-09  8:35       ` Mark Wielaard
2018-06-07 21:46     ` [PATCH 2/2] readelf: Turn format_print_dwarf into print_dwarf_addr Mark Wielaard
2018-06-09  8:38       ` Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).