*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / parse.c
index 5d949fd6e2a28c2f423208aae957df85063effe5..6ba5a45e57bde9c2934b6c2c448b2ef07c4cdf61 100644 (file)
@@ -1,7 +1,7 @@
 /* Parse expressions for GDB.
 
-   Copyright (C) 1986, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
-   1997, 1998, 1999, 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1986, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
+   1998, 1999, 2000, 2001, 2004, 2005, 2007 Free Software Foundation, Inc.
 
    Modified from expread.y by the Department of Computer Science at the
    State University of New York at Buffalo, 1991.
@@ -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.  */
@@ -218,6 +219,15 @@ write_exp_elt_block (struct block *b)
   write_exp_elt (tmp);
 }
 
+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)
 {
@@ -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,23 @@ write_exp_msymbol (struct minimal_symbol *msymbol,
 
   write_exp_elt_opcode (OP_LONG);
 
+  if (SYMBOL_BFD_SECTION (msymbol)
+      && 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)
     {
@@ -481,7 +509,7 @@ write_dollar_variable (struct stoken str)
 
   /* Handle tokens that refer to machine registers:
      $ followed by a register name.  */
-  i = frame_map_name_to_regnum (deprecated_selected_frame,
+  i = frame_map_name_to_regnum (deprecated_safe_get_selected_frame (),
                                str.ptr + 1, str.length - 1);
   if (i >= 0)
     goto handle_register;
@@ -904,6 +932,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 +1374,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 
This page took 0.024733 seconds and 4 git commands to generate.