[libdwarf/f18] Fix RHBZ#903804

Tom Hughes tomh at fedoraproject.org
Sat Jan 26 13:07:09 UTC 2013


commit 2123f9ed407a8c7023f30dc491ee4576300731ec
Author: Tom Hughes <tom at compton.nu>
Date:   Sat Jan 26 13:06:33 2013 +0000

    Fix RHBZ#903804

 libdwarf-gnu-ops.patch     |  189 ++++++++++++++++++++++++++++++++++++++++++++
 libdwarf-offset-size.patch |   39 +++++++++
 libdwarf.spec              |   13 +++-
 3 files changed, 240 insertions(+), 1 deletions(-)
---
diff --git a/libdwarf-gnu-ops.patch b/libdwarf-gnu-ops.patch
new file mode 100644
index 0000000..2845c39
--- /dev/null
+++ b/libdwarf-gnu-ops.patch
@@ -0,0 +1,189 @@
+diff -urw dwarf-20121130/dwarfdump2/print_die.cc dwarf-20121130-gnu-ops/dwarfdump2/print_die.cc
+--- dwarf-20121130/dwarfdump2/print_die.cc	2012-11-30 17:28:32.000000000 +0000
++++ dwarf-20121130-gnu-ops/dwarfdump2/print_die.cc	2013-01-26 12:56:13.549342509 +0000
+@@ -182,8 +182,17 @@
+     {DW_OP_stack_value,0,""},
+     {DW_OP_GNU_uninit,0,""},
+     {DW_OP_GNU_encoded_addr,1,"addr"},
+-    {DW_OP_GNU_implicit_pointer,1,"addr" },
+-    {DW_OP_GNU_entry_value,1,"val" },
++    {DW_OP_GNU_implicit_pointer,2,"addr" },
++    {DW_OP_GNU_entry_value,2,"val" },
++    {DW_OP_GNU_const_type,2,"uleb" },
++    {DW_OP_GNU_regval_type,2,"uleb" },
++    {DW_OP_GNU_deref_type,1,"val" },
++    {DW_OP_GNU_convert,1,"uleb" },
++    {DW_OP_GNU_reinterpret,1,"uleb" },
++    {DW_OP_GNU_parameter_ref,1,"val" },
++    {DW_OP_GNU_addr_index,1,"val" },
++    {DW_OP_GNU_const_index,1,"val" },
++    {DW_OP_GNU_push_tls_address,0,"" },
+     /* terminator */
+     {0,0,""} 
+ };
+@@ -2396,13 +2405,59 @@
+             string_out.append(IToHex0N(opd1,10));
+             break;
+         case DW_OP_GNU_implicit_pointer:
++            {
+             string_out.append(" ");
+             string_out.append(IToHex0N(opd1,10));
++            string_out.append(" ");
++            Dwarf_Signed opd2 = expr->lr_number2;
++            string_out.append(IToDec(opd2));
++            }
+             break;
+         case DW_OP_GNU_entry_value:
+             string_out.append(" ");
+             string_out.append(IToHex0N(opd1,10));
+             break;
++        case DW_OP_GNU_const_type:
++            {
++            string_out.append(" ");
++            string_out.append(IToHex0N(opd1,10));
++            string_out.append(" ");
++            Dwarf_Unsigned opd2 = expr->lr_number2;
++            string_out.append(IToHex0N(opd2,10));
++            }
++            break;
++        case DW_OP_GNU_regval_type:
++            {
++            string_out.append(" ");
++            string_out.append(IToHex0N(opd1,4));
++            string_out.append(" ");
++            Dwarf_Unsigned opd2 = expr->lr_number2;
++            string_out.append(IToHex(opd2,10));
++            }
++            break;
++        case DW_OP_GNU_deref_type:
++            string_out.append(" ");
++            string_out.append(IToHex0N(opd1,4));
++            break;
++        case DW_OP_GNU_convert:
++            string_out.append(" ");
++            string_out.append(IToHex0N(opd1,4));
++            break;
++        case DW_OP_GNU_reinterpret:
++            string_out.append(" ");
++            string_out.append(IToHex0N(opd1,4));
++            break;
++        case DW_OP_GNU_parameter_ref:
++            string_out.append(" ");
++            string_out.append(IToHex0N(opd1,4));
++            break;
++        case DW_OP_GNU_addr_index:
++            string_out.append(" ");
++            string_out.append(IToHex0N(opd1,4));
++        case DW_OP_GNU_const_index:
++            string_out.append(" ");
++            string_out.append(IToHex0N(opd1,4));
++            break;
+         /* We do not know what the operands, if any, are. */
+         case DW_OP_HP_unknown:
+         case DW_OP_HP_is_value:
+diff -urw dwarf-20121130/libdwarf/dwarf.h dwarf-20121130-gnu-ops/libdwarf/dwarf.h
+--- dwarf-20121130/libdwarf/dwarf.h	2012-11-30 17:28:32.000000000 +0000
++++ dwarf-20121130-gnu-ops/libdwarf/dwarf.h	2013-01-26 12:56:37.121055486 +0000
+@@ -663,6 +663,14 @@
+ #define DW_OP_GNU_encoded_addr          0xf1 /* GNU */
+ #define DW_OP_GNU_implicit_pointer      0xf2 /* GNU */
+ #define DW_OP_GNU_entry_value           0xf3 /* GNU */
++#define DW_OP_GNU_const_type            0xf4 /* GNU */
++#define DW_OP_GNU_regval_type           0xf5 /* GNU */
++#define DW_OP_GNU_deref_type            0xf6 /* GNU */
++#define DW_OP_GNU_convert               0xf7 /* GNU */
++#define DW_OP_GNU_reinterpret           0xf9 /* GNU */
++#define DW_OP_GNU_parameter_ref         0xfa /* GNU */
++#define DW_OP_GNU_addr_index            0xfb /* GNU */
++#define DW_OP_GNU_const_index           0xfc /* GNU */
+ 
+     /* HP extensions. */
+ #define DW_OP_HP_unknown                0xe0 /* HP conflict: GNU */
+diff -urw dwarf-20121130/libdwarf/dwarf_loc.c dwarf-20121130-gnu-ops/libdwarf/dwarf_loc.c
+--- dwarf-20121130/libdwarf/dwarf_loc.c	2012-11-30 17:28:32.000000000 +0000
++++ dwarf-20121130-gnu-ops/libdwarf/dwarf_loc.c	2013-01-26 12:58:19.277160640 +0000
+@@ -497,7 +497,14 @@
+                 (by the operations encountered so far in this
+                 expression) onto the expression stack as the offset
+                 in thread-local-storage of the variable. */
+-        case DW_OP_GNU_push_tls_address:
++        case DW_OP_GNU_push_tls_address: /* 0xe0 */
++            /* Unimplemented in gdb 7.5.1 ? */
++            break;
++        case DW_OP_GNU_deref_type: /* 0xf6 */
++            /* die offset (uleb128). */
++            operand1 = _dwarf_decode_u_leb128(loc_ptr, &leb128_length);
++            loc_ptr = loc_ptr + leb128_length;
++            offset = offset + leb128_length;
+             break;
+ 
+         case DW_OP_implicit_value: /* DWARF4 */
+@@ -518,6 +525,7 @@
+         case DW_OP_stack_value:  /* DWARF4 */
+             break;
+         case DW_OP_GNU_uninit:            /*  0xf0  GNU */
++            /* Unimplemented in gdb 7.5.1  */
+             /*  Carolyn Tice: Follws a DW_OP_reg or DW_OP_regx
+                 and marks the reg as being uninitialized. */
+             break;
+@@ -585,7 +593,59 @@
+             offset = offset + operand1;
+             loc_ptr = loc_ptr + operand1;
+             break;
+-
++        case DW_OP_GNU_const_type:{      /*  0xf4  GNU */
++            /* die offset as uleb. */
++            operand1 = _dwarf_decode_u_leb128(loc_ptr, &leb128_length);
++            loc_ptr = loc_ptr + leb128_length;
++            offset = offset + leb128_length;
++            /* length of constant */
++            Dwarf_Small conlen = *(Dwarf_Small *) loc_ptr;
++            loc_ptr = loc_ptr + 1;
++            offset = offset + 1;
++            /* constant */
++            READ_UNALIGNED(dbg, operand2, Dwarf_Unsigned, loc_ptr, conlen);
++            loc_ptr = loc_ptr + conlen;
++            offset = offset + conlen;
++            }
++            break;
++        case DW_OP_GNU_regval_type:       /*  0xf5  GNU */
++            /* reg num uleb*/
++            operand1 = _dwarf_decode_u_leb128(loc_ptr, &leb128_length);
++            loc_ptr = loc_ptr + leb128_length;
++            offset = offset + leb128_length;
++            /* cu die off uleb*/
++            operand2 = _dwarf_decode_u_leb128(loc_ptr, &leb128_length);
++            loc_ptr = loc_ptr + leb128_length;
++            offset = offset + leb128_length;
++            break;
++        case DW_OP_GNU_convert:       /*  0xf7  GNU */
++        case DW_OP_GNU_reinterpret:       /*  0xf9  GNU */
++            /* die offset  or zero */
++            operand1 = _dwarf_decode_u_leb128(loc_ptr, &leb128_length);
++            loc_ptr = loc_ptr + leb128_length;
++            offset = offset + leb128_length;
++            break;
++        case DW_OP_GNU_parameter_ref :       /*  0xfa  GNU */
++            /* 4 byte unsigned int */
++            READ_UNALIGNED(dbg, operand1, Dwarf_Unsigned, loc_ptr, 
++                4);
++            loc_ptr = loc_ptr + 4;
++            offset = offset + 4;
++            break;
++        case DW_OP_GNU_addr_index :       /*  0xfb  GNU */
++            /* Address size value */
++            READ_UNALIGNED(dbg, operand1, Dwarf_Unsigned, loc_ptr,
++                address_size);
++            loc_ptr = loc_ptr + address_size;
++            offset = offset + address_size;
++            break;
++        case DW_OP_GNU_const_index :       /*  0xfb  GNU */
++            /* Address size value */
++            READ_UNALIGNED(dbg, operand1, Dwarf_Unsigned, loc_ptr,
++                address_size);
++            loc_ptr = loc_ptr + address_size;
++            offset = offset + address_size;
++            break;
+         default:
+             /*  Some memory does leak here.  */
+ 
diff --git a/libdwarf-offset-size.patch b/libdwarf-offset-size.patch
new file mode 100644
index 0000000..f9a31c2
--- /dev/null
+++ b/libdwarf-offset-size.patch
@@ -0,0 +1,39 @@
+diff -uwr dwarf-20121130/libdwarf/dwarf_loc.c dwarf-20121130-offset_size/libdwarf/dwarf_loc.c
+--- dwarf-20121130/libdwarf/dwarf_loc.c	2012-11-30 17:28:32.000000000 +0000
++++ dwarf-20121130-offset_size/libdwarf/dwarf_loc.c	2013-01-26 12:40:47.118148071 +0000
+@@ -919,7 +919,7 @@
+             }
+             locdesc = _dwarf_get_locdesc(dbg, &loc_block,
+                 address_size,
+-                cucontext->cc_length,
++                cucontext->cc_length_size,
+                 cucontext->cc_version_stamp, 
+                 lowpc, highpc, 
+                 error);
+@@ -958,7 +958,7 @@
+             error, and we don't test for block length 0 specially here. */
+         locdesc = _dwarf_get_locdesc(dbg, &loc_block,
+             address_size,
+-            cucontext->cc_length,
++            cucontext->cc_length_size,
+             cucontext->cc_version_stamp, 
+             lowpc, highpc, 
+             error);
+@@ -1081,7 +1081,7 @@
+         handles only a single location expression.  */
+     locdesc = _dwarf_get_locdesc(dbg, &loc_block,
+         address_size,
+-        cucontext->cc_length,
++        cucontext->cc_length_size,
+         cucontext->cc_version_stamp, 
+         lowpc, highpc, 
+         error);
+@@ -1158,7 +1158,7 @@
+             For correctness, use dwarf_loclist_from_expr_b()
+             instead of dwarf_loclist_from_expr_a(). */
+         version_stamp = current_cu_context->cc_version_stamp;
+-        offset_size = current_cu_context->cc_length;
++        offset_size = current_cu_context->cc_length_size;
+         if (version_stamp < 2) {
+             /* This is probably totally silly.  */
+             version_stamp = CURRENT_VERSION_STAMP;
diff --git a/libdwarf.spec b/libdwarf.spec
index bc9bc48..8cacf8c 100644
--- a/libdwarf.spec
+++ b/libdwarf.spec
@@ -1,6 +1,6 @@
 Name:          libdwarf
 Version:       20121130
-Release:       1%{?dist}
+Release:       2%{?dist}
 Summary:       Library to access the DWARF Debugging file format 
 Group:         Development/Libraries
 
@@ -11,6 +11,12 @@ Source0:       http://reality.sgiweb.org/davea/%{name}-%{version}.tar.gz
 # This patch set up the proper soname
 Patch0:        libdwarf-soname-fix.patch
 
+# Fix for RHBZ#903804 which has been accepted upstream
+Patch1:        libdwarf-offset-size.patch
+
+# Fix for RHBZ#903804 backport of support for extra GNU opcodes
+Patch2:        libdwarf-gnu-ops.patch
+
 BuildRequires: binutils-devel elfutils-libelf-devel
 
 %package devel
@@ -49,6 +55,8 @@ to access DWARF debug information.
 %prep
 %setup -q -n dwarf-%{version}
 %patch0 -p0 -b .soname-fix
+%patch1 -p1 -b .offset-size
+%patch2 -p1 -b .gnu-ops
 
 %build
 pushd libdwarf
@@ -101,6 +109,9 @@ install -pDm 0755 dwarfdump2/dwarfdump     %{buildroot}%{_bindir}/dwarfdump
 %{_bindir}/dwarfdump
 
 %changelog
+* Sat Jan 26 2013 Tom Hughes <tom at compton.nu> - 20121130-2
+- Add offset-size and gnu-ops patches to fix RHBZ#903804
+
 * Mon Dec  3 2012 Tom Hughes <tom at compton.nu> - 20121130-1
 - Update to 20121130 release
 


More information about the scm-commits mailing list