]> sourceware.org Git - systemtap.git/commitdiff
PR14013: don't reject DW_OP_GNU_push_tls_address DWARF location operator
authorFrank Ch. Eigler <fche@redhat.com>
Thu, 28 May 2020 16:45:06 +0000 (12:45 -0400)
committerFrank Ch. Eigler <fche@redhat.com>
Thu, 28 May 2020 16:52:39 +0000 (12:52 -0400)
Subject DWARF OP is used for accessing TLS variables in GCC-compiled C
code.  In all but the simplest cases, we must emulate libthread_db
logic for resolving TLS addresses.  Step 1 is to map this operator to
a tapset function call __push_tls_address, which will implement the
architecture-specific lookup functionality.

We also tweak systemtap_session::print_error to ensure even isolated
little error messages seen only once do get printed.

See also: https://infinitynotes.org/wiki/Glibc

elaborate.cxx
loc2stap.cxx
session.cxx

index e90f97e8b2aba47f8745c7e35851237f84dccb87..6cbc85038e5fab9afe59c5d820a336c0a148c2d5 100644 (file)
@@ -2941,7 +2941,8 @@ symresolution_info::visit_functioncall (functioncall* e)
   else
     {
       string sugs = levenshtein_suggest(e->function, collect_functions(), 5); // print 5 funcs
-      throw SEMANTIC_ERROR(_F("unresolved function%s",
+      throw SEMANTIC_ERROR(_F("unresolved function %s%s",
+                              string(e->function).c_str(),
                               sugs.empty() ? "" : (_(" (similar: ") + sugs + ")").c_str()),
                            e->tok);
     }
index d4fd0518262005d764999d258d6806fb51c5a58f..6e6069dcfb294ac2195cab8dc87b4f221437a8cf 100644 (file)
@@ -690,6 +690,18 @@ location_context::translate (const Dwarf_Op *expr, const size_t len,
            }
            break;
 
+          case DW_OP_GNU_push_tls_address:
+            {
+              POP(addr);
+              functioncall *fc = new functioncall;
+              fc->tok = e->tok;
+              fc->function = std::string("__push_tls_address");
+              fc->synthetic = true;
+              fc->args.push_back(addr);
+             PUSH(fc);
+            }
+            break;
+            
          default:
            DIE ("unhandled DW_OP operation");
            break;
index 1304570cdbb2aa96c8d4c1d876b1e6e7e9b9bf07..d0959f018c4d8fa6e5e2db2037dec7277366fe26 100644 (file)
@@ -2382,6 +2382,7 @@ systemtap_session::print_error (const semantic_error& se)
   if (verbose > 0 || seen_errors[se.errsrc_chain()] < 1)
     {
       seen_errors[se.errsrc_chain()]++;
+      cerr << build_error_msg(se);
       for (const semantic_error *e = &se; e != NULL; e = e->get_chain())
         if (verbose > 1 || seen_errors[e->errsrc] < 1) // dupe-eliminate chained errors too
           {
This page took 0.040277 seconds and 5 git commands to generate.