]> sourceware.org Git - systemtap.git/commitdiff
dwflpp/prologue: fix DW_AT_producer parsing
authorJonathan Lebon <jlebon@redhat.com>
Thu, 27 Feb 2014 19:43:11 +0000 (14:43 -0500)
committerJonathan Lebon <jlebon@redhat.com>
Thu, 27 Feb 2014 19:43:11 +0000 (14:43 -0500)
dwflpp.cxx

index bf40a278b9a8bf5a58f36c5b7da8380b9c0b3a3f..280e5241db2b00d53f61d2b4f2e6a344d313196a 100644 (file)
@@ -2081,23 +2081,27 @@ dwflpp::resolve_prologue_endings (func_info_map_t & funcs)
   Dwarf_Attribute producer_attr;
   if (dwarf_attr_integrate(cu, DW_AT_producer, &producer_attr))
     {
-      // GNU C x.x.x YYYYMMDD ...
+      // GNU C[++] x.x.x YYYYMMDD ...
       const char* producer = dwarf_formstring(&producer_attr);
       const char* gnuc = strstr(producer, "GNU C");
       if (gnuc)
         {
-          string version;
-
-          // skip to the version number
-          gnuc += 6;
+          // skip over GNU C[++]
+          gnuc += 4; // skip to C
           const char *space = strchr(gnuc, ' ');
-          if (!space)
-            version.assign(gnuc);
-          else
-            version.assign(gnuc, space-gnuc);
-
-          if (strverscmp(version.c_str(), "4.4.0") < 0)
-            consider_decl_line = true;
+          if (space && *(space+1) != '\0')
+            {
+              string version;
+              const char* vers = space+1;
+              space = strchr(vers, ' ');
+              if (!space)
+                version.assign(vers);
+              else
+                version.assign(vers, space-vers);
+
+              if (strverscmp(version.c_str(), "4.4.0") < 0)
+                consider_decl_line = true;
+            }
         }
     }
 
This page took 0.032961 seconds and 5 git commands to generate.