* defs.h (extract_signed_integer, extract_unsigned_integer,
[deliverable/binutils-gdb.git] / gdb / dwarf2loc.c
index 16d8ceed057c724e16180cedf76fdf191a7647af..7a54f436ab53c6a901aff143a0b825c6fb8b84d6 100644 (file)
@@ -31,6 +31,7 @@
 #include "regcache.h"
 #include "objfiles.h"
 #include "exceptions.h"
+#include "block.h"
 
 #include "elf/dwarf2.h"
 #include "dwarf2expr.h"
@@ -56,6 +57,7 @@ find_location_expression (struct dwarf2_loclist_baton *baton,
   int length;
   struct objfile *objfile = dwarf2_per_cu_objfile (baton->per_cu);
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
+  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   unsigned int addr_size = dwarf2_per_cu_addr_size (baton->per_cu);
   CORE_ADDR base_mask = ~(~(CORE_ADDR)1 << (addr_size * 8 - 1));
   /* Adjust base_address for relocatable objects.  */
@@ -88,7 +90,7 @@ find_location_expression (struct dwarf2_loclist_baton *baton,
       low += base_address;
       high += base_address;
 
-      length = extract_unsigned_integer (loc_ptr, 2);
+      length = extract_unsigned_integer (loc_ptr, 2, byte_order);
       loc_ptr += 2;
 
       if (pc >= low && pc < high)
@@ -147,14 +149,19 @@ dwarf_expr_frame_base (void *baton, gdb_byte **start, size_t * length)
   struct symbol *framefunc;
   struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton;
 
-  framefunc = get_frame_function (debaton->frame);
+  /* Use block_linkage_function, which returns a real (not inlined)
+     function, instead of get_frame_function, which may return an
+     inlined function.  */
+  framefunc = block_linkage_function (get_frame_block (debaton->frame, NULL));
 
   /* If we found a frame-relative symbol then it was certainly within
      some function associated with a frame. If we can't find the frame,
      something has gone wrong.  */
   gdb_assert (framefunc != NULL);
 
-  if (SYMBOL_COMPUTED_OPS (framefunc) == &dwarf2_loclist_funcs)
+  if (SYMBOL_LOCATION_BATON (framefunc) == NULL)
+    *start = NULL;
+  else if (SYMBOL_COMPUTED_OPS (framefunc) == &dwarf2_loclist_funcs)
     {
       struct dwarf2_loclist_baton *symbaton;
       struct frame_info *frame = debaton->frame;
@@ -502,7 +509,7 @@ locexpr_describe_location (struct symbol *symbol, struct ui_file *stream)
        fprintf_filtered (stream, 
                          "a thread-local variable at offset %s in the "
                          "thread-local storage for `%s'",
-                         paddr_nz (offset), objfile->name);
+                         paddress (gdbarch, offset), objfile->name);
        return 1;
       }
   
This page took 0.03248 seconds and 4 git commands to generate.