Re: [PATCH 3/4] gcov: add gcov profiling infrastructure

Li Wei
2009-02-26T10:33:29Z

On Thu, 2009-02-26 at 11:00 +0100, Peter Oberparleiter wrote:
> Since a few RCs have been released since the last gcov-kernel patch
> post, I'll do a full re-post with a fix similar to the one you suggested
> included.

Thanks! It would be great if ".."s in object pathnames could also be
supported in the forth coming re-post.

I have some external modules which link with object files outside their
directories. For example, a source tree looks like

module0/main.c
lib0/lib.c

and the Kbuild file has to use

main-y += ../lib0/lib.o

to link in lib.c. Current gcov-kernel does not support ".." in
pathnames. Could ".."s be handled in add_node?

---
kernel/gcov/fs.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/kernel/gcov/fs.c b/kernel/gcov/fs.c
index aab3be7..2f92955 100644
--- a/kernel/gcov/fs.c
+++ b/kernel/gcov/fs.c
@@ -500,6 +500,15 @@ static void add_node(struct gcov_info *info)
if (curr == next)
continue;
*next = 0;
+ if (!strcmp(curr, "."))
+ continue;
+ if (!strcmp(curr, "..")) {
+ if (parent != &root_node) {
+ parent = parent->parent;
+ continue;
+ } else
+ goto out_err;
+ }
node = get_child_by_name(parent, curr);
if (!node) {
node = new_node(parent, NULL, curr);
--
1.5.6.3