This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug varobj/18564] regression in showing __thread so extern variable


https://sourceware.org/bugzilla/show_bug.cgi?id=18564

--- Comment #3 from Mark Wielaard <mjw at redhat dot com> ---
Somewhat random attempt at a fix based on the observation of Philippe that in
the patch, elfread.c, there is one mention of 'non-TLS' and in that case the
offset was added previously.

diff --git a/gdb/findvar.c b/gdb/findvar.c
index a2a7bb7..e153989 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -582,7 +582,14 @@ default_read_var_value (struct symbol *var, struct
frame_info *frame)
        obj_section = MSYMBOL_OBJ_SECTION (lookup_data.result.objfile, msym);
        if (obj_section
            && (obj_section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0)
-         addr = target_translate_tls_address (obj_section->objfile, addr);
+         {
+           CORE_ADDR offset;
+           struct objfile *objfile = obj_section->objfile;
+           offset = ANOFFSET (objfile->section_offsets,
+                              gdb_bfd_section_index (objfile->obfd,
+                                                     obj_section));
+           addr = target_translate_tls_address (objfile, addr - offset);
+         }
       }
       break;

With this the testcase passes again.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]