aboutsummaryrefslogtreecommitdiff
path: root/cachegrind
diff options
context:
space:
mode:
authorflorian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9>2014-10-26 17:12:12 +0000
committerflorian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9>2014-10-26 17:12:12 +0000
commit6c67c5065bddcb5d8388acb03e6e9686c025e1f1 (patch)
treeeb8077e0869d79d94a5f717dbd682d5715ae752c /cachegrind
parent46cc04521acf2827eb33310fadc119bf2dc039e4 (diff)
downloadvalgrind-6c67c5065bddcb5d8388acb03e6e9686c025e1f1.tar.gz
Merge r14288 from the BUF_REMOVAL branch to trunk.
What it does it changing cachegrind's get_debug_info function such that it no longer builds up an absolute pathname. Instead the function get an additional parameter for the directory name and the absolute pathname is built when it is needed. This will come in handy soonish when VG_(get_filename_lineno) will be changed and those buffers will disappear. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14665 a5019735-40e9-0310-863c-91ae7b9d1cf9
Diffstat (limited to 'cachegrind')
-rw-r--r--cachegrind/cg_main.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c
index 71efdea26..10e562e4c 100644
--- a/cachegrind/cg_main.c
+++ b/cachegrind/cg_main.c
@@ -211,10 +211,10 @@ static HChar* get_perm_string(const HChar* s)
/*--- CC table operations ---*/
/*------------------------------------------------------------*/
-static void get_debug_info(Addr instr_addr, HChar file[FILE_LEN],
+static void get_debug_info(Addr instr_addr, HChar dir[FILE_LEN],
+ HChar file[FILE_LEN],
const HChar **fn, UInt* line)
{
- HChar dir[FILE_LEN];
Bool found_dirname;
Bool found_file_line = VG_(get_filename_linenum)(
instr_addr,
@@ -232,14 +232,6 @@ static void get_debug_info(Addr instr_addr, HChar file[FILE_LEN],
*fn = "???";
}
- if (found_dirname) {
- // +1 for the '/'.
- tl_assert(VG_(strlen)(dir) + VG_(strlen)(file) + 1 < FILE_LEN);
- VG_(strcat)(dir, "/"); // Append '/'
- VG_(strcat)(dir, file); // Append file to dir
- VG_(strcpy)(file, dir); // Move dir+file to file
- }
-
if (found_file_line) {
if (found_fn) full_debugs++;
else file_line_debugs++;
@@ -253,15 +245,24 @@ static void get_debug_info(Addr instr_addr, HChar file[FILE_LEN],
// Returns a pointer to the line CC, creates a new one if necessary.
static LineCC* get_lineCC(Addr origAddr)
{
- HChar file[FILE_LEN];
+ HChar file[FILE_LEN], dir[FILE_LEN];
const HChar *fn;
UInt line;
CodeLoc loc;
LineCC* lineCC;
- get_debug_info(origAddr, file, &fn, &line);
+ get_debug_info(origAddr, dir, file, &fn, &line);
+
+ // Form an absolute pathname if a directory is available
+ HChar absfile[VG_(strlen)(dir) + 1 + VG_(strlen)(file) + 1];
+
+ if (dir[0]) {
+ VG_(sprintf)(absfile, "%s/%s", dir, file);
+ } else {
+ VG_(sprintf)(absfile, "%s", file);
+ }
- loc.file = file;
+ loc.file = absfile;
loc.fn = fn;
loc.line = line;