Permalink
Browse files

More robust handling of unknown name (build with -rdynamic on linux)

  • Loading branch information...
pkhuong committed Oct 19, 2011
1 parent 57b7e5a commit 82027a933a9a6096a2353ae1c254a79cc3282a8c
Showing with 7 additions and 1 deletion.
  1. +5 −0 vlbdb_impl.cpp
  2. +2 −1 vlbdb_impl.hpp
View
@@ -141,7 +141,12 @@ vlbdb_register_function (vlbdb_unit_t * unit, void * function,
Dl_info info;
assert(dladdr(function, &info));
name = info.dli_sname;
+ if (!name) name = "";
}
+
+ if (function == NULL)
+ function = dlsym(RTLD_DEFAULT, name);
+
Function * LF = unit->module->getFunction(name);
if (!LF) {
int status = 0;
View
@@ -10,6 +10,7 @@
#include <map>
#include <vector>
#include <utility>
+#include <assert.h>
#define VLBDB_IN_IMPLEMENTATION
struct binding_unit_impl;
@@ -100,7 +101,7 @@ struct binder_impl
void * function)
: unit(unit_)
{
- vlbdb_register_function(unit, function, 0, NULL);
+ assert(unit->ptr_to_function.find(function) != unit->ptr_to_function.end());
base = unit->ptr_to_function[function];
fun_type = base->getFunctionType();
params = fun_type->param_begin();

0 comments on commit 82027a9

Please sign in to comment.