Difference between revisions of "Setting String Parameters"
From OC Systems Wiki!
(Created page with " Modifying string parameters from applications can be confusing because different languages have different string formats. Here are some examples for modifying different kind...") |
m (Swn moved page String modifying to Setting String Parameters without leaving a redirect) |
||
(One intermediate revision by the same user not shown) | |||
Line 76: | Line 76: | ||
Will modify the C++ string parameter "str" before the method is executed. | Will modify the C++ string parameter "str" before the method is executed. | ||
− | See [[http://www.ocsystems.com/w/index.php/Aprobe_FAQ | + | See [[http://www.ocsystems.com/w/index.php/Aprobe_FAQ:Aprobe FAQ]] section 17.65 for directions on building <code>cppstring.ual</code>. |
==Ada Example== | ==Ada Example== | ||
− | + | See [[Setting Ada String Parameters]] for Ada examples. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
[[Category:FAQ]] | [[Category:FAQ]] | ||
[[Category:Strings]] | [[Category:Strings]] | ||
[[Category:Modifying]] | [[Category:Modifying]] |
Latest revision as of 00:22, 9 March 2021
Modifying string parameters from applications can be confusing because different languages have different string formats. Here are some examples for modifying different kinds of strings.
C Example
For a C program like this:
/* C function with string parameter */
void p1(const char *str)
{
printf("str = %s\n", str);
}
This probe:
probe thread
{
probe "p1"
{
on_entry
{
// modify string directly
$str = "string value";
}
}
}
Will modify the string parameter "str" before it is used in the function.
C++ Example
For a C++ program like this:
void p1(std::string str)
{
std::cout << "str = " << str << std::endl;
}
This probe:
#include "cppstring.h"
probe thread
{
probe "p1"
{
on_entry
{
// modify string using macro
AP_SET_CPP_STR($str, "new value");
}
}
}
Compiled with this command:
apc -x my program.exe myprobe.apc cppstring.ual
Will modify the C++ string parameter "str" before the method is executed.
See [FAQ] section 17.65 for directions on building cppstring.ual
.
Ada Example
See Setting Ada String Parameters for Ada examples.