|
From: Rex W. <wa...@gm...> - 2005-04-20 19:39:04
|
Hi=20 This mail might sound stupid, but I have to ask the question.=20 =20 I was trying to build the source code for the tool dullard and I get many errors related to stage2.lds which is apparently missing. So I just wanted to know if I can build the dullard tool with valgrind-2.4 . I do not really know the differences between versions 2.1.2 and 2.4.0 of Valgrind but I dont wanna end up breaking my head over something which is obvious to the developers of Valgrind. So if I build dullard (dl_main.c) with valgrind 2.4.0 will it break something else ? Does dl_main.c access some features of Valgrind which existed in 2.1.2 and are deprecated in 2.4.0 ? Thanks.=20 Rex |
|
From: Nicholas N. <nj...@cs...> - 2005-04-20 19:54:33
|
On Wed, 20 Apr 2005, Rex Walburn wrote: > I was trying to build the source code for the tool dullard and I get > many errors related to stage2.lds which is apparently missing. So I > just wanted to know if I can build the dullard tool with valgrind-2.4 > . I do not really know the differences between versions 2.1.2 and > 2.4.0 of Valgrind but I dont wanna end up breaking my head over > something which is obvious to the developers of Valgrind. So if I > build dullard (dl_main.c) with valgrind 2.4.0 will it break something > else ? Does dl_main.c access some features of Valgrind which existed > in 2.1.2 and are deprecated in 2.4.0 ? I think the problem is just that the way the Makefiles are organised changed from 2.1.2 to 2.4.0. Copy the Makefile.in from the "none" directory, and change "SUBDIRS" to not include "docs" and "tests", and then replace "none" with "dullard" and "nl_" with "dl_" and it should work out ok. You'll need to rerun configure.in. (Or if you're working from the repository, make the corresponding changes to the Makefile.am file, which is a bit easier.) N |
|
From: Rex W. <wa...@gm...> - 2005-04-20 20:49:10
|
Thanks.=20 I was able to execute the tool dullard compiled with Valgrind-2.4.0 fine after I removed the calls to VG_(register_compact_helper) in dl_main.c. -- Rex. On 4/20/05, Nicholas Nethercote <nj...@cs...> wrote: > On Wed, 20 Apr 2005, Rex Walburn wrote: >=20 > > I was trying to build the source code for the tool dullard and I get > > many errors related to stage2.lds which is apparently missing. So I > > just wanted to know if I can build the dullard tool with valgrind-2.4 > > . I do not really know the differences between versions 2.1.2 and > > 2.4.0 of Valgrind but I dont wanna end up breaking my head over > > something which is obvious to the developers of Valgrind. So if I > > build dullard (dl_main.c) with valgrind 2.4.0 will it break something > > else ? Does dl_main.c access some features of Valgrind which existed > > in 2.1.2 and are deprecated in 2.4.0 ? >=20 > I think the problem is just that the way the Makefiles are organised > changed from 2.1.2 to 2.4.0. Copy the Makefile.in from the "none" > directory, and change "SUBDIRS" to not include "docs" and "tests", and > then replace "none" with "dullard" and "nl_" with "dl_" and it should wor= k > out ok. You'll need to rerun configure.in. >=20 > (Or if you're working from the repository, make the corresponding changes > to the Makefile.am file, which is a bit easier.) >=20 > N > |
|
From: Rex W. <wa...@gm...> - 2005-04-20 21:25:27
|
Hi So Dullard gives out addresses which have been read from, written to or modified . I want to map a particular address to its corresponding variable or symbol. Can I do that ? Could someone give me a hint as to how I would do that. I have read vg_symtab2.c and know that a symbol can be mapped to an address. But I think dullard works with UCode and UCode is independent of symbols. Am I right in thinking this ? I have been reading through the valgrind code for 2 days now and I have read the user manual as well. My main aim is to count how many times a particular variable is accessed (read from, written to, modified etc.). So I started with dullard, which seems to tell me partly what I want. I am looking for some guidance.=20 Thanks. Rex. |
|
From: Nicholas N. <nj...@cs...> - 2005-04-21 03:41:15
|
On Wed, 20 Apr 2005, Rex Walburn wrote: > So Dullard gives out addresses which have been read from, written to > or modified . I want to map a particular address to its corresponding > variable or symbol. Can I do that ? Could someone give me a hint as to > how I would do that. I have read vg_symtab2.c and know that a symbol > can be mapped to an address. But I think dullard works with UCode and > UCode is independent of symbols. Am I right in thinking this ? > I have been reading through the valgrind code for 2 days now and I > have read the user manual as well. My main aim is to count how many > times a particular variable is accessed (read from, written to, > modified etc.). So I started with dullard, which seems to tell me > partly what I want. > I am looking for some guidance. Valgrind's not really set up for mapping addresses to variables. The meaning of "variable" is tricky when you're looking at binary code -- a variable may be kept in memory, or the compiler could have put it into a register, or a combination of the two. Basically, variables are source-level entities. Valgrind's better at dealing with binary/machine-level entities, such as registers and memory locations. Would you be better off using source-level instrumentation? If you describe what you're doing in more detail, we might be able to give you more help. N |
|
From: Bryan O'S. <bo...@se...> - 2005-04-21 16:54:44
|
On Wed, 2005-04-20 at 22:41 -0500, Nicholas Nethercote wrote: > Valgrind's not really set up for mapping addresses to variables. The > meaning of "variable" is tricky when you're looking at binary code -- a > variable may be kept in memory, or the compiler could have put it into a > register, or a combination of the two. This kind of information is at least exposed, in principle, using DWARF location lists. Recent versions of gdb understand them, and recent versions of gcc emit them, so it's possible to reconstruct something like a "long long" properly, when part of it is in a register and part is in memory. I'm not suggesting that valgrind should care about this (though 'twould be nice), just noting that the information is there, at least when the stars are aligned appropriately. <b |
|
From: Rex W. <wa...@gm...> - 2005-04-21 13:01:00
|
Hi My aim is that I want to know which variables have been accessed and written to or modified and how many times in a particular area of the source code(or in the whole source code). The source code could be a collection of 200 files. One way to do that was to parse the source code and do a data flow analysis, but that would mean I would have to write a parser for C, C++, FORTRAN or any other language. The advantage of Valgrind is that it works with symbols and hence it does not matter which programming language the source code was written in. If I can map an address to atleast an entry in the symbol table, and check with "dullard" how many times the address was read from, written to and modified, then my problem is almost solved. What did you mean by source-level instrumentation ? Thanks Rex. On 4/20/05, Nicholas Nethercote <nj...@cs...> wrote: > Valgrind's not really set up for mapping addresses to variables. The > meaning of "variable" is tricky when you're looking at binary code -- a > variable may be kept in memory, or the compiler could have put it into a > register, or a combination of the two. >=20 > Basically, variables are source-level entities. Valgrind's better at > dealing with binary/machine-level entities, such as registers and memory > locations. Would you be better off using source-level instrumentation? >=20 > If you describe what you're doing in more detail, we might be able to > give you more help. >=20 > N > |
|
From: Nicholas N. <nj...@cs...> - 2005-04-21 13:25:02
|
On Thu, 21 Apr 2005, Rex Walburn wrote: > My aim is that I want to know which variables have been accessed and > written to or modified and how many times in a particular area of the > source code(or in the whole source code). The source code could be a > collection of 200 files. I'm curious why you want to know these statistics -- Is this a profiling exercise? This is trickier than it may first sound... what is the definition of a "variable"? What about compound structures like arrays and struct -- are they a single variable or do you consider the individual elements as variables? What about stack vs. static vs. heap-allocated variables? Etc. > One way to do that was to parse the source code and do a data flow > analysis, but that would mean I would have to write a parser for C, C++, > FORTRAN or any other language. The advantage of Valgrind is that it > works with symbols and hence it does not matter which programming > language the source code was written in. If I can map an address to > atleast an entry in the symbol table, and check with "dullard" how many > times the address was read from, written to and modified, then my > problem is almost solved. I see. AIUI the symbol table handles code addresses, eg. function names, but not variable names. Variable names are in the debugging information. VG_(describe_addr)() in vg_symtypes.c provides some functionality for converting code addresses to variable names. It's used by Helgrind. You need to call VG_(needs_data_syms)() before using it. It might do something like what you want, but I'm not certain. Local variables on the stack are going to be tricky to deal with, since you'll have to identify when you're entering/exiting functions, which is harder than it first seems. > What did you mean by source-level instrumentation ? A bit like the source code parsing/data flow analysis that you mentioned -- add instrumentation to the original source code, which would require parsing the source code, and some static analysis. Then you would run the program and get the stats. N |
|
From: Josef W. <Jos...@gm...> - 2005-04-21 15:52:37
|
On Thursday 21 April 2005 15:24, Nicholas Nethercote wrote: > On Thu, 21 Apr 2005, Rex Walburn wrote: > > My aim is that I want to know which variables have been accessed and > > written to or modified and how many times in a particular area of the > > ... > "variable"? What about compound structures like arrays and struct -- are > they a single variable or do you consider the individual elements as > variables? What about stack vs. static vs. heap-allocated variables? > Etc. One other problem is the amount of statistics data produced if there are many instances of data of same type. It probably makes sense to relate to data types. > I see. AIUI the symbol table handles code addresses, eg. function names, > but not variable names. Variable names are in the debugging information. Static data objects are also in the symbol table. See manual page of "nm" for symbol types. These are usually skipped in Valgrinds symbol reader, unless VG_(needs_data_syms)() is called. The type information of symbols will be found in the debug info. IMHO there should be a hook for tools to be able to collect data symbol information [This was the crappy patch I send some time ago ;-) ]. Calling VG_(describe_addr)() at every memory access is probably way to slow. Josef > Local variables on the stack are going to be tricky to deal with, since > you'll have to identify when you're entering/exiting functions, which is > harder than it first seems. > > > What did you mean by source-level instrumentation ? > > A bit like the source code parsing/data flow analysis that you mentioned > -- add instrumentation to the original source code, which would require > parsing the source code, and some static analysis. Then you would run the > program and get the stats. > > N > > > ------------------------------------------------------- > This SF.Net email is sponsored by: New Crystal Reports XI. > Version 11 adds new functionality designed to reduce time involved in > creating, integrating, and deploying reporting solutions. Free runtime > info, new features, or free trial, at: > http://www.businessobjects.com/devxi/728 > _______________________________________________ > Valgrind-developers mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-developers |
|
From: Rex W. <wa...@gm...> - 2005-04-21 13:51:57
|
On 4/21/05, Nicholas Nethercote <nj...@cs...> wrote: > I'm curious why you want to know these statistics -- Is this a profiling > exercise? Yes, I m given projects to understand legacy source code, and parallel process the slow portions if possible. This requires data to be serialized into bytes to be sent across a network. It takes a real long time to understand someone else's code if the code-base is huge. So I decided to automate it and one thing i needed was to understand data flow analysis, which data piece gets modified and used in a particular region of the code. The parsing source first and data flow analysis next is like building a compiler which is a daunting task. hence I thot that since Valgrind uses memory locations, I might be able to do something with that. >=20 > This is trickier than it may first sound... what is the definition of a > "variable"? What about compound structures like arrays and struct -- are > they a single variable or do you consider the individual elements as > variables? What about stack vs. static vs. heap-allocated variables? > Etc. Compound structures like Array and Struct I would consider as one variable itself, although they do span a larger address set. This question you have asked has got me thinking about my strategy. > I see. AIUI the symbol table handles code addresses, eg. function names, > but not variable names. Variable names are in the debugging information. > VG_(describe_addr)() in vg_symtypes.c provides some functionality for > converting code addresses to variable names. It's used by Helgrind. You > need to call VG_(needs_data_syms)() before using it. It might do > something like what you want, but I'm not certain. >=20 I will try this out.=20 > Local variables on the stack are going to be tricky to deal with, since > you'll have to identify when you're entering/exiting functions, which is > harder than it first seems. Yes they will be tricky, but that will be the next step. Let me try mapping an address to a symbol or variable first and see if it works. What does Redux actually do ? I tried using it but it seg-faulted and I did not try debugging it. Thanks. Rex. |
|
From: Nicholas N. <nj...@cs...> - 2005-04-21 22:14:36
|
On Thu, 21 Apr 2005, Rex Walburn wrote: > Yes, I m given projects to understand legacy source code, and parallel > process the slow portions if possible. Urk. Good luck. > What does Redux actually do ? Look at http://www.valgrind.org/docs/redux2003.ps.bz2 and/or chapter 5 of http://www.valgrind.org/docs/phd2004.pdf for a description. > I tried using it but it seg-faulted and I did not try debugging it. I've heard that some of the seg faults can be worked around by statically linking programs. That might not be an option for you, though. Redux is not at all robust or reliable. N |