Skip to content

Instantly share code, notes, and snippets.

@agentzh
Created September 28, 2020 21:04
Show Gist options
  • Save agentzh/099dd1e8c57cde2601e4f83d2c60a598 to your computer and use it in GitHub Desktop.
Save agentzh/099dd1e8c57cde2601e4f83d2c60a598 to your computer and use it in GitHub Desktop.
diff --git a/doc/SystemTap_Beginners_Guide/en-US/ScriptConstructs.xml b/doc/SystemTap_Beginners_Guide/en-US/ScriptConstructs.xml
index 218fd9ebc..20e61de57 100644
--- a/doc/SystemTap_Beginners_Guide/en-US/ScriptConstructs.xml
+++ b/doc/SystemTap_Beginners_Guide/en-US/ScriptConstructs.xml
@@ -170,6 +170,12 @@ then it can be referenced through
<quote><command>@var("<replaceable>varname</replaceable>@<replaceable>src/file.c</replaceable>")</command></quote>.
</para>
+<para>
+It is also supported to specify an executable or library file path as the
+second argument, as in
+<quote><command>@var("<replaceable>varname</replaceable>", "<replaceable>/path/to/exe/or/lib</replaceable>")</command></quote>
+</para>
+
<para>
SystemTap tracks the typing information of the target variable and can
examine the fields of a structure with the <command>-></command> operator.
diff --git a/doc/langref.tex b/doc/langref.tex
index f7167734c..bba017ce3 100644
--- a/doc/langref.tex
+++ b/doc/langref.tex
@@ -1094,6 +1094,10 @@ file name at the end and has the shortest file name path (e.g. given
\texttt{src/sub/module/bar/baz.c} and \texttt{src/bar/baz.c} the second
CU will be chosen to resolve \texttt{foo}).
+The notation \texttt{@var("varname", "/path/to/exe-or-so)} is also supported
+to explicitly specify an executable or library file path in which the global or
+top-level static variable resides.
+
\texttt{\$var->field} or \texttt{@var("var@file.c")->field} traverses a
structure's field. The indirection operator may be repeated to follow
additional levels of pointers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment