On Thu, 2015-09-10 at 09:40 +0100, Mark Chimley wrote:
> Folks,
> 
> This is hopefully a question with an easy answer. I've got a program
> which seems to cause heap corruption so I thought valgrind would be able
> to tell me where this occurs. The trouble is the program uses data files
> from the running directory for configuration purposes and running the
> program under valgrind seems to prevent it finding these data files. I
> therefore cannot reproduce the conditions which cause the problem.
> 
> I've looked in the manual, help and FAQs for how to set the working
> directory but I cannot find anything related to this. I feel I must be
> missing something quite obvious as this would appear to be quite a
> fundamental issue.
> 
For sure, if valgrind would fiddle with the working directory,
then a lot of things would not work properly.
As an example, doing
   valgrind pwd
properly shows the current working directory where you launch valgrind.

So, something else must happen.

What you could do is to run your application with
   valgrind --trace-syscalls=yes ....
and see e.g. which open syscall is unexpectedly failing.

Alternatively, start your application with valgrind+vgdb,
and put breakpoints at the relevant places to see why the
required files are not being opened.
(see
http://www.valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.gdbserver
for more info about debugging your application running under valgrind).


Philippe




------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to