mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 10:05:29 +00:00
Fix Bug #344314 callgrind_annotate ... commands containing newlines
Escape newlines in command arguments for "cmd:" header field in dumps We could do unescaping in callgrind_annotate, but a escaped command even seems better there. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14947
This commit is contained in:
parent
199646a9cd
commit
9b43616636
1
NEWS
1
NEWS
@ -101,6 +101,7 @@ where XXXXXX is the bug number as listed below.
|
||||
344279 syscall sendmmsg on arm64 (269) and ppc32/64 (349) unhandled
|
||||
344295 syscall recvmmsg on arm64 (243) and ppc32/64 (343) unhandled
|
||||
344307 2 unhandled syscalls on aarch64/arm64: umount2(39), mount (40)
|
||||
344314 callgrind_annotate ... warnings about commands containing newlines
|
||||
n-i-bz Provide implementations of certain compiler builtins to support
|
||||
compilers who may not provide those
|
||||
n-i-bz Old STABS code is still being compiled, but never used. Remove it.
|
||||
|
||||
@ -1508,7 +1508,15 @@ void init_cmdbuf(void)
|
||||
for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
|
||||
const HChar *arg = *(HChar**)VG_(indexXA)( VG_(args_for_client), i );
|
||||
size += 1; // separator ' '
|
||||
size += VG_(strlen)(arg);
|
||||
// escape NL in arguments to not break dump format
|
||||
for(j=0; arg[j]; j++)
|
||||
switch(arg[j]) {
|
||||
case '\n':
|
||||
case '\\':
|
||||
size++; // fall through
|
||||
default:
|
||||
size++;
|
||||
}
|
||||
}
|
||||
|
||||
cmdbuf = CLG_MALLOC("cl.dump.ic.1", size + 1); // +1 for '\0'
|
||||
@ -1520,7 +1528,19 @@ void init_cmdbuf(void)
|
||||
const HChar *arg = * (HChar**) VG_(indexXA)( VG_(args_for_client), i );
|
||||
cmdbuf[size++] = ' ';
|
||||
for(j=0; arg[j]; j++)
|
||||
cmdbuf[size++] = arg[j];
|
||||
switch(arg[j]) {
|
||||
case '\n':
|
||||
cmdbuf[size++] = '\\';
|
||||
cmdbuf[size++] = 'n';
|
||||
break;
|
||||
case '\\':
|
||||
cmdbuf[size++] = '\\';
|
||||
cmdbuf[size++] = '\\';
|
||||
break;
|
||||
default:
|
||||
cmdbuf[size++] = arg[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
cmdbuf[size] = '\0';
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user