|
From: Ashley P. <as...@qu...> - 2007-02-08 13:57:23
|
Julians commit last night reminded me of this patch I've had lying
around for a while, it gives predictable names to core files when using
the prefix option.
Ashley,
Index: coregrind/m_coredump/coredump-elf.c
===================================================================
--- coregrind/m_coredump/coredump-elf.c (revision 6536)
+++ coregrind/m_coredump/coredump-elf.c (working copy)
@@ -288,6 +288,8 @@
Char buf[1000];
Char *basename = "vgcore";
Char *coreext = "";
+ Char *qual = NULL;
+ Char pidtxt[20];
Int seq = 0;
Int core_fd;
NSegment const * seg;
@@ -308,15 +310,20 @@
basename = VG_(clo_log_name);
}
+ if (VG_(clo_log_file_qualifier)) {
+ qual = VG_(getenv)(VG_(clo_log_file_qualifier));
+ } else
+ VG_(sprintf)(&pidtxt[0], "%d", VG_(getpid)());
+
for(;;) {
SysRes sres;
if (seq == 0)
- VG_(sprintf)(buf, "%s%s.%d",
- basename, coreext, VG_(getpid)());
+ VG_(sprintf)(buf, "%s%s.%s",
+ basename, coreext, qual ? qual : pidtxt);
else
- VG_(sprintf)(buf, "%s%s.%d.%d",
- basename, coreext, VG_(getpid)(), seq);
+ VG_(sprintf)(buf, "%s%s.%s.%d",
+ basename, coreext, qual ? qual : pidtxt , seq);
seq++;
sres = VG_(open)(buf,
|