You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(122) |
Nov
(152) |
Dec
(69) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(6) |
Feb
(25) |
Mar
(73) |
Apr
(82) |
May
(24) |
Jun
(25) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(54) |
Nov
(203) |
Dec
(182) |
| 2004 |
Jan
(307) |
Feb
(305) |
Mar
(430) |
Apr
(312) |
May
(187) |
Jun
(342) |
Jul
(487) |
Aug
(637) |
Sep
(336) |
Oct
(373) |
Nov
(441) |
Dec
(210) |
| 2005 |
Jan
(385) |
Feb
(480) |
Mar
(636) |
Apr
(544) |
May
(679) |
Jun
(625) |
Jul
(810) |
Aug
(838) |
Sep
(634) |
Oct
(521) |
Nov
(965) |
Dec
(543) |
| 2006 |
Jan
(494) |
Feb
(431) |
Mar
(546) |
Apr
(411) |
May
(406) |
Jun
(322) |
Jul
(256) |
Aug
(401) |
Sep
(345) |
Oct
(542) |
Nov
(308) |
Dec
(481) |
| 2007 |
Jan
(427) |
Feb
(326) |
Mar
(367) |
Apr
(255) |
May
(244) |
Jun
(204) |
Jul
(223) |
Aug
(231) |
Sep
(354) |
Oct
(374) |
Nov
(497) |
Dec
(362) |
| 2008 |
Jan
(322) |
Feb
(482) |
Mar
(658) |
Apr
(422) |
May
(476) |
Jun
(396) |
Jul
(455) |
Aug
(267) |
Sep
(280) |
Oct
(253) |
Nov
(232) |
Dec
(304) |
| 2009 |
Jan
(486) |
Feb
(470) |
Mar
(458) |
Apr
(423) |
May
(696) |
Jun
(461) |
Jul
(551) |
Aug
(575) |
Sep
(134) |
Oct
(110) |
Nov
(157) |
Dec
(102) |
| 2010 |
Jan
(226) |
Feb
(86) |
Mar
(147) |
Apr
(117) |
May
(107) |
Jun
(203) |
Jul
(193) |
Aug
(238) |
Sep
(300) |
Oct
(246) |
Nov
(23) |
Dec
(75) |
| 2011 |
Jan
(133) |
Feb
(195) |
Mar
(315) |
Apr
(200) |
May
(267) |
Jun
(293) |
Jul
(353) |
Aug
(237) |
Sep
(278) |
Oct
(611) |
Nov
(274) |
Dec
(260) |
| 2012 |
Jan
(303) |
Feb
(391) |
Mar
(417) |
Apr
(441) |
May
(488) |
Jun
(655) |
Jul
(590) |
Aug
(610) |
Sep
(526) |
Oct
(478) |
Nov
(359) |
Dec
(372) |
| 2013 |
Jan
(467) |
Feb
(226) |
Mar
(391) |
Apr
(281) |
May
(299) |
Jun
(252) |
Jul
(311) |
Aug
(352) |
Sep
(481) |
Oct
(571) |
Nov
(222) |
Dec
(231) |
| 2014 |
Jan
(185) |
Feb
(329) |
Mar
(245) |
Apr
(238) |
May
(281) |
Jun
(399) |
Jul
(382) |
Aug
(500) |
Sep
(579) |
Oct
(435) |
Nov
(487) |
Dec
(256) |
| 2015 |
Jan
(338) |
Feb
(357) |
Mar
(330) |
Apr
(294) |
May
(191) |
Jun
(108) |
Jul
(142) |
Aug
(261) |
Sep
(190) |
Oct
(54) |
Nov
(83) |
Dec
(22) |
| 2016 |
Jan
(49) |
Feb
(89) |
Mar
(33) |
Apr
(50) |
May
(27) |
Jun
(34) |
Jul
(53) |
Aug
(53) |
Sep
(98) |
Oct
(206) |
Nov
(93) |
Dec
(53) |
| 2017 |
Jan
(65) |
Feb
(82) |
Mar
(102) |
Apr
(86) |
May
(187) |
Jun
(67) |
Jul
(23) |
Aug
(93) |
Sep
(65) |
Oct
(45) |
Nov
(35) |
Dec
(17) |
| 2018 |
Jan
(26) |
Feb
(35) |
Mar
(38) |
Apr
(32) |
May
(8) |
Jun
(43) |
Jul
(27) |
Aug
(30) |
Sep
(43) |
Oct
(42) |
Nov
(38) |
Dec
(67) |
| 2019 |
Jan
(32) |
Feb
(37) |
Mar
(53) |
Apr
(64) |
May
(49) |
Jun
(18) |
Jul
(14) |
Aug
(53) |
Sep
(25) |
Oct
(30) |
Nov
(49) |
Dec
(31) |
| 2020 |
Jan
(87) |
Feb
(45) |
Mar
(37) |
Apr
(51) |
May
(99) |
Jun
(36) |
Jul
(11) |
Aug
(14) |
Sep
(20) |
Oct
(24) |
Nov
(40) |
Dec
(23) |
| 2021 |
Jan
(14) |
Feb
(53) |
Mar
(85) |
Apr
(15) |
May
(19) |
Jun
(3) |
Jul
(14) |
Aug
(1) |
Sep
(57) |
Oct
(73) |
Nov
(56) |
Dec
(22) |
| 2022 |
Jan
(3) |
Feb
(22) |
Mar
(6) |
Apr
(55) |
May
(46) |
Jun
(39) |
Jul
(15) |
Aug
(9) |
Sep
(11) |
Oct
(34) |
Nov
(20) |
Dec
(36) |
| 2023 |
Jan
(79) |
Feb
(41) |
Mar
(99) |
Apr
(169) |
May
(48) |
Jun
(16) |
Jul
(16) |
Aug
(57) |
Sep
(19) |
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
1
(14) |
|
2
(5) |
3
(15) |
4
(20) |
5
(2) |
6
(4) |
7
(16) |
8
(13) |
|
9
(3) |
10
(19) |
11
(13) |
12
(10) |
13
(16) |
14
|
15
|
|
16
|
17
(5) |
18
(14) |
19
(1) |
20
(12) |
21
(1) |
22
|
|
23
(1) |
24
(1) |
25
(1) |
26
(13) |
27
(2) |
28
(19) |
29
(15) |
|
30
(17) |
|
|
|
|
|
|
|
From: <sv...@va...> - 2013-06-27 20:31:47
|
sewardj 2013-06-27 21:31:36 +0100 (Thu, 27 Jun 2013)
New Revision: 13432
Log:
Exit a bit more gracefully if a request to get part of an image
exceeds the allowable range. With this change, it should be
essentially impossible to crash V by feeding it invalid ELF or Dwarf.
Modified files:
branches/DISRV/coregrind/m_debuginfo/image.c
branches/DISRV/coregrind/m_debuginfo/readelf.c
Modified: branches/DISRV/coregrind/m_debuginfo/image.c (+60 -16)
===================================================================
--- branches/DISRV/coregrind/m_debuginfo/image.c 2013-06-27 18:39:15 +01:00 (rev 13431)
+++ branches/DISRV/coregrind/m_debuginfo/image.c 2013-06-27 21:31:36 +01:00 (rev 13432)
@@ -67,6 +67,9 @@
Bool is_local;
// The fd for the local file, or sd for a remote server.
Int fd;
+ // The name. In ML_(dinfo_zalloc)'d space. Used only for printing
+ // error messages; hence it doesn't really matter what this contains.
+ HChar* name;
// The rest of these fields are only valid when using remote files
// (that is, using a debuginfo server; hence when is_local==False)
// Session ID allocated to us by the server. Cannot be zero.
@@ -181,17 +184,30 @@
/* If we lost communication with the remote server, just give up.
Recovering is too difficult. */
-static void give_up(void)
+static void give_up__comms_lost(void)
{
VG_(umsg)("\n");
- VG_(umsg)("Valgrind: Lost communication with the remote "
- "debuginfo server.\n");
- VG_(umsg)("Valgrind: I can't recover from that. Giving up. Sorry.\n");
+ VG_(umsg)(
+ "Valgrind: debuginfo reader: Lost communication with the remote\n");
+ VG_(umsg)(
+ "Valgrind: debuginfo server. I can't recover. Giving up. Sorry.\n");
VG_(umsg)("\n");
VG_(exit)(1);
/*NOTREACHED*/
}
+static void give_up__image_overrun(void)
+{
+ VG_(umsg)("\n");
+ VG_(umsg)(
+ "Valgrind: debuginfo reader: Possibly corrupted debuginfo file.\n");
+ VG_(umsg)(
+ "Valgrind: I can't recover. Giving up. Sorry.\n");
+ VG_(umsg)("\n");
+ VG_(exit)(1);
+ /*NOTREACHED*/
+}
+
/* "Do" a transaction: that is, send the given frame to the server and
return the frame it sends back. Caller owns the resulting frame
and must free it. A NULL return means the transaction failed for
@@ -502,7 +518,7 @@
VG_(umsg)("set_CEnt (reading data from DI server): fail: "
"server unexpectedly closed the connection\n");
}
- give_up();
+ give_up__comms_lost();
/* NOTREACHED */
vg_assert(0);
end_of_else_clause:
@@ -599,6 +615,7 @@
img->source.fd = sr_Res(fd);
img->size = size;
img->ces_used = 0;
+ img->source.name = ML_(dinfo_strdup)("di.image.ML_iflf.2", fullpath);
/* img->ces is already zeroed out */
vg_assert(img->source.fd >= 0);
@@ -684,6 +701,11 @@
img->source.session_id = session_id;
img->size = size;
img->ces_used = 0;
+ img->source.name = ML_(dinfo_zalloc)("di.image.ML_ifds.2",
+ 20 + VG_(strlen)(filename)
+ + VG_(strlen)(serverAddr));
+ VG_(sprintf)(img->source.name, "%s at %s", filename, serverAddr);
+
/* img->ces is already zeroed out */
vg_assert(img->source.fd >= 0);
@@ -740,6 +762,7 @@
for (i = i; i < img->ces_used; i++) {
vg_assert(img->ces[i] == NULL);
}
+ ML_(dinfo_free)(img->source.name);
ML_(dinfo_free)(img);
}
@@ -749,19 +772,40 @@
return img->size;
}
-Bool ML_(img_valid)(DiImage* img, DiOffT offset, SizeT size)
+inline Bool ML_(img_valid)(DiImage* img, DiOffT offset, SizeT size)
{
vg_assert(img);
vg_assert(offset != DiOffT_INVALID);
return img->size > 0 && offset + size <= (DiOffT)img->size;
}
+/* Check the given range is valid, and if not, shut down the system.
+ An invalid range would imply that we're trying to read outside the
+ image, which normally means the image is corrupted somehow, or the
+ caller is buggy. Recovering is too complex, and we have
+ probably-corrupt debuginfo, so just give up. */
+static void ensure_valid(DiImage* img, DiOffT offset, SizeT size,
+ const HChar* caller)
+{
+ if (LIKELY(ML_(img_valid)(img, offset, size)))
+ return;
+ VG_(umsg)("Valgrind: debuginfo reader: ensure_valid failed:\n");
+ VG_(umsg)("Valgrind: during call to %s\n", caller);
+ VG_(umsg)("Valgrind: request for range [%llu, +%llu) exceeds\n",
+ (ULong)offset, (ULong)size);
+ VG_(umsg)("Valgrind: valid image size of %llu for image:\n",
+ (ULong)img->size);
+ VG_(umsg)("Valgrind: \"%s\"\n", img->source.name);
+ give_up__image_overrun();
+}
+
+
void ML_(img_get)(/*OUT*/void* dst,
DiImage* img, DiOffT offset, SizeT size)
{
vg_assert(img);
vg_assert(size > 0);
- vg_assert(ML_(img_valid)(img, offset, size));
+ ensure_valid(img, offset, size, "ML_(img_get)");
SizeT i;
for (i = 0; i < size; i++) {
((UChar*)dst)[i] = get(img, offset + i);
@@ -773,7 +817,7 @@
{
vg_assert(img);
vg_assert(size > 0);
- vg_assert(ML_(img_valid)(img, offset, size));
+ ensure_valid(img, offset, size, "ML_(img_get_some)");
UChar* dstU = (UChar*)dst;
/* Use |get| in the normal way to get the first byte of the range.
This guarantees to put the cache entry containing |offset| in
@@ -795,7 +839,7 @@
SizeT ML_(img_strlen)(DiImage* img, DiOffT off)
{
- vg_assert(ML_(img_valid)(img, off, 1));
+ ensure_valid(img, off, 1, "ML_(img_strlen)");
SizeT i = 0;
while (get(img, off + i) != 0) i++;
return i;
@@ -803,7 +847,7 @@
HChar* ML_(img_strdup)(DiImage* img, const HChar* cc, DiOffT offset)
{
- vg_assert(ML_(img_valid)(img, offset, 1));
+ ensure_valid(img, offset, 1, "ML_(img_strdup)");
SizeT len = ML_(img_strlen)(img, offset);
HChar* res = ML_(dinfo_zalloc)(cc, len+1);
SizeT i;
@@ -816,8 +860,8 @@
Int ML_(img_strcmp)(DiImage* img, DiOffT off1, DiOffT off2)
{
- vg_assert(ML_(img_valid)(img, off1, 1));
- vg_assert(ML_(img_valid)(img, off2, 1));
+ ensure_valid(img, off1, 1, "ML_(img_strcmp)(first arg)");
+ ensure_valid(img, off2, 1, "ML_(img_strcmp)(second arg)");
while (True) {
UChar c1 = get(img, off1);
UChar c2 = get(img, off2);
@@ -830,7 +874,7 @@
Int ML_(img_strcmp_c)(DiImage* img, DiOffT off1, const HChar* str2)
{
- vg_assert(ML_(img_valid)(img, off1, 1));
+ ensure_valid(img, off1, 1, "ML_(img_strcmp_c)");
while (True) {
UChar c1 = get(img, off1);
UChar c2 = *(UChar*)str2;
@@ -843,7 +887,7 @@
UChar ML_(img_get_UChar)(DiImage* img, DiOffT offset)
{
- vg_assert(ML_(img_valid)(img, offset, 1));
+ ensure_valid(img, offset, 1, "ML_(img_get_UChar)");
return get(img, offset);
}
@@ -931,7 +975,7 @@
0x2d02ef8d
};
- vg_assert(img);
+ vg_assert(img);
/* If the image is local, calculate the CRC here directly. If it's
remote, forward the request to the server. */
@@ -985,7 +1029,7 @@
if (req) free_Frame(req);
if (res) free_Frame(res);
// FIXME: now what?
- give_up();
+ give_up__comms_lost();
/* NOTREACHED */
vg_assert(0);
}
Modified: branches/DISRV/coregrind/m_debuginfo/readelf.c (+4 -1)
===================================================================
--- branches/DISRV/coregrind/m_debuginfo/readelf.c 2013-06-27 18:39:15 +01:00 (rev 13431)
+++ branches/DISRV/coregrind/m_debuginfo/readelf.c 2013-06-27 21:31:36 +01:00 (rev 13432)
@@ -1662,7 +1662,10 @@
);
if (ok2 && strtab_mioff == DiOffT_INVALID) {
// Check for obviously bogus offsets.
- vg_assert(ML_(img_valid)(mimg, offset, 1));
+ if (!ML_(img_valid)(mimg, offset, 1)) {
+ ML_(symerr)(di, True, "Invalid DT_STRTAB offset");
+ goto out;
+ }
strtab_mioff = ehdr_mioff + offset;
vg_assert(ehdr_mioff == 0); // should always be
}
|
|
From: <sv...@va...> - 2013-06-27 17:39:30
|
sewardj 2013-06-27 18:39:15 +0100 (Thu, 27 Jun 2013)
New Revision: 13431
Log:
Minimal changes needed to make this suitable for trunk:
* add a new flag --allow-mismatched-debuginfo to override the
CRC32/build-id checks, if needed
* tidy up logic for finding files on the --extra-debuginfo-path
and at the --debuginfo-server
* don't assert if connection to the debuginfo server is lost;
instead print a reasonable message and quit.
Modified files:
branches/DISRV/auxprogs/valgrind-di-server.c
branches/DISRV/coregrind/m_debuginfo/image.c
branches/DISRV/coregrind/m_debuginfo/readelf.c
branches/DISRV/coregrind/m_main.c
branches/DISRV/coregrind/m_options.c
branches/DISRV/coregrind/pub_core_options.h
Modified: branches/DISRV/coregrind/m_main.c (+6 -0)
===================================================================
--- branches/DISRV/coregrind/m_main.c 2013-06-25 13:42:52 +01:00 (rev 13430)
+++ branches/DISRV/coregrind/m_main.c 2013-06-27 18:39:15 +01:00 (rev 13431)
@@ -178,6 +178,9 @@
" well known search paths.\n"
" --debuginfo-server=ipaddr:port also query this server\n"
" (valgrind-di-server) for debug symbols\n"
+" --allow-mismatched-debuginfo=no|yes [no]\n"
+" for the above two flags only, accept debuginfo\n"
+" objects that don't \"match\" the main object\n"
" --smc-check=none|stack|all|all-non-file [stack]\n"
" checks for self-modifying code: none, only for\n"
" code found in stacks, for all code, or for all\n"
@@ -681,6 +684,9 @@
else if VG_STR_CLO(arg, "--debuginfo-server",
VG_(clo_debuginfo_server)) {}
+ else if VG_BOOL_CLO(arg, "--allow-mismatched-debuginfo",
+ VG_(clo_allow_mismatched_debuginfo)) {}
+
else if VG_STR_CLO(arg, "--xml-user-comment",
VG_(clo_xml_user_comment)) {}
Modified: branches/DISRV/auxprogs/valgrind-di-server.c (+15 -0)
===================================================================
--- branches/DISRV/auxprogs/valgrind-di-server.c 2013-06-25 13:42:52 +01:00 (rev 13430)
+++ branches/DISRV/auxprogs/valgrind-di-server.c 2013-06-27 18:39:15 +01:00 (rev 13431)
@@ -4,6 +4,15 @@
/*--- valgrind-di-server.c ---*/
/*--------------------------------------------------------------------*/
+/* To build for an x86_64-linux host:
+ gcc -g -Wall -O -o valgrind-di-server \
+ auxprogs/valgrind-di-server.c -Icoregrind -Iinclude \
+ -IVEX/pub -DVGO_linux -DVGA_amd64
+
+ To build for an x86 (32-bit) host
+ The same, except change -DVGA_amd64 to -DVGA_x86
+*/
+
/*
This file is part of Valgrind, a dynamic binary instrumentation
framework.
@@ -33,6 +42,9 @@
/* This code works (just), but it's a mess. Cleanups (also for
coregrind/m_debuginfo/image.c):
+ * Build this file for the host arch, not the target. But how?
+ Even Tromey had difficulty figuring out how to do that.
+
* Change the use of pread w/ fd to FILE*, for the file we're
serving. Or, at least, put a loop around the pread uses
so that it works correctly in the case where pread reads more
@@ -627,6 +639,9 @@
*ok = False;
return 0;
}
+ /* this is a kludge .. we should loop around pread and deal
+ with short reads, for whatever reason */
+ assert(nRead == avail);
UInt i;
for (i = 0; i < (UInt)nRead; i++)
crc = crc32_table[(crc ^ buf[i]) & 0xff] ^ (crc >> 8);
Modified: branches/DISRV/coregrind/pub_core_options.h (+7 -0)
===================================================================
--- branches/DISRV/coregrind/pub_core_options.h 2013-06-25 13:42:52 +01:00 (rev 13430)
+++ branches/DISRV/coregrind/pub_core_options.h 2013-06-27 18:39:15 +01:00 (rev 13431)
@@ -134,6 +134,13 @@
"d.d.d.d:d", where d is one or more digits. */
extern const HChar* VG_(clo_debuginfo_server);
+/* Do we allow reading debuginfo from debuginfo objects that don't
+ match (in some sense) the main object? This is dangerous, so the
+ default is NO (False). In any case it applies only to objects
+ found either in _extra_debuginfo_path or via the
+ _debuginfo_server. */
+extern Bool VG_(clo_allow_mismatched_debuginfo);
+
/* DEBUG: print generated code? default: 00000000 ( == NO ) */
extern UChar VG_(clo_trace_flags);
Modified: branches/DISRV/coregrind/m_debuginfo/readelf.c (+110 -16)
===================================================================
--- branches/DISRV/coregrind/m_debuginfo/readelf.c 2013-06-25 13:42:52 +01:00 (rev 13430)
+++ branches/DISRV/coregrind/m_debuginfo/readelf.c 2013-06-27 18:39:15 +01:00 (rev 13431)
@@ -1131,7 +1131,12 @@
/* Try to find a separate debug file for a given object file. If
- found, return its DiImage, which should be freed by the caller. */
+ found, return its DiImage, which should be freed by the caller. If
+ |buildid| is non-NULL, then a debug object matching it is
+ acceptable. If |buildid| is NULL or doesn't specify a findable
+ debug object, then we look in various places to find a file with
+ the specified CRC. And if that doesn't work out then we give
+ up. */
static
DiImage* find_debug_file( struct _DebugInfo* di,
const HChar* objpath, const HChar* buildid,
@@ -1166,11 +1171,11 @@
debugpath = ML_(dinfo_zalloc)(
"di.fdf.3",
- VG_(strlen)(objdir) + VG_(strlen)(debugname) + 32 +
- (extrapath ? VG_(strlen)(extrapath) : 0));
+ VG_(strlen)(objdir) + VG_(strlen)(debugname) + 64
+ + (extrapath ? VG_(strlen)(extrapath) : 0)
+ + (serverpath ? VG_(strlen)(serverpath) : 0));
VG_(sprintf)(debugpath, "%s/%s", objdir, debugname);
-
dimg = open_debug_file(debugpath, NULL, crc, rel_ok, NULL);
if (dimg != NULL) goto dimg_ok;
@@ -1184,13 +1189,20 @@
if (extrapath) {
VG_(sprintf)(debugpath, "%s%s/%s", extrapath,
- objdir, debugname);
+ objdir, debugname);
dimg = open_debug_file(debugpath, NULL, crc, rel_ok, NULL);
if (dimg != NULL) goto dimg_ok;
}
if (serverpath) {
- dimg = open_debug_file(debugname, NULL, crc, rel_ok, serverpath);
+ /* When looking on the debuginfo server, always just pass the
+ basename. */
+ const HChar* basename = debugname;
+ if (VG_(strstr)(basename, "/") != NULL) {
+ basename = VG_(strrchr)(basename, '/') + 1;
+ }
+ VG_(sprintf)(debugpath, "%s on %s", basename, serverpath);
+ dimg = open_debug_file(basename, NULL, crc, rel_ok, serverpath);
if (dimg) goto dimg_ok;
}
@@ -1212,6 +1224,77 @@
}
+/* Try to find a separate debug file for a given object file, in a
+ hacky and dangerous way: check only the --extra-debuginfo-path and
+ the --debuginfo-server. And don't do a consistency check. */
+static
+DiImage* find_debug_file_ad_hoc( struct _DebugInfo* di,
+ const HChar* objpath )
+{
+ const HChar* extrapath = VG_(clo_extra_debuginfo_path);
+ const HChar* serverpath = VG_(clo_debuginfo_server);
+
+ DiImage* dimg = NULL; /* the img that we found */
+ HChar* debugpath = NULL; /* where we found it */
+
+ HChar *objdir = ML_(dinfo_strdup)("di.fdfah.1", objpath);
+ HChar *objdirptr;
+
+ if ((objdirptr = VG_(strrchr)(objdir, '/')) != NULL)
+ *objdirptr = '\0';
+
+ debugpath = ML_(dinfo_zalloc)(
+ "di.fdfah.3",
+ VG_(strlen)(objdir) + 64
+ + (extrapath ? VG_(strlen)(extrapath) : 0)
+ + (serverpath ? VG_(strlen)(serverpath) : 0));
+
+ if (extrapath) {
+ VG_(sprintf)(debugpath, "%s/%s", extrapath, objpath);
+ dimg = ML_(img_from_local_file)(debugpath);
+ if (dimg != NULL) {
+ if (VG_(clo_verbosity) > 1) {
+ VG_(message)(Vg_DebugMsg, " Using (POSSIBLY MISMATCHED) %s\n",
+ debugpath);
+ }
+ goto dimg_ok;
+ }
+ }
+ if (serverpath) {
+ /* When looking on the debuginfo server, always just pass the
+ basename. */
+ const HChar* basename = objpath;
+ if (VG_(strstr)(basename, "/") != NULL) {
+ basename = VG_(strrchr)(basename, '/') + 1;
+ }
+ VG_(sprintf)(debugpath, "%s on %s", basename, serverpath);
+ dimg = ML_(img_from_di_server)(basename, serverpath);
+ if (dimg != NULL) {
+ if (VG_(clo_verbosity) > 1) {
+ VG_(message)(Vg_DebugMsg, " Using (POSSIBLY MISMATCHED) %s\n",
+ debugpath);
+ }
+ goto dimg_ok;
+ }
+ }
+
+ dimg_ok:
+
+ ML_(dinfo_free)(objdir);
+
+ if (dimg != NULL) {
+ vg_assert(debugpath);
+ TRACE_SYMTAB("\n");
+ TRACE_SYMTAB("------ Found an ad_hoc debuginfo file: %s\n", debugpath);
+ }
+
+ if (debugpath)
+ ML_(dinfo_free)(debugpath);
+
+ return dimg;
+}
+
+
static DiOffT INDEX_BIS ( DiOffT base, UWord idx, UWord scale ) {
// This is a bit stupid. Really, idx and scale ought to be
// 64-bit quantities, always.
@@ -2218,7 +2301,12 @@
/* Look for a build-id */
HChar* buildid = find_buildid(mimg, False, False);
- /* Look for a debug image */
+ /* Look for a debug image that matches either the build-id or
+ the debuglink-CRC32 in the main image. If the main image
+ doesn't contain either of those then this won't even bother
+ to try looking. This looks in all known places, including
+ the --extra-debuginfo-path if specified and on the
+ --debuginfo-server if specified. */
if (buildid != NULL || debuglink_escn.img != NULL) {
/* Do have a debuglink section? */
if (debuglink_escn.img != NULL) {
@@ -2251,16 +2339,22 @@
buildid = NULL; /* paranoia */
}
-# if defined(VGPV_arm_linux_android)
- if (dimg == NULL && VG_(clo_debuginfo_server) != NULL) {
- HChar* basename = di->fsm.filename;
- if (VG_(strstr)(basename, "/") != NULL)
- basename = VG_(strrchr)(basename, '/') + 1;
- VG_(printf)("XXXXXXXXXXX trying ad-hoc %s\n", basename);
- dimg = ML_(img_from_di_server)(basename,
- VG_(clo_debuginfo_server));
+ /* As a last-ditch measure, try looking for in the
+ --extra-debuginfo-path and/or on the --debuginfo-server, but
+ only in the case where --allow-mismatched-debuginfo=yes.
+ This is dangerous in that (1) it gives no assurance that the
+ debuginfo object matches the main one, and hence (2) we will
+ very likely get an assertion in the code below, if indeed
+ there is a mismatch. Hence it is disabled by default
+ (--allow-mismatched-debuginfo=no). Nevertheless it's
+ sometimes a useful way of getting out of a tight spot.
+
+ Note that we're ignoring the name in the .gnu_debuglink
+ section here, and just looking for a file of the same name
+ either the extra-path or on the server. */
+ if (dimg == NULL && VG_(clo_allow_mismatched_debuginfo)) {
+ dimg = find_debug_file_ad_hoc( di, di->fsm.filename );
}
-# endif
/* TOPLEVEL */
/* If we were successful in finding a debug image, pull various
Modified: branches/DISRV/coregrind/m_options.c (+1 -0)
===================================================================
--- branches/DISRV/coregrind/m_options.c 2013-06-25 13:42:52 +01:00 (rev 13430)
+++ branches/DISRV/coregrind/m_options.c 2013-06-27 18:39:15 +01:00 (rev 13431)
@@ -81,6 +81,7 @@
const HChar* VG_(clo_fullpath_after)[VG_CLO_MAX_FULLPATH_AFTER];
const HChar* VG_(clo_extra_debuginfo_path) = NULL;
const HChar* VG_(clo_debuginfo_server) = NULL;
+Bool VG_(clo_allow_mismatched_debuginfo) = False;
UChar VG_(clo_trace_flags) = 0; // 00000000b
Bool VG_(clo_profyle_sbs) = False;
UChar VG_(clo_profyle_flags) = 0; // 00000000b
Modified: branches/DISRV/coregrind/m_debuginfo/image.c (+31 -12)
===================================================================
--- branches/DISRV/coregrind/m_debuginfo/image.c 2013-06-25 13:42:52 +01:00 (rev 13430)
+++ branches/DISRV/coregrind/m_debuginfo/image.c 2013-06-27 18:39:15 +01:00 (rev 13431)
@@ -179,6 +179,18 @@
}
}
+/* If we lost communication with the remote server, just give up.
+ Recovering is too difficult. */
+static void give_up(void)
+{
+ VG_(umsg)("\n");
+ VG_(umsg)("Valgrind: Lost communication with the remote "
+ "debuginfo server.\n");
+ VG_(umsg)("Valgrind: I can't recover from that. Giving up. Sorry.\n");
+ VG_(umsg)("\n");
+ VG_(exit)(1);
+ /*NOTREACHED*/
+}
/* "Do" a transaction: that is, send the given frame to the server and
return the frame it sends back. Caller owns the resulting frame
@@ -186,7 +198,9 @@
some reason. */
static Frame* do_transaction ( Int sd, Frame* req )
{
-if (0) VG_(printf)("CLIENT: send %c%c%c%c\n", req->data[0], req->data[1], req->data[2], req->data[3]);
+ if (0) VG_(printf)("CLIENT: send %c%c%c%c\n",
+ req->data[0], req->data[1], req->data[2], req->data[3]);
+
/* What goes on the wire is:
adler(le32) n_data(le32) data[0 .. n_data-1]
where the checksum covers n_data as well as data[].
@@ -224,7 +238,8 @@
r = my_read(sd, res->data, res->n_data);
if (r != rd_len) return NULL;
-if (0) VG_(printf)("CLIENT: recv %c%c%c%c\n", res->data[0], res->data[1], res->data[2], res->data[3]);
+ if (0) VG_(printf)("CLIENT: recv %c%c%c%c\n",
+ res->data[0], res->data[1], res->data[2], res->data[3]);
/* Compute the checksum for the received data, and check it. */
adler = VG_(adler32)(0, NULL, 0); // initial value
@@ -417,16 +432,16 @@
/* So, read off .. off+len-1 into the entry. */
CEnt* ce = img->ces[entNo];
-if (0) {
-static UInt t_last = 0;
-static ULong nread = 0;
-UInt now = VG_(read_millisecond_timer)();
-UInt delay = now - t_last;
-t_last = now;
-nread += len;
-VG_(printf)("XXXXXXXX (tot %lld) read %ld offset %lld %u\n",
- nread, len, off, delay);
-}
+ if (0) {
+ static UInt t_last = 0;
+ static ULong nread = 0;
+ UInt now = VG_(read_millisecond_timer)();
+ UInt delay = now - t_last;
+ t_last = now;
+ nread += len;
+ VG_(printf)("XXXXXXXX (tot %lld) read %ld offset %lld %u\n",
+ nread, len, off, delay);
+ }
if (img->source.is_local) {
// Simple: just read it
@@ -487,6 +502,8 @@
VG_(umsg)("set_CEnt (reading data from DI server): fail: "
"server unexpectedly closed the connection\n");
}
+ give_up();
+ /* NOTREACHED */
vg_assert(0);
end_of_else_clause:
{}
@@ -968,6 +985,8 @@
if (req) free_Frame(req);
if (res) free_Frame(res);
// FIXME: now what?
+ give_up();
+ /* NOTREACHED */
vg_assert(0);
}
/*NOTREACHED*/
|