|
From: Betty W. <bet...@gm...> - 2004-09-24 03:21:24
|
Dear all,
I am trying to add a linked list into Valgrind, more specifically
Cachegrind to collect some data access information that is useful to
me. What I want to do is that I collect some data information while
running Valgrind and I want to keep these information into a linked
list.
From reading the documentation, I know that
Valgrind is compiled into a shared object, valgrind.so. This causes
the .so to be loaded as an extra library to any subsequently executed
dynamically-linked ELF binary.
The dynamic linker calls the initialization function of Valgrind. Then
the dynamic linker calls the main of the loaded program. When main
returns, the synthetic CPU calls the finalization function of
valgrind.so. During the execution of the finalization function,
summary of all errors detected are printed and memory leaks are
checked.
Basically, I want to add a linked list as a globle data structure, so
while the main function is exucted, useful data will be collected into
my linked list. And at the end, I will print all the data stored in
the linked list.
Because there is main fuction in Valgrind, I can't declare my linked
list in the main function and let it to be used by all the other
functions, like this:
int main(){
Linked List a;
......
function_A( a );
}//main
|
|
From: Betty W. <bet...@gm...> - 2004-09-24 03:26:03
|
Sorry, I did not finish my last message. Here it is again.
Dear all,
I am trying to add a linked list into Valgrind, more specifically
Cachegrind, to collect some data access information that is useful to
me.
What I want to do is to collect some data information while
running Valgrind and I want to keep these information into a linked
list.
From reading the documentation, I know that
Valgrind is compiled into a shared object, valgrind.so. This causes
the .so to be loaded as an extra library to any subsequently executed
dynamically-linked ELF binary.
The dynamic linker calls the initialization function of Valgrind. Then
the dynamic linker calls the main of the loaded program. When main
returns, the synthetic CPU calls the finalization function of
valgrind.so. During the execution of the finalization function,
summary of all errors detected are printed and memory leaks are
checked.
Basically, I want to add a linked list as a globle data structure, so
while the main function is exucted, useful data will be collected into
my linked list. And at the end, I will print all the data stored in
the linked list.
Because there is main fuction in Valgrind, I can't declare my linked
list in the main function and let it to be used by all the other
functions, like this:
int main(){
Linked List a;
......
function_A( a );
}//main
So I wonder what I can do in order to add a link list into Cachegrind
and use this linked list to collect some useful data.
Thanks!!!!
|
|
From: Nicholas N. <nj...@ca...> - 2004-10-08 14:25:58
|
On Thu, 23 Sep 2004, Betty Wang wrote: > I am trying to add a linked list into Valgrind, more specifically > Cachegrind, to collect some data access information that is useful to > me. > > What I want to do is to collect some data information while > running Valgrind and I want to keep these information into a linked > list. [snip] I'm not sure I understand exactly what you want, but perhaps you could use a global variable within Cachegrind (ie. within cg_main.c) to point to the start of the list. You can do any necessary initialisation within SK_(pre_clo_init)(). Then the list can be augmented and traversed upon interesting events, within cg_main.c. I hope that makes sense, and is helpful. N |