]> sourceware.org Git - systemtap.git/commitdiff
improve error message for $foo->bar.baz misuse
authorFrank Ch. Eigler <fche@redhat.com>
Tue, 14 May 2013 19:55:34 +0000 (15:55 -0400)
committerFrank Ch. Eigler <fche@redhat.com>
Tue, 14 May 2013 19:55:34 +0000 (15:55 -0400)
elaborate.cxx
man/error::pass2.7stap

index 75d77bc1e6dcf39a1f4c253f47f27c8ed9d22633..1bb3caaf0ad23336de8ad119d52136c67d682baf 100644 (file)
@@ -1086,7 +1086,10 @@ struct symbol_fetcher
 
   void throwone (const token* t)
   {
-    throw semantic_error (_("Expecting symbol or array index expression"), t);
+    if (t->type == tok_operator && t->content == ".") // guess someone misused . in $foo->bar.baz expression
+      throw semantic_error (_("Expecting symbol or array index expression, try -> instead"), t);
+    else
+      throw semantic_error (_("Expecting symbol or array index expression"), t);
   }
 };
 
index 40ab0e024e4b403883a52eb2c069f227260e130f..abd7309664c577f67f075c9cfb9a03c8564baa98 100644 (file)
@@ -38,7 +38,14 @@ There might be a spelling error in the probe point name ("sycsall" vs.
 "syscall").  Wildcard probes may not find a match at all in the
 tapsets.  Recheck the names using
 .IR "stap \-l PROBEPOINT" .
-
+Another common mistake is to use the
+.IR .
+operator instead of the correct 
+.IR \->
+when dereferencing context variable subfields or pointers:
+.IR $foo\->bar\->baz
+even if in C one would say
+.IR foo\->bar.baz .
 
 .TP
 unavailable context variables
This page took 0.040117 seconds and 5 git commands to generate.