1 #include "../include/plugin.hpp"
2 #include "../include/string.hpp"
3 #include "../include/util.hpp"
52 throw exception(
"invalid argument: path (=%p)", path);
58 u32 flags = RTLD_LOCAL | RTLD_LAZY;
70 #if CSDBG_DBG_LEVEL & CSDBG_DBGL_INFO
129 #if CSDBG_DBG_LEVEL & CSDBG_DBGL_INFO
228 throw exception(
"no selected module, this is an inline plugin");
231 throw exception(
"invalid argument: nm (=%p)", nm);
233 string *mangled = NULL;
234 if (
likely(scope == NULL) )
243 mangled =
new string(
"_ZN");
244 parts = tmp.
split(
"::");
247 string *token = parts->
at(i);
251 mangled->
append(
"%d%s", strlen(nm), nm);
252 mangled->
append(
"EPvS%d_", parts->
size() - 1);
273 "failed to resolve symbol %s in object '%s' (%s)",
303 return const_cast<plugin&
> (*this);
320 m_end(this_fn, call_site);
322 return const_cast<plugin&
> (*this);
modsym_t m_end
Instrumentation ending callback.
virtual string & append(const string &)
Append a string.
virtual plugin & begin(void *, void *) const
Begin instrumenting a function.
virtual T * at(u32) const
Get the node data pointer at a chain offset.
virtual plugin * clone() const
Object virtual copy constructor.
virtual u32 size() const
Get the chain size (node count)
virtual const i8 * path() const
Get the module file path.
char i8
8-bit signed integer
Function instrumentation plugin.
#define likely(expr)
Offer a hint (positive) to the pipeline branch predictor.
virtual plugin & destroy()
Object deconstruction.
virtual plugin & operator=(const plugin &)
Assignment operator.
virtual ~plugin()
Object destructor.
modsym_t m_begin
Instrumentation starting callback.
i8 * m_path
Module file path.
virtual const i8 * cstr() const
Get the C-string equivalent.
void(* modsym_t)(void *, void *)
Plugin callback.
Lightweight string buffer class (for ISO-8859-1 text)
unsigned int u32
32-bit unsigned integer
virtual u32 length() const
Get the character count.
virtual modsym_t resolve(const i8 *, const i8 *=NULL) const
Resolve a module symbol.
plugin(const i8 *, const i8 *=NULL)
Object constructor.
void * m_handle
DSO handle (as provided by dlopen)
This class is a throwable with a textual description of an error.
virtual chain< string > * split(const string &, bool=true, bool=false) const
Tokenize using a POSIX extended regular expression.
#define unlikely(expr)
Offer a hint (negative) to the pipeline branch predictor.
static void dbg_info(const i8 *,...)
Print an informational debug message on the standard error stream.
virtual plugin & end(void *, void *) const
End a function instrumentation.
#define __D_ASSERT(x)
Assertion macro.