I am working on porting an open source perl program to windows and I think I have only one hurdle left to get over.
The tool calls gcov to do some analysis and produce and output file that it brings in. From the command line I can invoke gcov like:
gcov c:/path/to/file.gcda -o relative/path/to/source -b
gcov then produces a .gcov file ./file.cpp.gcov
using the following code:
$gcov_error = system_no_output(1, $gcov_tool, $da_filename, "-o",
$object_dir, "-b");
sub system_no_output($@)
{
my $mode = shift;
my $result;
local *OLD_STDERR;
local *OLD_STDOUT;
# Save old stdout and stderr handles
($mode & 1) && open(OLD_STDOUT, ">>&STDOUT");
($mode & 2) && open(OLD_STDERR, ">>&STDERR");
# Redirect to /dev/null
($mode & 1) && open(STDOUT, ">/dev/null");
($mode & 2) && open(STDERR, ">/dev/null");
system(@_);
$result = $?;
# Close redirected handles
($mode & 1) && close(STDOUT);
($mode & 2) && close(STDERR);
# Restore old handles
($mode & 1) && open(STDOUT, ">>&OLD_STDOUT");
($mode & 2) && open(STDERR, ">>&OLD_STDERR");
return $result;
}
gcov all of a sudden end up creating a file called
./relative#path#to#source#file.cpp.gcov
What is the difference between running this on the command line and calling system? I know that perl will try and parse it through the command line if there is only 1 parameter.. however there is always more. at first I thought it was a gcov bug but I can run it manually.
update: I found the issue. There was a branch in the code that I was unaware I was taking. Apparently the '--preserve-paths' option in my windows build of was causing the file name mangling.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.