Difference between revisions of "Probing locations with no symbols"
(Created page with "In general, you will use the Apc compiler to compile probes written in APC which use probe points that name symbols in your program, like: probe thread { probe "my f...") |
m (→Disabling symbol filtering) |
||
Line 13: | Line 13: | ||
== Disabling symbol filtering == | == Disabling symbol filtering == | ||
− | On Linux you can disable symbol filtering by setting <code> | + | On Linux you can disable symbol filtering by setting <code>APROBE_DO_NOT_FILTER=true</code>. This will put all symbols in the table and you are at your own risk when probing. |
== Adding a symbol == | == Adding a symbol == |
Revision as of 22:56, 18 December 2017
In general, you will use the Apc compiler to compile probes written in APC which use probe points that name symbols in your program, like:
probe thread { probe "my function" { ... } }
The symbols from your application and shared libraries will be entered in the Aprobe symbol table. In some cases Aprobe will filter out symbols either because they are not interesting or because probing them would be dangerous. Sometimes the symbols will be entered in the symbols table but the will be blocked from probing.
Disabling symbol filtering
On Linux you can disable symbol filtering by setting APROBE_DO_NOT_FILTER=true
. This will put all symbols in the table and you are at your own risk when probing.
Adding a symbol
If you know a symbol address you can use the Aprobe API to add a symbol dynamically, which you can then probe using a call patch.
Use the following to define the symbol:
/* * Create a new symbol ID within the module. If FileName is ap_ExternSymbol * the function symbol is global, otherwise it is local. If ModuleChecksum * is non-zero then this is compared with the module checksum and the * symbol is only added if the checksums match. ap_NoSymbolId is * returned if the symbol cannot be created. This can only be called * up to the completion of the probe program on_entry clause. */ extern ap_SymbolIdT ap_RecordDynamicFunctionSymbol ( ap_ModuleIdT ModuleId, ap_NameT FunctionName, ap_NameT FileName, ap_OffsetT OffsetInModule, ap_SizeT Size, ap_Uint32 ModuleChecksum);
Create a call patch using the following:
typedef ap_Uint32 (*ap_CallPatchSubprogramT) (ap_ExecutionContextPtrT, ap_PatchIdT);
/* Creates a call patch and attaches it to the target memory location. Returns a unique PatchId if successful, ap_NoPatchId otherwise. Note that the patch ID returned is the raw patch ID but the call patch ID will be passed to the patch subprogram. */ extern ap_PatchIdT ap_CreateCallPatch ( ap_AddressT, /* Text section address that has to be patched. */ ap_CallPatchSubprogramT); /* Subprogram to patch in a call for. */
See aprobe.h
for more information or contact OCS support.