aboutsummaryrefslogtreecommitdiff
path: root/gdb/parse.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2006-10-10 03:17:53 +0000
committerDaniel Jacobowitz <drow@false.org>2006-10-10 03:17:53 +0000
commit9e35dae42503f6cef9a1f87e31a6f1111f3cb508 (patch)
treee6cff422c66aa30f070da5269292b7dd67684bb4 /gdb/parse.c
parenta48251ed04471c0294aead9ee7be8ed9d3a9ad9e (diff)
downloadgdb-9e35dae42503f6cef9a1f87e31a6f1111f3cb508.zip
gdb-9e35dae42503f6cef9a1f87e31a6f1111f3cb508.tar.gz
gdb-9e35dae42503f6cef9a1f87e31a6f1111f3cb508.tar.bz2
2006-10-09 Jan Kratochvil <jan.kratochvil@redhat.com>
Daniel Jacobowitz <dan@codesourcery.com> * Makefile.in (expprint.o, parse.o, target.o): Update. * dwarf2loc.c (dwarf_expr_tls_address): Move body to target_translate_tls_address. Call it. * eval.c (evaluate_subexp_standard): Handle UNOP_MEMVAL_TLS. * expprint.c (print_subexp_standard): Likewise. (op_name_standard, dump_subexp_body_standard): Likewise. * expression.h (enum exp_opcode): Add UNOP_MEMVAL_TLS. (union exp_element): Add objfile. * parse.c (write_exp_elt_objfile): New function. (msym_tls_symbol_type): New. (write_exp_msymbol): Handle TLS. (operator_length_standard): Handle UNOP_MEMVAL_TLS. (build_parse): Initialize msym_tls_symbol_type. * parser-defs.h (write_exp_elt_objfile): New prototype. * target.c (target_translate_tls_address): New. * target.h (target_translate_tls_address): Add prototype. 2006-10-09 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.threads/tls-nodebug.c, gdb.threads/tls-nodebug.exp: New test.
Diffstat (limited to 'gdb/parse.c')
-rw-r--r--gdb/parse.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/gdb/parse.c b/gdb/parse.c
index 5d949fd..b0edaf4 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -53,6 +53,7 @@
#include "gdb_assert.h"
#include "block.h"
#include "source.h"
+#include "objfiles.h"
/* Standard set of definitions for printing, dumping, prefixifying,
* and evaluating expressions. */
@@ -219,6 +220,15 @@ write_exp_elt_block (struct block *b)
}
void
+write_exp_elt_objfile (struct objfile *objfile)
+{
+ union exp_element tmp;
+ memset (&tmp, 0, sizeof (union exp_element));
+ tmp.objfile = objfile;
+ write_exp_elt (tmp);
+}
+
+void
write_exp_elt_longcst (LONGEST expelt)
{
union exp_element tmp;
@@ -378,6 +388,7 @@ write_exp_bitstring (struct stoken str)
static struct type *msym_text_symbol_type;
static struct type *msym_data_symbol_type;
static struct type *msym_unknown_symbol_type;
+static struct type *msym_tls_symbol_type;
void
write_exp_msymbol (struct minimal_symbol *msymbol,
@@ -397,6 +408,22 @@ write_exp_msymbol (struct minimal_symbol *msymbol,
write_exp_elt_opcode (OP_LONG);
+ if (SYMBOL_BFD_SECTION (msymbol)->flags & SEC_THREAD_LOCAL)
+ {
+ bfd *bfd = SYMBOL_BFD_SECTION (msymbol)->owner;
+ struct objfile *ofp;
+
+ ALL_OBJFILES (ofp)
+ if (ofp->obfd == bfd)
+ break;
+
+ write_exp_elt_opcode (UNOP_MEMVAL_TLS);
+ write_exp_elt_objfile (ofp);
+ write_exp_elt_type (msym_tls_symbol_type);
+ write_exp_elt_opcode (UNOP_MEMVAL_TLS);
+ return;
+ }
+
write_exp_elt_opcode (UNOP_MEMVAL);
switch (msymbol->type)
{
@@ -904,6 +931,11 @@ operator_length_standard (struct expression *expr, int endpos,
args = 1;
break;
+ case UNOP_MEMVAL_TLS:
+ oplen = 4;
+ args = 1;
+ break;
+
case UNOP_ABS:
case UNOP_CAP:
case UNOP_CHR:
@@ -1341,6 +1373,10 @@ build_parse (void)
init_type (TYPE_CODE_INT, 1, 0,
"<variable (not text or data), no debug info>",
NULL);
+
+ msym_tls_symbol_type =
+ init_type (TYPE_CODE_INT, TARGET_INT_BIT / HOST_CHAR_BIT, 0,
+ "<thread local variable, no debug info>", NULL);
}
/* This function avoids direct calls to fprintf