{
auto *real_cache = C_API_SYMCACHE(cache);
- if (func) {
- g_assert (parent == -1);
-
+ if (parent == -1) {
return real_cache->add_symbol_with_callback(name, priority, func, user_data, type);
}
else {
real_type_pair.second |= SYMBOL_TYPE_NOSTAT;
}
+ if (real_type_pair.first == symcache_item_type::VIRTUAL) {
+ msg_err_cache("trying to add virtual symbol %s as real (no parent)", name.data());
+ return -1;
+ }
+
if ((real_type_pair.second & SYMBOL_TYPE_FINE) && priority == 0) {
/* Adjust priority for negative weighted symbols */
priority = 1;