summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2012-10-08 23:08:01 +0200
committerJan Kratochvil <jan.kratochvil@redhat.com>2012-10-08 23:08:01 +0200
commit96a9fc6ae246e2e03f9d82f136960691fa4a88fe (patch)
tree52672439fccfe080d433492859fefa3e39b3e007
parent6c45f4a1221ca4d50afb565ec331d085bc50d35f (diff)
downloadelfutils-96a9fc6ae246e2e03f9d82f136960691fa4a88fe.tar.gz
dwarf_getlocation.c (__libdw_intern_expression) <cfap>: Make new loclist
element DW_OP_call_frame_cfa before decoding the opcodes. Remove the later DW_OP_call_frame_cfa push to RESULT. Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
-rw-r--r--libdw/ChangeLog6
-rw-r--r--libdw/dwarf_getlocation.c28
2 files changed, 21 insertions, 13 deletions
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 3500cf81..cc45d599 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,5 +1,11 @@
2012-10-08 Jan Kratochvil <jan.kratochvil@redhat.com>
+ * dwarf_getlocation.c (__libdw_intern_expression) <cfap>: Make new
+ loclist element DW_OP_call_frame_cfa before decoding the opcodes.
+ Remove the later DW_OP_call_frame_cfa push to RESULT.
+
+2012-10-08 Jan Kratochvil <jan.kratochvil@redhat.com>
+
Code cleanup.
* fde.c (binary_search_fde): Remove always true <address >= start>
conditional. Move L initialization upwards.
diff --git a/libdw/dwarf_getlocation.c b/libdw/dwarf_getlocation.c
index dfaa742c..cda98a99 100644
--- a/libdw/dwarf_getlocation.c
+++ b/libdw/dwarf_getlocation.c
@@ -224,6 +224,21 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order,
struct loclist *loclist = NULL;
unsigned int n = 0;
+
+ if (cfap)
+ {
+ /* Synthesize the operation to push the CFA before the expression. */
+ struct loclist *newloc;
+ newloc = (struct loclist *) alloca (sizeof (struct loclist));
+ newloc->atom = DW_OP_call_frame_cfa;
+ newloc->number = 0;
+ newloc->number2 = 0;
+ newloc->offset = -1;
+ newloc->next = loclist;
+ loclist = newloc;
+ ++n;
+ }
+
/* Decode the opcodes. It is possible in some situations to have a
block of size zero. */
while (data < end_data)
@@ -434,9 +449,6 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order,
++n;
}
- if (cfap)
- ++n;
-
/* Allocate the array. */
Dwarf_Op *result;
if (dbg != NULL)
@@ -456,16 +468,6 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order,
*llbuf = result;
*listlen = n;
- if (cfap)
- {
- /* Synthesize the operation to push the CFA before the expression. */
- --n;
- result[0].atom = DW_OP_call_frame_cfa;
- result[0].number = 0;
- result[0].number2 = 0;
- result[0].offset = -1;
- }
-
do
{
/* We populate the array from the back since the list is backwards. */