]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
fix n-i-bz report error for vgdb snapshot requested before execution
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Mon, 24 Sep 2012 21:50:16 +0000 (21:50 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Mon, 24 Sep 2012 21:50:16 +0000 (21:50 +0000)
Massif does not accept to take snapshots of heap before execution has started.
So, if such a snapshot is requested (using vgdb and option --vgdb-error=0),
then such a snapshot must be refused rather than causing an assert.
(problem reported by dark_footix@yahoo.fr)

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13015

NEWS
massif/ms_main.c

diff --git a/NEWS b/NEWS
index 864d01123ee1afc04676b102a361fe2ef2be37bb..2f8760bfed4b2d31b971e5b9710a78d27f99b8df 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -32,7 +32,7 @@ m = merged into 3_8_BRANCH
 305948    [390] ppc64: code generation for ShlD64 / ShrD64 asserts
 306054    [390] s390x: Condition code computation for convert-to-int/logical
 307155    [390] filter_gdb should filter out syscall-template.S T_PSEUDO
-
+n-i-bz    [390] report error for vgdb snapshot requested before execution
 
 Release 3.8.1 (19 September 2012)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
index aab9ac51897a76be86fe608628cd5aa89ca46b0d..a0ca9e9339a7feb6f9d8edf3368d9bbe928a562a 100644 (file)
@@ -2392,9 +2392,17 @@ static void handle_snapshot_monitor_command (Char *filename, Bool detailed)
 {
    Snapshot snapshot;
 
+   if (!clo_pages_as_heap && !have_started_executing_code) {
+      // See comments of variable have_started_executing_code.
+      VG_(gdb_printf) 
+         ("error: cannot take snapshot before execution has started\n");
+      return;
+   }
+
    clear_snapshot(&snapshot, /* do_sanity_check */ False);
    take_snapshot(&snapshot, Normal, get_time(), detailed);
-   write_snapshots_to_file ((filename == NULL) ? (Char*) "massif.vgdb.out" : filename,
+   write_snapshots_to_file ((filename == NULL) ? 
+                            (Char*) "massif.vgdb.out" : filename,
                             &snapshot,
                             1);
    delete_snapshot(&snapshot);