Nick, Thanks for the prompt response. I would very much like your input on one of the other question in my original mail (reproduced below) -- I am looking for *any* strategies to solve the problem at hand using valgrind: "#6. i noticed one of the caveats was the limited number of options available for calling the original function. is there a way around it (since the system i have to test doesnt naturally fall in that restriction)? what i want to do is to use the wrapper function under certain circumstances (controlled by user e.g. to inject faults i.e. failure/fault injection testing) and use the original function otherwise. with that in view i was planning to call the original function from the wrapper function (e.g. in the previous example, when failure injection testing for this function was not being done) and was getting cramped by this caveat. what suggestions do you have for getting around this problem?"
Regarding C++, if I understand correctly, if I understand the quirks of the compiler regarding how the source code maps to object code for various cases, I am covered -- am I oversimpifying it? In other words since valgrind operates on assembly instructions, it shouldn't really matter what the original programming language was, right? I am asking this since your statement: >>Function wrapping is pretty low-level and just designed for C, for Valgrind's own >>purposes. Using it for C++ will definitely stretch it, possibly to breaking point concerned me since building a test framework based on an potentially unstable framework is risky. So can you pls elaborate on potential breaking points with C++? Look forward to your response Thanx -Venky > -----Original Message----- > From: Nicholas Nethercote [mailto:[email protected]] > Sent: Monday, June 22, 2009 11:53 PM > To: Venky Venkatesh (venky) > Cc: [email protected] > Subject: Re: [Valgrind-users] C++ function wrapping and other > questions > > On Tue, Jun 23, 2009 at 12:57 PM, Venky<[email protected]> wrote: > > i am new to valgrind and was planning to use valgrind function > > wrapping for testing my system (particularly to hit the > error and rare > > cases in the system which are hard to occur). here are a > couple of questions: > > #1. all examples i saw in the documentation are with C functions. > > There is a mention of C++ doing wrapping based on wildcard > matches in > > soname and function name. if i understand this correctly, i cannot > > specify the wrapper using class::member syntax -- it should be > > flattened names, correct? is there any experience/examples of this? > > I think you'll need to use the mangled name. > > I don't really know the answers to your other questions. The > manual has reasonable detail on wrapping but I guess you've read that. > Generally, for the complex cases you mentioned (eg. default > args) you probably need to understand how they get converted > to normal functions at the machine code level. (Eg. mangling > is how class::member names get converted to flat names; > references must be converted into pointers, etc). > > Function wrapping is pretty low-level and just designed for > C, for Valgrind's own purposes. Using it for C++ will > definitely stretch it, possibly to breaking point. > > > #7. is there any inbuilt/efficient valgrind mechanism to > know the call > > stack at a given location? if so where can i get more > information on that? > > From within Valgrind or outside Valgrind? > - Inside: VG_(get_StackTrace)() and VG_(pp_StackTrace)() -- > see include/pub_tool_stacktrace.h. > - Outside: VALGRIND_PRINTF_BACKTRACE (in valgrind.h) prints > the stack trace > > Nick > ------------------------------------------------------------------------------ _______________________________________________ Valgrind-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/valgrind-users
