aboutsummaryrefslogtreecommitdiff
path: root/prototype.c
diff options
context:
space:
mode:
authorPetr Machata <pmachata@redhat.com>2013-10-23 00:39:23 +0200
committerPetr Machata <pmachata@redhat.com>2013-10-23 00:39:23 +0200
commit82f748d1bc2b95d594327ad15f3a6908070dd5c3 (patch)
treebca73acc5b6bfd5390e800d678a3868993f489ed /prototype.c
parent71025328700158770edf84cbce64d977298b6e88 (diff)
downloadltrace-82f748d1bc2b95d594327ad15f3a6908070dd5c3.tar.gz
System calls are now part of dedicated symbol library
- This symbol library is still special in that symbols are created on demand and never actually added. It just serves as a link to protolibrary with system call prototypes, and has a name (SYS). - Prototypes for system calls were moved to a dedicated prototype library called syscalls.conf. - Because it's undesirable to look up syscall prototypes in anything but the dedicated syscall protolib, prototype.c/.h now understand that some lookups shouldn't be done recursively (and so we never pick the definition from -F file that just happens to have the same name as a system call). The good thing is that now libraries can actually use symbols named SYS_something without clashing with system call prototypes. - One test case needed to be updated, because we now display system calls as something@SYS instead of SYS_something.
Diffstat (limited to 'prototype.c')
-rw-r--r--prototype.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/prototype.c b/prototype.c
index 24e2625..fa9b6cc 100644
--- a/prototype.c
+++ b/prototype.c
@@ -244,8 +244,9 @@ protolib_add_named_type(struct protolib *plib, const char *name, int own_name,
struct lookup {
const char *name;
- void *result;
struct dict *(*getter)(struct protolib *plib);
+ bool imports;
+ void *result;
};
static struct dict *
@@ -274,7 +275,8 @@ protolib_lookup_rec(struct protolib **plibp, void *data)
if (lookup->result != NULL)
return CBS_STOP;
- if (each_import(*plibp, NULL, &protolib_lookup_rec, lookup) != NULL) {
+ if (lookup->imports && each_import(*plibp, NULL, &protolib_lookup_rec,
+ lookup) != NULL) {
assert(lookup->result != NULL);
return CBS_STOP;
}
@@ -284,10 +286,11 @@ protolib_lookup_rec(struct protolib **plibp, void *data)
static void *
protolib_lookup(struct protolib *plib, const char *name,
- struct dict *(*getter)(struct protolib *))
+ struct dict *(*getter)(struct protolib *),
+ bool imports)
{
assert(plib != NULL);
- struct lookup lookup = { name, NULL, getter };
+ struct lookup lookup = { name, getter, imports, NULL };
if (protolib_lookup_rec(&plib, &lookup) == CBS_STOP)
assert(lookup.result != NULL);
else
@@ -296,17 +299,17 @@ protolib_lookup(struct protolib *plib, const char *name,
}
struct prototype *
-protolib_lookup_prototype(struct protolib *plib, const char *name)
+protolib_lookup_prototype(struct protolib *plib, const char *name, bool imports)
{
assert(plib != NULL);
- return protolib_lookup(plib, name, &get_prototypes);
+ return protolib_lookup(plib, name, &get_prototypes, imports);
}
struct named_type *
-protolib_lookup_type(struct protolib *plib, const char *name)
+protolib_lookup_type(struct protolib *plib, const char *name, bool imports)
{
assert(plib != NULL);
- return protolib_lookup(plib, name, &get_named_types);
+ return protolib_lookup(plib, name, &get_named_types, imports);
}
static void