binutils: Fix signedness of def_cfa_sf and def_cfa_offset_sf

Message ID 20210618200734.145929-1-richard.henderson@linaro.org
State New
Headers show
Series
  • binutils: Fix signedness of def_cfa_sf and def_cfa_offset_sf
Related show

Commit Message

Luis Machado via Binutils June 18, 2021, 8:07 p.m.
This error can be seen in hppa stack frame unwind info.
We get the decode correct elsewhere.


r~


	* dwarf.c (display_debug_frames): Both DW_CFA_def_cfa_sf
	and DW_CFA_def_cfa_offset_sf have a signed offset.

Comments

Luis Machado via Binutils June 30, 2021, 11:12 a.m. | #1
Hi Richard,

> 	* dwarf.c (display_debug_frames): Both DW_CFA_def_cfa_sf

> 	and DW_CFA_def_cfa_offset_sf have a signed offset.


Approved and applied.

Cheers
   Nick
Luis Machado via Binutils June 30, 2021, 1:22 p.m. | #2
On 6/30/21 4:12 AM, Nick Clifton wrote:
> Hi Richard,

> 

>>     * dwarf.c (display_debug_frames): Both DW_CFA_def_cfa_sf

>>     and DW_CFA_def_cfa_offset_sf have a signed offset.

> 

> Approved and applied.


Thanks.

r~

Patch

diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index ebc7b023e3b..0624c620280 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -9440,19 +9440,21 @@  display_debug_frames (struct dwarf_section *section,
 
 	    case DW_CFA_def_cfa_sf:
 	      READ_ULEB (fc->cfa_reg, start, block_end);
-	      READ_ULEB (fc->cfa_offset, start, block_end);
-	      fc->cfa_offset = fc->cfa_offset * fc->data_factor;
+	      READ_SLEB (l, start, block_end);
+	      l *= fc->data_factor;
+	      fc->cfa_offset = l;
 	      fc->cfa_exp = 0;
 	      if (! do_debug_frames_interp)
-		printf ("  DW_CFA_def_cfa_sf: %s ofs %d\n",
-			regname (fc->cfa_reg, 0), (int) fc->cfa_offset);
+		printf ("  DW_CFA_def_cfa_sf: %s ofs %ld\n",
+			regname (fc->cfa_reg, 0), (long) l);
 	      break;
 
 	    case DW_CFA_def_cfa_offset_sf:
-	      READ_ULEB (fc->cfa_offset, start, block_end);
-	      fc->cfa_offset *= fc->data_factor;
+	      READ_SLEB (l, start, block_end);
+	      l *= fc->data_factor;
+	      fc->cfa_offset = l;
 	      if (! do_debug_frames_interp)
-		printf ("  DW_CFA_def_cfa_offset_sf: %d\n", (int) fc->cfa_offset);
+		printf ("  DW_CFA_def_cfa_offset_sf: %ld\n", (long) l);
 	      break;
 
 	    case DW_CFA_MIPS_advance_loc8: