fix multi-arch-exec for parallel mode
[deliverable/binutils-gdb.git] / gdb / dwarf2loc.c
index 55d43f1d0c0f9e2e2ce2bb4500b6965d08a288b0..8242dca93b83a065b3fd5cb2a60375a0b518f7a7 100644 (file)
@@ -2290,11 +2290,21 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
            if (byte_offset != 0)
              error (_("cannot use offset on synthetic pointer to register"));
            do_cleanups (value_chain);
-           if (gdb_regnum != -1)
-             retval = value_from_register (type, gdb_regnum, frame);
-           else
+          if (gdb_regnum == -1)
              error (_("Unable to access DWARF register number %d"),
                     dwarf_regnum);
+          retval = value_from_register (type, gdb_regnum, frame);
+          if (value_optimized_out (retval))
+            {
+              /* This means the register has undefined value / was
+                 not saved.  As we're computing the location of some
+                 variable etc. in the program, not a value for
+                 inspecting a register ($pc, $sp, etc.), return a
+                 generic optimized out value instead, so that we show
+                 <optimized out> instead of <not saved>.  */
+              do_cleanups (value_chain);
+              retval = allocate_optimized_out_value (type);
+            }
          }
          break;
 
@@ -3487,7 +3497,7 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream,
       fprintf_filtered (stream, 
                        _("a thread-local variable at offset 0x%s "
                          "in the thread-local storage for `%s'"),
-                       phex_nz (offset, addr_size), objfile->name);
+                       phex_nz (offset, addr_size), objfile_name (objfile));
 
       data += 1 + addr_size + 1;
     }
@@ -3510,7 +3520,7 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream,
       fprintf_filtered (stream, 
                        _("a thread-local variable at offset 0x%s "
                          "in the thread-local storage for `%s'"),
-                       phex_nz (offset, addr_size), objfile->name);
+                       phex_nz (offset, addr_size), objfile_name (objfile));
       ++data;
     }
 
This page took 0.029725 seconds and 4 git commands to generate.