From 97c113e7e0009ea415e2f7b78f656bc531abc177 Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Tue, 28 Jun 2011 08:20:39 +0000 Subject: [PATCH] valgrind and tool mon. cmds prefixes changes + doc fixes + new vgdb option --cmd-time-out * changed prefixes of Valgrind core monitor commands from vg. to v. * removed prefixes of Tool monitor commands * memcheck leak_check 'leakpossible' arg renamed to 'possibleleak' * memcheck make_memory 'ifaddressabledefined' arg renamed to 'Definedifaddressable' (with uppercase D to avoid confusion with 'defined' arg). * vgdb options - Some doc updates : more logical option order documentation, specify 'standalone' for options aimed at standalone usage. - added option --cmd-time-out for standalone vgdb (comment of Josef Weindendorfer, needed to interface with a callgrind GUI) * updated tests according to the above. * updated documentation according to the above. * some additional minor doc fixes/clarifications (Philippe Waroquiers, philippe.waroquiers@skynet.be). Bug 214909 comment 111. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11844 --- callgrind/docs/cl-manual.xml | 4 +- callgrind/main.c | 10 +- coregrind/m_gdbserver/README_DEVELOPERS | 9 +- coregrind/m_gdbserver/server.c | 42 ++--- coregrind/vgdb.c | 172 ++++++++++++++---- docs/xml/manual-core-adv.xml | 121 ++++++------ gdbserver_tests/Makefile.am | 5 + gdbserver_tests/README_DEVELOPERS | 30 +-- gdbserver_tests/invoker | 4 +- gdbserver_tests/mcbreak.stdinB.gdb | 10 +- gdbserver_tests/mcclean_after_fork.stdinB.gdb | 4 +- gdbserver_tests/mchelp.stderrB.exp | 2 +- gdbserver_tests/mchelp.stdoutB.exp | 76 ++++---- gdbserver_tests/mchelp.vgtest | 2 +- gdbserver_tests/mcinfcallRU.stdinB.gdb | 4 +- gdbserver_tests/mcinfcallWSRU.stdinB.gdb | 4 +- gdbserver_tests/mcinvokeRU.stderrB.exp | 24 +-- gdbserver_tests/mcinvokeRU.vgtest | 2 +- gdbserver_tests/mcinvokeWS.stderrB.exp | 24 +-- gdbserver_tests/mcinvokeWS.vgtest | 2 +- gdbserver_tests/mcleak.stdinB.gdb | 20 +- gdbserver_tests/mcmain_pic.stdinB.gdb | 2 +- gdbserver_tests/mcsignopass.stdinB.gdb | 2 +- gdbserver_tests/mcsigpass.stdinB.gdb | 2 +- gdbserver_tests/mcvabits.stdinB.gdb | 62 +++---- gdbserver_tests/mcwatchpoints.stdinB.gdb | 2 +- gdbserver_tests/mssnapshot.stderrB.exp | 22 +-- gdbserver_tests/mssnapshot.stdinB.gdb | 8 +- gdbserver_tests/nlcontrolc.stdinB.gdb | 2 +- gdbserver_tests/nlpasssigalrm.stdinB.gdb | 2 +- gdbserver_tests/nlsigvgdb.stdinB.gdb | 6 +- massif/docs/ms-manual.xml | 4 +- massif/ms_main.c | 10 +- memcheck/docs/mc-manual.xml | 72 +++++--- memcheck/mc_errors.c | 2 +- memcheck/mc_include.h | 2 +- memcheck/mc_leakcheck.c | 4 +- memcheck/mc_main.c | 35 ++-- 38 files changed, 473 insertions(+), 337 deletions(-) diff --git a/callgrind/docs/cl-manual.xml b/callgrind/docs/cl-manual.xml index ceeee210b8..0da3589ec3 100644 --- a/callgrind/docs/cl-manual.xml +++ b/callgrind/docs/cl-manual.xml @@ -1083,12 +1083,12 @@ gdbserver (see ). - ct.dump [<dump_hint>] requests to dump the + dump [<dump_hint>] requests to dump the profile data. - ct.zero requests to zero the profile data + zero requests to zero the profile data counters. diff --git a/callgrind/main.c b/callgrind/main.c index 7de26557e7..a0cf5cd643 100644 --- a/callgrind/main.c +++ b/callgrind/main.c @@ -1360,9 +1360,9 @@ static void print_monitor_help ( void ) { VG_(gdb_printf) ("\n"); VG_(gdb_printf) ("callgrind monitor commands:\n"); - VG_(gdb_printf) (" ct.dump []\n"); + VG_(gdb_printf) (" dump []\n"); VG_(gdb_printf) (" dump counters\n"); - VG_(gdb_printf) (" ct.zero\n"); + VG_(gdb_printf) (" zero\n"); VG_(gdb_printf) (" zero counters\n"); VG_(gdb_printf) ("\n"); } @@ -1377,7 +1377,7 @@ static Bool handle_gdb_monitor_command (ThreadId tid, Char *req) VG_(strcpy) (s, req); wcmd = VG_(strtok_r) (s, " ", &ssaveptr); - switch (VG_(keyword_id) ("help ct.dump ct.zero", + switch (VG_(keyword_id) ("help dump zero", wcmd, kwd_report_duplicated_matches)) { case -2: /* multiple matches */ return True; @@ -1386,11 +1386,11 @@ static Bool handle_gdb_monitor_command (ThreadId tid, Char *req) case 0: /* help */ print_monitor_help(); return True; - case 1: { /* ct.dump */ + case 1: { /* dump */ CLG_(dump_profile)(req, False); return True; } - case 2: { /* ct.zero */ + case 2: { /* zero */ CLG_(zero_all_cost)(False); return True; } diff --git a/coregrind/m_gdbserver/README_DEVELOPERS b/coregrind/m_gdbserver/README_DEVELOPERS index 2334078793..782ce1c593 100644 --- a/coregrind/m_gdbserver/README_DEVELOPERS +++ b/coregrind/m_gdbserver/README_DEVELOPERS @@ -307,10 +307,11 @@ A not handled comment given by Julian at FOSDEM. TODO and/or additional nice things to have ------------------------------------------ * many options can be changed on-line without problems. - => would be nice to have a vg.option command that would evaluate + => would be nice to have a v.option command that would evaluate its arguments like the startup options of m_main.c and tool clo processing. -* have a mc.who_points_at
| +* have a memcheck monitor command + who_points_at
| that would describe the addresses where a pointer is found to address (or address leaked at loss_record_nr>) This would allow to interactively searching who is "keeping" a piece @@ -355,10 +356,10 @@ default_region_ok_for_hw_watchpoint (addr=134520360, len=10) at target.c:2738 * more client requests can be programmed in various tools. Currently, there are only a few standard valgrind or memcheck client requests implemented. - vg.suppression [generate|add|delete] might be an interesting command: + v.suppression [generate|add|delete] might be an interesting command: generate would output a suppression, add/delete would add a suppression in memory for the last (or selected?) error. - vg.break on fn calls/entry/exit + commands associated to it + v.break on fn calls/entry/exit + commands associated to it (such as search leaks)? diff --git a/coregrind/m_gdbserver/server.c b/coregrind/m_gdbserver/server.c index db4d1f75de..2a6c2a9441 100644 --- a/coregrind/m_gdbserver/server.c +++ b/coregrind/m_gdbserver/server.c @@ -115,7 +115,7 @@ void kill_request (char *msg) Note that in case of ambiguous command, 1 is returned. *sink_wanted_at_return is modified if one of the commands - 'vg.set *_output' is handled. + 'v.set *_output' is handled. */ static int handle_gdb_valgrind_command (char* mon, OutputSink* sink_wanted_at_return) @@ -133,9 +133,9 @@ int handle_gdb_valgrind_command (char* mon, OutputSink* sink_wanted_at_return) strcpy (s, mon); wcmd = strtok_r (s, " ", &ssaveptr); /* NB: if possible, avoid introducing a new command below which - starts with the same 4 first letters as an already existing + starts with the same 3 first letters as an already existing command. This ensures a shorter abbreviation for the user. */ - switch (VG_(keyword_id) ("help vg.set vg.info vg.wait vg.kill vg.translate", + switch (VG_(keyword_id) ("help v.set v.info v.wait v.kill v.translate", wcmd, kwd_report_duplicated_matches)) { case -2: ret = 1; @@ -159,26 +159,26 @@ int handle_gdb_valgrind_command (char* mon, OutputSink* sink_wanted_at_return) VG_(gdb_printf) ( "general valgrind monitor commands:\n" " help [debug] : monitor command help. With debug: + debugging commands\n" -" vg.wait [] : sleep (default 0) then continue\n" -" vg.info all_errors : show all errors found so far\n" -" vg.info last_error : show last error found\n" -" vg.info n_errs_found : show the nr of errors found so far\n" -" vg.kill : kill the Valgrind process\n" -" vg.set gdb_output : set valgrind output to gdb\n" -" vg.set log_output : set valgrind output to log\n" -" vg.set mixed_output : set valgrind output to log, interactive output to gdb\n" -" vg.set vgdb-error : debug me at error >= \n"); +" v.wait [] : sleep (default 0) then continue\n" +" v.info all_errors : show all errors found so far\n" +" v.info last_error : show last error found\n" +" v.info n_errs_found : show the nr of errors found so far\n" +" v.kill : kill the Valgrind process\n" +" v.set gdb_output : set valgrind output to gdb\n" +" v.set log_output : set valgrind output to log\n" +" v.set mixed_output : set valgrind output to log, interactive output to gdb\n" +" v.set vgdb-error : debug me at error >= \n"); if (int_value) { VG_(gdb_printf) ( "debugging valgrind internals monitor commands:\n" -" vg.info gdbserver_status : show gdbserver status\n" -" vg.info memory : show valgrind heap memory stats\n" -" vg.set debuglog : set valgrind debug log level to \n" -" vg.translate [] : debug translation of with \n" +" v.info gdbserver_status : show gdbserver status\n" +" v.info memory : show valgrind heap memory stats\n" +" v.set debuglog : set valgrind debug log level to \n" +" v.translate [] : debug translation of with \n" " (default traceflags 0b00100000 : show after instrumentation)\n" " An additional flag 0b100000000 allows to show gdbserver instrumentation\n"); } break; - case 1: /* vg.set */ + case 1: /* v.set */ ret = 1; wcmd = strtok_r (NULL, " ", &ssaveptr); switch (kwdid = VG_(keyword_id) @@ -230,7 +230,7 @@ int handle_gdb_valgrind_command (char* mon, OutputSink* sink_wanted_at_return) vg_assert (0); } break; - case 2: /* vg.info */ { + case 2: /* v.info */ { ret = 1; wcmd = strtok_r (NULL, " ", &ssaveptr); switch (kwdid = VG_(keyword_id) @@ -265,7 +265,7 @@ int handle_gdb_valgrind_command (char* mon, OutputSink* sink_wanted_at_return) } break; } - case 3: /* vg.wait */ + case 3: /* v.wait */ wcmd = strtok_r (NULL, " ", &ssaveptr); if (wcmd != NULL) { int_value = strtol (wcmd, &endptr, 10); @@ -275,10 +275,10 @@ int handle_gdb_valgrind_command (char* mon, OutputSink* sink_wanted_at_return) VG_(gdb_printf) ("gdbserver: continuing after wait ...\n"); ret = 1; break; - case 4: /* vg.kill */ + case 4: /* v.kill */ kill_request ("monitor command request to kill this process\n"); break; - case 5: { /* vg.translate */ + case 5: { /* v.translate */ Addr address; SizeT verbosity = 0x20; diff --git a/coregrind/vgdb.c b/coregrind/vgdb.c index 54ce6cfd5a..a0f900e961 100644 --- a/coregrind/vgdb.c +++ b/coregrind/vgdb.c @@ -31,6 +31,7 @@ #include "pub_core_threadstate.h" #include "pub_core_gdbserver.h" +#include #include #include #include @@ -93,6 +94,10 @@ I_die_here : (PTRACEINVOKER) architecture missing in vgdb.c #undef PTRACEINVOKER #endif +// Outputs information for the user about ptrace_scope protection +// or ptrace not working. +static void ptrace_restrictions_msg(void); + static int debuglevel; static struct timeval dbgtv; /* if level <= debuglevel, print timestamp, then print provided by debug info */ @@ -476,14 +481,26 @@ static Bool attach (int pid, char *msg) { long res; + static Bool output_error = True; + static Bool initial_attach = True; + // For a ptrace_scope protected system, we do not want to output + // repetitively attach error. We will output once an error + // for the initial_attach. Once the 1st attach has succeeded, we + // again show all errors. DEBUG(1, "%s PTRACE_ATTACH pid %d\n", msg, pid); res = ptrace (PTRACE_ATTACH, pid, NULL, NULL); if (res != 0) { - ERROR(errno, "%s PTRACE_ATTACH pid %d %ld\n", msg, pid, res); + if (output_error || debuglevel > 0) { + ERROR(errno, "%s PTRACE_ATTACH pid %d %ld\n", msg, pid, res); + if (initial_attach) + output_error = False; + } return False; } + initial_attach = False; + output_error = True; return waitstopped(pid, SIGSTOP, msg); } @@ -791,6 +808,7 @@ void restore_and_detach(int pid) static Bool invoke_gdbserver (int pid) { + static Bool ptrace_restrictions_msg_given = False; long res; Bool stopped; struct user user_mod; @@ -813,7 +831,11 @@ Bool invoke_gdbserver (int pid) DEBUG(1, "attach to 'main' pid %d\n", pid); if (!attach(pid, "attach main pid")) { - ERROR(0, "error attach main pid %d\n", pid); + if (!ptrace_restrictions_msg_given) { + ptrace_restrictions_msg_given = True; + ERROR(0, "error attach main pid %d\n", pid); + ptrace_restrictions_msg(); + } return False; } @@ -1074,14 +1096,21 @@ void cleanup_restore_and_detach(void *v_pid) (if PTRACE_INVOKER is defined) to ensure that the gdbserver code is called soon by valgrind. */ static int max_invoke_ms = 100; +#define NEVER 99999999 +static int cmd_time_out = NEVER; static void *invoke_gdbserver_in_valgrind(void *v_pid) { + struct timeval cmd_max_end_time; + Bool cmd_started = False; + struct timeval invoke_time; + int pid = *(int *)v_pid; int written_by_vgdb_before_sleep; int seen_by_valgrind_before_sleep; int invoked_written = -1; + unsigned int usecs; pthread_cleanup_push(cleanup_restore_and_detach, v_pid); @@ -1093,15 +1122,44 @@ void *invoke_gdbserver_in_valgrind(void *v_pid) "seen_by_valgrind_before_sleep %d\n", written_by_vgdb_before_sleep, seen_by_valgrind_before_sleep); - if (usleep(1000 * max_invoke_ms) != 0) { + if (cmd_time_out != NEVER + && !cmd_started + && written_by_vgdb_before_sleep > seen_by_valgrind_before_sleep) { + /* A command was started. Record the time at which it was started. */ + DEBUG(1, "IO for command started\n"); + gettimeofday(&cmd_max_end_time, NULL); + cmd_max_end_time.tv_sec += cmd_time_out; + cmd_started = True; + } + if (max_invoke_ms > 0) { + usecs = 1000 * max_invoke_ms; + gettimeofday(&invoke_time, NULL); + invoke_time.tv_sec += max_invoke_ms / 1000; + invoke_time.tv_usec += 1000 * (max_invoke_ms % 1000); + invoke_time.tv_sec += invoke_time.tv_usec / (1000 * 1000); + invoke_time.tv_usec = invoke_time.tv_usec % (1000 * 1000); + } else { + usecs = 0; + } + if (cmd_started) { + // 0 usecs here means the thread just has to check gdbserver eats + // the characters in <= cmd_time_out seconds. + // We will just wait by 1 second max at a time. + if (usecs == 0 || usecs > 1000 * 1000) + usecs = 1000 * 1000; + } + if (usleep(usecs) != 0) { if (errno == EINTR) continue; XERROR (errno, "error usleep\n"); } - /* if nothing happened during our sleep, let's try to wake up valgrind */ + /* If nothing happened during our sleep, let's try to wake up valgrind + or check for cmd time out. */ if (written_by_vgdb_before_sleep == VS_written_by_vgdb && seen_by_valgrind_before_sleep == VS_seen_by_valgrind && VS_written_by_vgdb > VS_seen_by_valgrind) { + struct timeval now; + gettimeofday(&now, NULL); DEBUG(2, "after sleep " "written_by_vgdb %d " @@ -1115,20 +1173,33 @@ void *invoke_gdbserver_in_valgrind(void *v_pid) XERROR (errno, "invoke_gdbserver_in_valgrind: " "check for pid %d existence failed\n", pid); - - #if defined(PTRACEINVOKER) - /* only need to wake up if the nr written has changed since - last invoke. */ - if (invoked_written != written_by_vgdb_before_sleep) { - if (invoke_gdbserver(pid)) { - /* If invoke succesful, no need to invoke again - for the same value of written_by_vgdb_before_sleep. */ - invoked_written = written_by_vgdb_before_sleep; + if (cmd_started) { + if (timercmp (&now, &cmd_max_end_time, >)) + XERROR (0, + "pid %d did not handle a command in %d seconds\n", + pid, cmd_time_out); + } + if (max_invoke_ms > 0 && timercmp (&now, &invoke_time, >=)) { + #if defined(PTRACEINVOKER) + /* only need to wake up if the nr written has changed since + last invoke. */ + if (invoked_written != written_by_vgdb_before_sleep) { + if (invoke_gdbserver(pid)) { + /* If invoke succesful, no need to invoke again + for the same value of written_by_vgdb_before_sleep. */ + invoked_written = written_by_vgdb_before_sleep; + } } + #else + DEBUG(2, "invoke_gdbserver via ptrace not (yet) implemented\n"); + #endif + } + } else { + // Something happened => restart timer check. + if (cmd_time_out != NEVER) { + DEBUG(2, "some IO was done => restart command\n"); + cmd_started = False; } - #else - DEBUG(2, "invoke_gdbserver via ptrace not (yet) implemented\n"); - #endif } } pthread_cleanup_pop(0); @@ -1531,7 +1602,7 @@ void close_connection(int to_pid, int from_pid) in the valgrind process can stay stopped if vgdb main exits before the invoke thread had time to detach from all valgrind threads. */ - if (max_invoke_ms > 0) { + if (max_invoke_ms > 0 || cmd_time_out != NEVER) { int join; /* It is surprisingly complex to properly shutdown or exit the @@ -1705,7 +1776,7 @@ void standalone_send_commands(int pid, int nc; - if (max_invoke_ms > 0) + if (max_invoke_ms > 0 || cmd_time_out != NEVER) pthread_create(&invoke_gdbserver_in_valgrind_thread, NULL, invoke_gdbserver_in_valgrind, (void *) &pid); @@ -1803,7 +1874,7 @@ void standalone_send_commands(int pid, /* report to user the existence of a vgdb-able valgrind process with given pid */ static -void report_pid (int pid) +void report_pid (int pid, Bool on_stdout) { char cmdline_file[100]; char cmdline[1000]; @@ -1824,14 +1895,14 @@ void report_pid (int pid) cmdline[sz] = 0; close (fd); } - fprintf(stderr, "use --pid=%d for %s\n", pid, cmdline); - fflush(stderr); + fprintf((on_stdout ? stdout : stderr), "use --pid=%d for %s\n", pid, cmdline); + fflush((on_stdout ? stdout : stderr)); } -/* Eventually produces additional usage information documenting the +/* Possibly produces additional usage information documenting the ptrace restrictions. */ static -void ptrace_restrictions(void) +void ptrace_restrictions_msg(void) { # ifdef PR_SET_PTRACER char *ptrace_scope_setting_file = "/proc/sys/kernel/yama/ptrace_scope"; @@ -1875,28 +1946,32 @@ void usage(void) " Only OPTION(s) can be given.\n" "\n" " OPTIONS are [--pid=] [--vgdb-prefix=]\n" -" [--max-invoke-ms=] [--wait=] [-d] [-D] [-l]\n" +" [--wait=] [--max-invoke-ms=]\n" +" [--cmd-time-out=] [-l] [-D] [-d]\n" +" \n" " --pid arg must be given if multiple Valgrind gdbservers are found.\n" " --vgdb-prefix arg must be given to both Valgrind and vgdb utility\n" " if you want to change the default prefix for the FIFOs communication\n" " between the Valgrind gdbserver and vgdb.\n" -" --wait arg tells vgdb to check during the specified number\n" +" --wait (default 0) tells vgdb to check during the specified number\n" " of seconds if a Valgrind gdbserver can be found.\n" -" --max-invoke-ms gives the nr of milli-seconds after which vgdb will force\n" -" the invocation of the Valgrind gdbserver (if the Valgrind process\n" -" is blocked in a system call).\n" -" -d arg tells to show debug info. Multiple -d args for more debug info\n" -" -D arg tells to show shared mem status and then exit.\n" +" --max-invoke-ms (default 100) gives the nr of milli-seconds after which vgdb\n" +" will force the invocation of the Valgrind gdbserver (if the Valgrind\n" +" process is blocked in a system call).\n" +" --cmd-time-out (default 99999999) tells vgdb to exit if the found Valgrind\n" +" gdbserver has not processed a command after number seconds\n" " -l arg tells to show the list of running Valgrind gdbserver and then exit.\n" +" -D arg tells to show shared mem status and then exit.\n" +" -d arg tells to show debug info. Multiple -d args for more debug info\n" "\n" " -h --help shows this message\n" " To get help from the Valgrind gdbserver, use vgdb help\n" "\n" ); - ptrace_restrictions(); + ptrace_restrictions_msg(); } -/* If show_list, shows the list of Valgrind processes with gdbserver activated. +/* If show_list, outputs on stdout the list of Valgrind processes with gdbserver activated. and then exits. else if arg_pid == -1, waits maximum check_trials seconds to discover @@ -1992,7 +2067,7 @@ int search_arg_pid(int arg_pid, int check_trials, Bool show_list) && kill (newpid, 0) == 0) { nr_valid_pid++; if (show_list) { - report_pid (newpid); + report_pid (newpid, /*on_stdout*/ True); pid = newpid; } else if (arg_pid != -1) { if (arg_pid == newpid) { @@ -2004,10 +2079,10 @@ int search_arg_pid(int arg_pid, int check_trials, Bool show_list) (stderr, "no --pid= arg given" " and multiple valgrind pids found:\n"); - report_pid (pid); + report_pid (pid, /*on_stdout*/ False); } pid = -2; - report_pid (newpid); + report_pid (newpid, /*on_stdout*/ False); } else { pid = newpid; } @@ -2057,14 +2132,18 @@ Bool numeric_val(char* arg, int *value) { const char *eq_pos = strchr(arg, '='); char *wrong; + long long int long_value; if (eq_pos == NULL) return False; - *value = strtol(eq_pos+1, &wrong, 10); + long_value = strtoll(eq_pos+1, &wrong, 10); + if (long_value < 0 || long_value > INT_MAX) + return False; if (*wrong) return False; + *value = (int) long_value; return True; } @@ -2115,22 +2194,27 @@ void parse_options(int argc, char** argv, } else if (is_opt(argv[i], "--pid=")) { int newpid; if (!numeric_val(argv[i], &newpid)) { - fprintf (stderr, "invalid pid argument %s\n", argv[i]); + fprintf (stderr, "invalid --pid argument %s\n", argv[i]); arg_errors++; } else if (arg_pid != -1) { - fprintf (stderr, "multiple pid arguments given\n"); + fprintf (stderr, "multiple --pid arguments given\n"); arg_errors++; } else { arg_pid = newpid; } } else if (is_opt(argv[i], "--wait=")) { if (!numeric_val(argv[i], &check_trials)) { - fprintf (stderr, "invalid wait argument %s\n", argv[i]); + fprintf (stderr, "invalid --wait argument %s\n", argv[i]); arg_errors++; } } else if (is_opt(argv[i], "--max-invoke-ms=")) { if (!numeric_val(argv[i], &max_invoke_ms)) { - fprintf (stderr, "invalid max-invoke-ms argument %s\n", argv[i]); + fprintf (stderr, "invalid --max-invoke-ms argument %s\n", argv[i]); + arg_errors++; + } + } else if (is_opt(argv[i], "--cmd-time-out=")) { + if (!numeric_val(argv[i], &cmd_time_out)) { + fprintf (stderr, "invalid --cmd-time-out argument %s\n", argv[i]); arg_errors++; } } else if (is_opt(argv[i], "--vgdb-prefix=")) { @@ -2179,6 +2263,14 @@ void parse_options(int argc, char** argv, "Can't use both -D and -l options\n"); } + if (max_invoke_ms > 0 + && cmd_time_out != NEVER + && (cmd_time_out * 1000) <= max_invoke_ms) { + arg_errors++; + fprintf (stderr, + "--max-invoke-ms must be < --cmd-time-out * 1000\n"); + } + if (show_list && arg_pid != -1) { arg_errors++; fprintf (stderr, diff --git a/docs/xml/manual-core-adv.xml b/docs/xml/manual-core-adv.xml index 9e3f0fc06d..3004fda16d 100644 --- a/docs/xml/manual-core-adv.xml +++ b/docs/xml/manual-core-adv.xml @@ -495,23 +495,23 @@ of the Valgrind core monitor commands. Each tool can also provide tool-specific monitor commands. An example of a tool specific monitor command is the Memcheck monitor -command mc.leak_check full +command leak_check full reachable any. This requests a full reporting of the allocated memory blocks. To have this leak check executed, use the GDB command: -GDB will send the mc.leak_check +GDB will send the leak_check command to the Valgrind gdbserver. The Valgrind gdbserver will execute the monitor command itself, if it recognises it to be a Valgrind core monitor command. If it is not recognised as such, it is assumed to be tool-specific and is handed to the tool for execution. For example: As with other GDB commands, the Valgrind gdbserver will accept abbreviated monitor command names and arguments, as long as the given abbreviation is unambiguous. For example, the above -mc.leak_check +leak_check command can also be typed as: The letters mo are recognised by GDB as being an abbreviation for monitor. So GDB sends the -string mc.l f r a to the Valgrind +string l f r a to the Valgrind gdbserver. The letters provided in this string are unambiguous for the Valgrind gdbserver. This therefore gives the same output as the unabbreviated command and arguments. If the provided abbreviation is ambiguous, the Valgrind gdbserver will report the list of commands (or argument values) that can match: @@ -555,8 +557,8 @@ these from a shell command line. For example, the following command lines, when given in a shell, will cause the same leak search to be executed by the process 3145: Note that the Valgrind gdbserver automatically continues the @@ -800,7 +802,7 @@ $5 = 36 Whilst an inferior call is running, the Valgrind tool will report errors as usual. If you do not want to have such errors stop the execution of the inferior call, you can - use vg.set vgdb-error to set a + use v.set vgdb-error to set a big value before the call, then manually reset it to its original value when the call is complete. @@ -987,11 +989,29 @@ options: gdbserver and vgdb. + + instructs vgdb to + search for available Valgrind gdbservers for the specified number + of seconds. This makes it possible start a vgdb process + before starting the Valgrind gdbserver with which you intend the + vgdb to communicate. This option is useful when used in + conjunction with a that is + unique to the process you want to wait for. + Also, if you use the argument in the GDB + "target remote" command, you must set the GDB remotetimeout to a + value bigger than the --wait argument value. See option + (just below) + for an example of setting the remotetimeout value. + + gives the number of milliseconds after which vgdb will force the invocation - of gdbserver embedded in valgrind. The default value is 100 - milliseconds. A value of 0 disables forced invocation. + of gdbserver embedded in Valgrind. The default value is 100 + milliseconds. A value of 0 disables forced invocation. The forced + invocation is used when vgdb is connected to a Valgrind gdbserver, + and the Valgrind process has all its threads blocked in a system + call. If you specify a large value, you might need to increase the @@ -1005,46 +1025,45 @@ options: ]]> - + - instructs vgdb to - search for available Valgrind gdbservers for the specified number - of seconds. This makes it possible start a vgdb process - before starting the Valgrind gdbserver with which you intend the - vgdb to communicate. This option is useful when used in - conjunction with a that is - unique to the process you want to wait for. - Also, if you use the argument in the GDB - "target remote" command, you must set the GDB remotetimeout to a - value bigger than the --wait argument value. See option - (just above) - for an example of setting the remotetimeout value. + instructs a + standalone vgdb to exit if the Valgrind gdbserver it is connected + to does not process a command in the specified number of seconds. + The default value is to never time out. + - To give more than one command, separate - the commands by an option . Example: + To give more than one command to a + standalone vgdb, separate the commands by an + option . Example: - instructs vgdb to produce debugging - output. Give multiple args to increase the - verbosity. + instructs a standalone vgdb to report + the list of the Valgrind gdbserver processes running and then + exit. - + - instructs vgdb to show the state of the - shared memory used by the Valgrind gdbserver. vgdb will exit after - having shown the Valgrind gdbserver shared memory state. + instructs a standalone vgdb to show the + state of the shared memory used by the Valgrind gdbserver. vgdb + will exit after having shown the Valgrind gdbserver shared memory + state. - instructs vgdb to report the list of - the Valgrind gdbserver processes running and then exit. + instructs vgdb to produce debugging + output. Give multiple args to increase the + verbosity. When giving to a relay vgdb, you better + redirect the standard error (stderr) of vgdb to a file to avoid + interaction between GDB and vgdb debugging output. + @@ -1069,23 +1088,23 @@ line, by using a standalone vgdb, or from GDB, by using GDB's - vg.info all_errors shows all errors found + v.info all_errors shows all errors found so far. - vg.info last_error shows the last error + v.info last_error shows the last error found. - vg.info n_errs_found shows the number of + v.info n_errs_found shows the number of errors found so far and the current value of the argument. - vg.set {gdb_output | log_output | + v.set {gdb_output | log_output | mixed_output} allows redirection of the Valgrind output (e.g. the errors detected by the tool). The default setting is mixed_output. @@ -1093,7 +1112,7 @@ line, by using a standalone vgdb, or from GDB, by using GDB's With mixed_output, the Valgrind output goes to the Valgrind log (typically stderr) while the output of the interactive GDB monitor commands (e.g. - vg.info last_error) + v.info last_error) is displayed by GDB. With gdb_output, both the @@ -1106,7 +1125,7 @@ line, by using a standalone vgdb, or from GDB, by using GDB's - vg.wait [ms (default 0)] instructs + v.wait [ms (default 0)] instructs Valgrind gdbserver to sleep "ms" milli-seconds and then continue. When sent from a standalone vgdb, if this is the last command, the Valgrind process will continue the execution of the @@ -1117,14 +1136,14 @@ line, by using a standalone vgdb, or from GDB, by using GDB's - vg.kill requests the gdbserver to kill + v.kill requests the gdbserver to kill the process. This can be used from a standalone vgdb to properly kill a Valgrind process which is currently expecting a vgdb connection. - vg.set vgdb-error <errornr> + v.set vgdb-error <errornr> dynamically changes the value of the argument. A typical usage of this is to start with @@ -1142,7 +1161,7 @@ problems or bugs. - vg.info gdbserver_status shows the + v.info gdbserver_status shows the gdbserver status. In case of problems (e.g. of communications), this showns the values of some relevant Valgrind gdbserver internal variables. Note that the variables related to breakpoints and @@ -1156,7 +1175,7 @@ problems or bugs. - vg.info memory shows the statistics of + v.info memory shows the statistics of Valgrind's internal heap management. If option was given, detailed statistics will be output. @@ -1164,14 +1183,14 @@ problems or bugs. - vg.set debuglog <intvalue> sets the + v.set debuglog <intvalue> sets the Valgrind debug log level to <intvalue>. This allows to dynamically change the log level of Valgrind e.g. when a problem is detected. - vg.translate <address> + v.translate <address> [<traceflags>] shows the translation of the block containing address with the given trace flags. The traceflags value diff --git a/gdbserver_tests/Makefile.am b/gdbserver_tests/Makefile.am index aed048d82c..2891c8ba14 100644 --- a/gdbserver_tests/Makefile.am +++ b/gdbserver_tests/Makefile.am @@ -44,6 +44,11 @@ EXTRA_DIST = \ mcleak.stdinB.gdb \ mcleak.stdoutB.exp \ mcleak.vgtest \ + mcmain_pic.stderrB.exp \ + mcmain_pic.stderr.exp \ + mcmain_pic.stdinB.gdb \ + mcmain_pic.stdoutB.exp \ + mcmain_pic.stdout.exp \ mcmain_pic.vgtest \ mcmain_pic.stderrB.exp \ mcmain_pic.stderr.exp \ diff --git a/gdbserver_tests/README_DEVELOPERS b/gdbserver_tests/README_DEVELOPERS index 5eae785e19..1509a83711 100644 --- a/gdbserver_tests/README_DEVELOPERS +++ b/gdbserver_tests/README_DEVELOPERS @@ -144,11 +144,11 @@ Manual tests still to automate: Validate monitor commands abbreviation recognition *************************************************** -mo vg.info all_errors # to show all errors recorded so far -mo vg.i a # the same -mo v # must give an error: v can match vg.set vg.info -mo vg # the same vg -mo vg. # the same vg. +mo v.info all_errors # to show all errors recorded so far +mo v.i a # the same +mo v # must give an error: v can match v.set v.info +mo v # the same v +mo v. # the same v. test of gdb detaching or dying ****************************** @@ -159,11 +159,11 @@ in another window gdb ./t set remotetimeout 100 target remote|vgdb -detach valgrind continues +detach valgrind continues target remote|vgdb reattach -detach valgrind continues +detach valgrind continues target remote|vgdb reattach -monitor vg.wait no effect +monitor v.wait no effect @@ -177,14 +177,14 @@ in another window gdb ./t set remotetimeout 1000 target remote | vgdb -mo vg.set vgdb-error 1000 # so that valgrind does stop only at error 1000 and after -mo vg.set gdb_output # to have further valgrind errors output in gdb +mo v.set vgdb-error 1000 # so that valgrind does stop only at error 1000 and after +mo v.set gdb_output # to have further valgrind errors output in gdb c # continue, some errors will appear C-c # interrupt program -mo vg.set log_output # to set back the valgrind output to normal process log output -mo mc.l # leak output to appear in log of process -mo vg.set mixed_output -mo mc.l # leak output to appear in gdb +mo v.set log_output # to set back the valgrind output to normal process log output +mo l # leak output to appear in log of process +mo v.set mixed_output +mo l # leak output to appear in gdb @@ -207,7 +207,7 @@ start firefox like in the previous test. In another window, do: while true do - vgdb mc.leak + vgdb leak sleep 1 done diff --git a/gdbserver_tests/invoker b/gdbserver_tests/invoker index b9fba58bd7..37bc192fd2 100755 --- a/gdbserver_tests/invoker +++ b/gdbserver_tests/invoker @@ -4,7 +4,7 @@ # The first argument is the nr of times vgdb has to be called. # rest of args are given to vgdb # At the end of the loop, an additional call is done -# but adding " -c vg.kill" to kill Valgrind process. +# but adding " -c v.kill" to kill Valgrind process. LOOPS=$1 shift @@ -16,4 +16,4 @@ do i=`expr $i + 1` done -./vgdb "$@" -c vg.kill +./vgdb "$@" -c v.kill diff --git a/gdbserver_tests/mcbreak.stdinB.gdb b/gdbserver_tests/mcbreak.stdinB.gdb index 19f3d86371..4bd8c93f78 100644 --- a/gdbserver_tests/mcbreak.stdinB.gdb +++ b/gdbserver_tests/mcbreak.stdinB.gdb @@ -1,7 +1,7 @@ # connect gdb to Valgrind gdbserver: target remote | ./vgdb --wait=60 --vgdb-prefix=./vgdb-prefix-mcbreak echo vgdb launched process attached\n -monitor vg.set vgdb-error 999999 +monitor v.set vgdb-error 999999 # define checkstep set $old_pc=$pc @@ -25,7 +25,7 @@ checkstep checkstep checkstep # -monitor vg.set vgdb-error 0 +monitor v.set vgdb-error 0 # next print whoami("first") @@ -57,13 +57,13 @@ finish # delete all breaks delete continue -monitor vg.info n_errs_found +monitor v.info n_errs_found # inferior call "in the middle" of an instruction is not working at least # on all platforms, so comment the below. # print whoami("after error: inferior call pushed from mcbreak.stdinB.gdb") checkstep -monitor vg.set vgdb-error 0 +monitor v.set vgdb-error 0 continue # stop the process a.o. to avoid non deterministic output -monitor vg.kill +monitor v.kill quit diff --git a/gdbserver_tests/mcclean_after_fork.stdinB.gdb b/gdbserver_tests/mcclean_after_fork.stdinB.gdb index 500ef8e41a..bd2a5685f2 100644 --- a/gdbserver_tests/mcclean_after_fork.stdinB.gdb +++ b/gdbserver_tests/mcclean_after_fork.stdinB.gdb @@ -1,7 +1,7 @@ # connect gdb to Valgrind gdbserver: target remote | ./vgdb --wait=60 --vgdb-prefix=./vgdb-prefix-mcclean_after_fork echo vgdb launched process attached\n -monitor vg.set vgdb-error 999999 +monitor v.set vgdb-error 999999 # # put a break in main, and then a watch # also put breaks in code that only the child will execute. @@ -21,5 +21,5 @@ continue # # we should now have encountered the read watchpoint in the parent. # let's kill the parent: -monitor vg.kill +monitor v.kill quit diff --git a/gdbserver_tests/mchelp.stderrB.exp b/gdbserver_tests/mchelp.stderrB.exp index 55888e32a1..90b73e3e84 100644 --- a/gdbserver_tests/mchelp.stderrB.exp +++ b/gdbserver_tests/mchelp.stderrB.exp @@ -1,5 +1,5 @@ sending command help to pid .... sending command help debug to pid .... -sending command vg.kill to pid .... +sending command v.kill to pid .... readchar: Got EOF error reading packet diff --git a/gdbserver_tests/mchelp.stdoutB.exp b/gdbserver_tests/mchelp.stdoutB.exp index 90a93de2b0..d9c7e63b8f 100644 --- a/gdbserver_tests/mchelp.stdoutB.exp +++ b/gdbserver_tests/mchelp.stdoutB.exp @@ -1,66 +1,66 @@ general valgrind monitor commands: help [debug] : monitor command help. With debug: + debugging commands - vg.wait [] : sleep (default 0) then continue - vg.info all_errors : show all errors found so far - vg.info last_error : show last error found - vg.info n_errs_found : show the nr of errors found so far - vg.kill : kill the Valgrind process - vg.set gdb_output : set valgrind output to gdb - vg.set log_output : set valgrind output to log - vg.set mixed_output : set valgrind output to log, interactive output to gdb - vg.set vgdb-error : debug me at error >= + v.wait [] : sleep (default 0) then continue + v.info all_errors : show all errors found so far + v.info last_error : show last error found + v.info n_errs_found : show the nr of errors found so far + v.kill : kill the Valgrind process + v.set gdb_output : set valgrind output to gdb + v.set log_output : set valgrind output to log + v.set mixed_output : set valgrind output to log, interactive output to gdb + v.set vgdb-error : debug me at error >= memcheck monitor commands: - mc.get_vbits [] + get_vbits [] returns validity bits for (or 1) bytes at bit values 0 = valid, 1 = invalid, __ = unaddressable byte - Example: mc.get_vbits 0x........ 10 - mc.make_memory [noaccess|undefined - |defined|ifaddressabledefined] [] + Example: get_vbits 0x........ 10 + make_memory [noaccess|undefined + |defined|Definedifaddressable] [] mark (or 1) bytes at with the given accessibility - mc.check_memory [addressable|defined] [] + check_memory [addressable|defined] [] check that (or 1) bytes at have the given accessibility and outputs a description of - mc.leak_check [full*|summary] [reachable|leakpossible*|definiteleak] + leak_check [full*|summary] [reachable|possibleleak*|definiteleak] [increased*|changed|any] * = defaults - Examples: mc.leak_check - mc.leak_check summary any + Examples: leak_check + leak_check summary any general valgrind monitor commands: help [debug] : monitor command help. With debug: + debugging commands - vg.wait [] : sleep (default 0) then continue - vg.info all_errors : show all errors found so far - vg.info last_error : show last error found - vg.info n_errs_found : show the nr of errors found so far - vg.kill : kill the Valgrind process - vg.set gdb_output : set valgrind output to gdb - vg.set log_output : set valgrind output to log - vg.set mixed_output : set valgrind output to log, interactive output to gdb - vg.set vgdb-error : debug me at error >= + v.wait [] : sleep (default 0) then continue + v.info all_errors : show all errors found so far + v.info last_error : show last error found + v.info n_errs_found : show the nr of errors found so far + v.kill : kill the Valgrind process + v.set gdb_output : set valgrind output to gdb + v.set log_output : set valgrind output to log + v.set mixed_output : set valgrind output to log, interactive output to gdb + v.set vgdb-error : debug me at error >= debugging valgrind internals monitor commands: - vg.info gdbserver_status : show gdbserver status - vg.info memory : show valgrind heap memory stats - vg.set debuglog : set valgrind debug log level to - vg.translate [] : debug translation of with + v.info gdbserver_status : show gdbserver status + v.info memory : show valgrind heap memory stats + v.set debuglog : set valgrind debug log level to + v.translate [] : debug translation of with (default traceflags 0b00100000 : show after instrumentation) An additional flag 0b100000000 allows to show gdbserver instrumentation memcheck monitor commands: - mc.get_vbits [] + get_vbits [] returns validity bits for (or 1) bytes at bit values 0 = valid, 1 = invalid, __ = unaddressable byte - Example: mc.get_vbits 0x........ 10 - mc.make_memory [noaccess|undefined - |defined|ifaddressabledefined] [] + Example: get_vbits 0x........ 10 + make_memory [noaccess|undefined + |defined|Definedifaddressable] [] mark (or 1) bytes at with the given accessibility - mc.check_memory [addressable|defined] [] + check_memory [addressable|defined] [] check that (or 1) bytes at have the given accessibility and outputs a description of - mc.leak_check [full*|summary] [reachable|leakpossible*|definiteleak] + leak_check [full*|summary] [reachable|possibleleak*|definiteleak] [increased*|changed|any] * = defaults - Examples: mc.leak_check - mc.leak_check summary any + Examples: leak_check + leak_check summary any monitor command request to kill this process diff --git a/gdbserver_tests/mchelp.vgtest b/gdbserver_tests/mchelp.vgtest index 9f88c49806..c179295089 100644 --- a/gdbserver_tests/mchelp.vgtest +++ b/gdbserver_tests/mchelp.vgtest @@ -4,6 +4,6 @@ vgopts: --tool=memcheck --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-mc stdout_filter: filter_make_empty stderr_filter: filter_make_empty progB: vgdb -argsB: --wait=60 --vgdb-prefix=./vgdb-prefix-mchelp -c help -c help debug -c vg.kill +argsB: --wait=60 --vgdb-prefix=./vgdb-prefix-mchelp -c help -c help debug -c v.kill stdoutB_filter: filter_memcheck_monitor stderrB_filter: filter_vgdb diff --git a/gdbserver_tests/mcinfcallRU.stdinB.gdb b/gdbserver_tests/mcinfcallRU.stdinB.gdb index 32bd61a144..ffb122f224 100644 --- a/gdbserver_tests/mcinfcallRU.stdinB.gdb +++ b/gdbserver_tests/mcinfcallRU.stdinB.gdb @@ -1,7 +1,7 @@ # connect gdb to Valgrind gdbserver: target remote | ./vgdb --wait=60 --vgdb-prefix=./vgdb-prefix-mcinfcallRU echo vgdb launched process attached\n -monitor vg.set vgdb-error 999999 +monitor v.set vgdb-error 999999 # # We will interrupt in a few seconds (be sure the main task is ready). # Once it is ready, we still have to wait to be sure it is running. @@ -15,5 +15,5 @@ thread apply all bt full # before they have a chance to execute the whoami # thread apply all print whoami("inferior call pushed from gdb in mcinfcallRU.stdinB.gdb") -monitor vg.kill +monitor v.kill quit diff --git a/gdbserver_tests/mcinfcallWSRU.stdinB.gdb b/gdbserver_tests/mcinfcallWSRU.stdinB.gdb index fdedd8a166..643a1cd1ac 100644 --- a/gdbserver_tests/mcinfcallWSRU.stdinB.gdb +++ b/gdbserver_tests/mcinfcallWSRU.stdinB.gdb @@ -1,7 +1,7 @@ # connect gdb to Valgrind gdbserver: target remote | ./vgdb --wait=60 --vgdb-prefix=./vgdb-prefix-mcinfcallWSRU echo vgdb launched process attached\n -monitor vg.set vgdb-error 999999 +monitor v.set vgdb-error 999999 # # ensure all threads are known break sleeper_or_burner @@ -25,5 +25,5 @@ thread 3 print whoami("thread 3 inferior call pushed from gdb in mcinfcallWSRU.stdinB.gdb") thread 4 print whoami("thread 4 inferior call pushed from gdb in mcinfcallWSRU.stdinB.gdb") -monitor vg.kill +monitor v.kill quit diff --git a/gdbserver_tests/mcinvokeRU.stderrB.exp b/gdbserver_tests/mcinvokeRU.stderrB.exp index 41e660bd31..7d24a87b31 100644 --- a/gdbserver_tests/mcinvokeRU.stderrB.exp +++ b/gdbserver_tests/mcinvokeRU.stderrB.exp @@ -1,14 +1,14 @@ -sending command vg.wait 0 to pid .... -sending command vg.wait 0 to pid .... -sending command vg.wait 0 to pid .... -sending command vg.wait 0 to pid .... -sending command vg.wait 0 to pid .... -sending command vg.wait 0 to pid .... -sending command vg.wait 0 to pid .... -sending command vg.wait 0 to pid .... -sending command vg.wait 0 to pid .... -sending command vg.wait 0 to pid .... -sending command vg.wait 0 to pid .... -sending command vg.kill to pid .... +sending command v.wait 0 to pid .... +sending command v.wait 0 to pid .... +sending command v.wait 0 to pid .... +sending command v.wait 0 to pid .... +sending command v.wait 0 to pid .... +sending command v.wait 0 to pid .... +sending command v.wait 0 to pid .... +sending command v.wait 0 to pid .... +sending command v.wait 0 to pid .... +sending command v.wait 0 to pid .... +sending command v.wait 0 to pid .... +sending command v.kill to pid .... readchar: Got EOF error reading packet diff --git a/gdbserver_tests/mcinvokeRU.vgtest b/gdbserver_tests/mcinvokeRU.vgtest index ab933bbe70..4b89d8effa 100644 --- a/gdbserver_tests/mcinvokeRU.vgtest +++ b/gdbserver_tests/mcinvokeRU.vgtest @@ -6,7 +6,7 @@ vgopts: --tool=memcheck --vgdb=yes --vgdb-prefix=./vgdb-prefix-mcinvokeRU stderr_filter: filter_make_empty # as the Valgrind process is always busy, we do not need the vgdb.ptraceinvoker prereq. progB: invoker -argsB: 10 --vgdb-prefix=./vgdb-prefix-mcinvokeRU --wait=60 -c vg.wait 0 +argsB: 10 --vgdb-prefix=./vgdb-prefix-mcinvokeRU --wait=60 -c v.wait 0 # if the --wait is not enough, the test will fail or block. stdoutB_filter: filter_memcheck_monitor stderrB_filter: filter_vgdb diff --git a/gdbserver_tests/mcinvokeWS.stderrB.exp b/gdbserver_tests/mcinvokeWS.stderrB.exp index 41e660bd31..7d24a87b31 100644 --- a/gdbserver_tests/mcinvokeWS.stderrB.exp +++ b/gdbserver_tests/mcinvokeWS.stderrB.exp @@ -1,14 +1,14 @@ -sending command vg.wait 0 to pid .... -sending command vg.wait 0 to pid .... -sending command vg.wait 0 to pid .... -sending command vg.wait 0 to pid .... -sending command vg.wait 0 to pid .... -sending command vg.wait 0 to pid .... -sending command vg.wait 0 to pid .... -sending command vg.wait 0 to pid .... -sending command vg.wait 0 to pid .... -sending command vg.wait 0 to pid .... -sending command vg.wait 0 to pid .... -sending command vg.kill to pid .... +sending command v.wait 0 to pid .... +sending command v.wait 0 to pid .... +sending command v.wait 0 to pid .... +sending command v.wait 0 to pid .... +sending command v.wait 0 to pid .... +sending command v.wait 0 to pid .... +sending command v.wait 0 to pid .... +sending command v.wait 0 to pid .... +sending command v.wait 0 to pid .... +sending command v.wait 0 to pid .... +sending command v.wait 0 to pid .... +sending command v.kill to pid .... readchar: Got EOF error reading packet diff --git a/gdbserver_tests/mcinvokeWS.vgtest b/gdbserver_tests/mcinvokeWS.vgtest index 1be48e837e..24ecad45f8 100644 --- a/gdbserver_tests/mcinvokeWS.vgtest +++ b/gdbserver_tests/mcinvokeWS.vgtest @@ -6,7 +6,7 @@ vgopts: --tool=memcheck --vgdb=yes --vgdb-prefix=./vgdb-prefix-mcinvokeWS stderr_filter: filter_make_empty prereq: test -f vgdb.ptraceinvoker progB: invoker -argsB: 10 --vgdb-prefix=./vgdb-prefix-mcinvokeWS --wait=60 -c vg.wait 0 +argsB: 10 --vgdb-prefix=./vgdb-prefix-mcinvokeWS --wait=60 -c v.wait 0 # if the --wait is not enough, the test will fail or block stdoutB_filter: filter_memcheck_monitor stderrB_filter: filter_vgdb diff --git a/gdbserver_tests/mcleak.stdinB.gdb b/gdbserver_tests/mcleak.stdinB.gdb index a185f72bc5..ae67ddf252 100644 --- a/gdbserver_tests/mcleak.stdinB.gdb +++ b/gdbserver_tests/mcleak.stdinB.gdb @@ -1,7 +1,7 @@ # connect gdb to Valgrind gdbserver: target remote | ./vgdb --wait=60 --vgdb-prefix=./vgdb-prefix-mcleak echo vgdb launched process attached\n -monitor vg.set vgdb-error 999999 +monitor v.set vgdb-error 999999 # # # insert break: @@ -13,13 +13,13 @@ continue # # fprintf(stderr, "expecting details 10 bytes reachable\n"); fflush(stderr); breakme(); up -monitor mc.leak_check full reachable any +monitor leak_check full reachable any continue # VALGRIND_DO_LEAK_CHECK; # # fprintf(stderr, "expecting to have NO details\n"); fflush(stderr); up -monitor mc.leak_check full reachable increased +monitor leak_check full reachable increased continue # VALGRIND_DO_ADDED_LEAK_CHECK; # @@ -27,7 +27,7 @@ continue # b21 = malloc (21); # fprintf(stderr, "expecting details +10 bytes lost, +21 bytes reachable\n"); fflush(stderr); breakme(); up -monitor mc.leak_check full reachable increased +monitor leak_check full reachable increased continue # VALGRIND_DO_ADDED_LEAK_CHECK; # @@ -35,41 +35,41 @@ continue # b32_33[i] = malloc (32+i); # fprintf(stderr, "expecting details +65 bytes reachable\n"); fflush(stderr); breakme(); up -monitor mc.leak_check full reachable increased +monitor leak_check full reachable increased continue # VALGRIND_DO_ADDED_LEAK_CHECK; # # fprintf(stderr, "expecting to have NO details\n"); fflush(stderr); breakme(); up -monitor mc.leak_check full reachable increased +monitor leak_check full reachable increased continue # VALGRIND_DO_ADDED_LEAK_CHECK; # # b10++; # fprintf(stderr, "expecting details +10 bytes reachable\n"); fflush(stderr); breakme(); up -monitor mc.leak_check full reachable increased +monitor leak_check full reachable increased continue # VALGRIND_DO_ADDED_LEAK_CHECK; # # b10--; # fprintf(stderr, "expecting details -10 bytes reachable, +10 bytes lost\n"); fflush(stderr); breakme(); up -monitor mc.leak_check full reachable changed +monitor leak_check full reachable changed continue # VALGRIND_DO_CHANGED_LEAK_CHECK; # # b10++; # fprintf(stderr, "expecting details -10 bytes lost, +10 bytes reachable\n"); fflush(stderr); breakme(); up -monitor mc.leak_check full reachable changed +monitor leak_check full reachable changed continue # VALGRIND_DO_CHANGED_LEAK_CHECK; # # b32_33[0]--; # fprintf(stderr, "expecting details 32 (+32) bytes lost, 33 (-32) bytes reachable\n"); fflush(stderr); breakme(); up -monitor mc.leak_check full reachable changed +monitor leak_check full reachable changed continue # VALGRIND_DO_CHANGED_LEAK_CHECK; # diff --git a/gdbserver_tests/mcmain_pic.stdinB.gdb b/gdbserver_tests/mcmain_pic.stdinB.gdb index aa658db5bc..baa64fc739 100644 --- a/gdbserver_tests/mcmain_pic.stdinB.gdb +++ b/gdbserver_tests/mcmain_pic.stdinB.gdb @@ -1,7 +1,7 @@ # connect gdb to Valgrind gdbserver: target remote | ./vgdb --wait=60 --vgdb-prefix=./vgdb-prefix-mcmain_pic echo vgdb launched process attached\n -monitor vg.set vgdb-error 999999 +monitor v.set vgdb-error 999999 # # break break main diff --git a/gdbserver_tests/mcsignopass.stdinB.gdb b/gdbserver_tests/mcsignopass.stdinB.gdb index ef904d80ac..2ab36d8647 100644 --- a/gdbserver_tests/mcsignopass.stdinB.gdb +++ b/gdbserver_tests/mcsignopass.stdinB.gdb @@ -1,7 +1,7 @@ # connect gdb to Valgrind gdbserver: target remote | ./vgdb --wait=60 --vgdb-prefix=./vgdb-prefix-mcsignopass echo vgdb launched process attached\n -monitor vg.set vgdb-error 999999 +monitor v.set vgdb-error 999999 # # instruct gdb to not pass (i.e. ignore) these signals. # diff --git a/gdbserver_tests/mcsigpass.stdinB.gdb b/gdbserver_tests/mcsigpass.stdinB.gdb index dcc389e25f..b9a4d13837 100644 --- a/gdbserver_tests/mcsigpass.stdinB.gdb +++ b/gdbserver_tests/mcsigpass.stdinB.gdb @@ -1,7 +1,7 @@ # connect gdb to Valgrind gdbserver: target remote | ./vgdb --wait=60 --vgdb-prefix=./vgdb-prefix-mcsigpass echo vgdb launched process attached\n -monitor vg.set vgdb-error 999999 +monitor v.set vgdb-error 999999 # # After this continue, we will receive 5 signals. continue diff --git a/gdbserver_tests/mcvabits.stdinB.gdb b/gdbserver_tests/mcvabits.stdinB.gdb index 4fc1eeb3fb..8e2d235f51 100644 --- a/gdbserver_tests/mcvabits.stdinB.gdb +++ b/gdbserver_tests/mcvabits.stdinB.gdb @@ -1,7 +1,7 @@ # connect gdb to Valgrind gdbserver: target remote | ./vgdb --wait=60 --vgdb-prefix=./vgdb-prefix-mcvabits echo vgdb launched process attached\n -monitor vg.set vgdb-error 999999 +monitor v.set vgdb-error 999999 # # # insert break: @@ -20,55 +20,55 @@ print undefined set $0xundefined = &undefined # # Verif A-bits, V-bits, Get V-bits: A,V,G [0..9] -eval "monitor mc.check_memory addressable 0x%x 10", $0xundefined -eval "monitor mc.check_memory defined 0x%x 10", $0xundefined -eval "monitor mc.get_vbits 0x%x 10", $0xundefined +eval "monitor check_memory addressable 0x%x 10", $0xundefined +eval "monitor check_memory defined 0x%x 10", $0xundefined +eval "monitor get_vbits 0x%x 10", $0xundefined # # continue till //2break: continue # # A,V,G [0..9] after the undefinition of some bytes by executable: -eval "monitor mc.check_memory addressable 0x%x 10", $0xundefined -eval "monitor mc.check_memory defined 0x%x 10", $0xundefined -eval "monitor mc.get_vbits 0x%x 10", $0xundefined +eval "monitor check_memory addressable 0x%x 10", $0xundefined +eval "monitor check_memory defined 0x%x 10", $0xundefined +eval "monitor get_vbits 0x%x 10", $0xundefined # # Redefine [2..4] set $0xundefined_2 = (char*)$0xundefined + 2 -eval "monitor mc.make_memory defined 0x%x 3", $0xundefined_2 +eval "monitor make_memory defined 0x%x 3", $0xundefined_2 # A,V,G -eval "monitor mc.check_memory addressable 0x%x 10", $0xundefined -eval "monitor mc.check_memory defined 0x%x 10", $0xundefined -eval "monitor mc.get_vbits 0x%x 10", $0xundefined +eval "monitor check_memory addressable 0x%x 10", $0xundefined +eval "monitor check_memory defined 0x%x 10", $0xundefined +eval "monitor get_vbits 0x%x 10", $0xundefined # # Undefine [2..5] -eval "monitor mc.make_memory undefined 0x%x 4", $0xundefined_2 +eval "monitor make_memory undefined 0x%x 4", $0xundefined_2 # A,V,G [0..9] -eval "monitor mc.check_memory addressable 0x%x 10", $0xundefined -eval "monitor mc.check_memory defined 0x%x 10", $0xundefined -eval "monitor mc.get_vbits 0x%x 10", $0xundefined +eval "monitor check_memory addressable 0x%x 10", $0xundefined +eval "monitor check_memory defined 0x%x 10", $0xundefined +eval "monitor get_vbits 0x%x 10", $0xundefined # # noaccess [2..3] -eval "monitor mc.make_memory noaccess 0x%x 2", $0xundefined_2 +eval "monitor make_memory noaccess 0x%x 2", $0xundefined_2 # A,V,G [0..1] -eval "monitor mc.check_memory addressable 0x%x 2", $0xundefined -eval "monitor mc.check_memory defined 0x%x 2", $0xundefined -eval "monitor mc.get_vbits 0x%x 2", $0xundefined +eval "monitor check_memory addressable 0x%x 2", $0xundefined +eval "monitor check_memory defined 0x%x 2", $0xundefined +eval "monitor get_vbits 0x%x 2", $0xundefined # A,V,G [2..3] -eval "monitor mc.check_memory addressable 0x%x 2", $0xundefined_2 -eval "monitor mc.check_memory defined 0x%x 2", $0xundefined_2 -eval "monitor mc.get_vbits 0x%x 2", $0xundefined_2 +eval "monitor check_memory addressable 0x%x 2", $0xundefined_2 +eval "monitor check_memory defined 0x%x 2", $0xundefined_2 +eval "monitor get_vbits 0x%x 2", $0xundefined_2 # A,V,G [4..9] set $0xundefined_4 = (char*) $0xundefined_2 + 2 -eval "monitor mc.check_memory addressable 0x%x 6", $0xundefined_4 -eval "monitor mc.check_memory defined 0x%x 6", $0xundefined_4 -eval "monitor mc.get_vbits 0x%x 6", $0xundefined_4 +eval "monitor check_memory addressable 0x%x 6", $0xundefined_4 +eval "monitor check_memory defined 0x%x 6", $0xundefined_4 +eval "monitor get_vbits 0x%x 6", $0xundefined_4 # -# ifaddressabledefined undefined[0..9] -eval "monitor mc.make_memory ifaddressabledefined 0x%x 10", $0xundefined +# Definedifaddressable undefined[0..9] +eval "monitor make_memory Definedifaddressable 0x%x 10", $0xundefined # A,V,G -eval "monitor mc.check_memory addressable 0x%x 10", $0xundefined -eval "monitor mc.check_memory defined 0x%x 10", $0xundefined -eval "monitor mc.get_vbits 0x%x 10", $0xundefined +eval "monitor check_memory addressable 0x%x 10", $0xundefined +eval "monitor check_memory defined 0x%x 10", $0xundefined +eval "monitor get_vbits 0x%x 10", $0xundefined # -monitor vg.kill +monitor v.kill quit diff --git a/gdbserver_tests/mcwatchpoints.stdinB.gdb b/gdbserver_tests/mcwatchpoints.stdinB.gdb index 243453bd43..9411ef013c 100644 --- a/gdbserver_tests/mcwatchpoints.stdinB.gdb +++ b/gdbserver_tests/mcwatchpoints.stdinB.gdb @@ -1,7 +1,7 @@ # connect gdb to Valgrind gdbserver: target remote | ./vgdb --wait=60 --vgdb-prefix=./vgdb-prefix-mcwatchpoints echo vgdb launched process attached\n -monitor vg.set vgdb-error 999999 +monitor v.set vgdb-error 999999 # # # insert break: diff --git a/gdbserver_tests/mssnapshot.stderrB.exp b/gdbserver_tests/mssnapshot.stderrB.exp index b9b311de99..12a0292000 100644 --- a/gdbserver_tests/mssnapshot.stderrB.exp +++ b/gdbserver_tests/mssnapshot.stderrB.exp @@ -2,19 +2,19 @@ relaying data between gdb and process .... vgdb-error value changed from 0 to 999999 general valgrind monitor commands: help [debug] : monitor command help. With debug: + debugging commands - vg.wait [] : sleep (default 0) then continue - vg.info all_errors : show all errors found so far - vg.info last_error : show last error found - vg.info n_errs_found : show the nr of errors found so far - vg.kill : kill the Valgrind process - vg.set gdb_output : set valgrind output to gdb - vg.set log_output : set valgrind output to log - vg.set mixed_output : set valgrind output to log, interactive output to gdb - vg.set vgdb-error : debug me at error >= + v.wait [] : sleep (default 0) then continue + v.info all_errors : show all errors found so far + v.info last_error : show last error found + v.info n_errs_found : show the nr of errors found so far + v.kill : kill the Valgrind process + v.set gdb_output : set valgrind output to gdb + v.set log_output : set valgrind output to log + v.set mixed_output : set valgrind output to log, interactive output to gdb + v.set vgdb-error : debug me at error >= massif monitor commands: - ms.snapshot [] - ms.detailed_snapshot [] + snapshot [] + detailed_snapshot [] takes a snapshot (or a detailed snapshot) and saves it in default is massif.vgdb.out diff --git a/gdbserver_tests/mssnapshot.stdinB.gdb b/gdbserver_tests/mssnapshot.stdinB.gdb index 5c403781bd..5f4257a31c 100644 --- a/gdbserver_tests/mssnapshot.stdinB.gdb +++ b/gdbserver_tests/mssnapshot.stdinB.gdb @@ -1,7 +1,7 @@ # connect gdb to Valgrind gdbserver: target remote | ./vgdb --wait=60 --vgdb-prefix=./vgdb-prefix-mssnapshot echo vgdb launched process attached\n -monitor vg.set vgdb-error 999999 +monitor v.set vgdb-error 999999 # # # insert break: @@ -14,9 +14,9 @@ continue monitor help # # test non detailed and detailed snapshot -monitor ms.snapshot -monitor ms.detailed_snapshot +monitor snapshot +monitor detailed_snapshot # # -monitor vg.kill +monitor v.kill quit diff --git a/gdbserver_tests/nlcontrolc.stdinB.gdb b/gdbserver_tests/nlcontrolc.stdinB.gdb index 3ec07984e5..667ece18da 100644 --- a/gdbserver_tests/nlcontrolc.stdinB.gdb +++ b/gdbserver_tests/nlcontrolc.stdinB.gdb @@ -1,7 +1,7 @@ # connect gdb to Valgrind gdbserver: target remote | ./vgdb --wait=60 --vgdb-prefix=./vgdb-prefix-nlcontrolc echo vgdb launched process attached\n -monitor vg.set vgdb-error 999999 +monitor v.set vgdb-error 999999 # # # simulate control-c in a few seconds diff --git a/gdbserver_tests/nlpasssigalrm.stdinB.gdb b/gdbserver_tests/nlpasssigalrm.stdinB.gdb index ef928983e0..ee2b4e1ef5 100644 --- a/gdbserver_tests/nlpasssigalrm.stdinB.gdb +++ b/gdbserver_tests/nlpasssigalrm.stdinB.gdb @@ -1,7 +1,7 @@ # connect gdb to Valgrind gdbserver: target remote | ./vgdb --wait=60 --vgdb-prefix=./vgdb-prefix-nlpasssigalrm echo vgdb launched process attached\n -monitor vg.set vgdb-error 999999 +monitor v.set vgdb-error 999999 # # # ensure SIGALRM can be passed directly to the process, without diff --git a/gdbserver_tests/nlsigvgdb.stdinB.gdb b/gdbserver_tests/nlsigvgdb.stdinB.gdb index d7001c3b0b..e3990455b4 100644 --- a/gdbserver_tests/nlsigvgdb.stdinB.gdb +++ b/gdbserver_tests/nlsigvgdb.stdinB.gdb @@ -1,7 +1,7 @@ # connect gdb to Valgrind gdbserver: target remote | ./vgdb --wait=60 --vgdb-prefix=./vgdb-prefix-nlsigvgdb echo vgdb launched process attached\n -monitor vg.set vgdb-error 999999 +monitor v.set vgdb-error 999999 # # # simulate control-c in a few seconds @@ -9,9 +9,9 @@ monitor vg.set vgdb-error 999999 # an invocation while the gdbserver is already busy. shell ./simulate_control_c --vgdb-prefix=./vgdb-prefix-nlsigvgdb 1 grep continuing nlsigvgdb.stderrB.out # -monitor vg.wait 5000 +monitor v.wait 5000 # # kill the process now -monitor vg.kill +monitor v.kill quit diff --git a/massif/docs/ms-manual.xml b/massif/docs/ms-manual.xml index 8402a55d99..484d3eaa76 100644 --- a/massif/docs/ms-manual.xml +++ b/massif/docs/ms-manual.xml @@ -866,13 +866,13 @@ gdbserver (see ). - ms.snapshot [<filename>] requests + snapshot [<filename>] requests to take a snapshot and save it in the given <filename> (default massif.vgdb.out). - ms.detailed_snapshot [<filename>] + detailed_snapshot [<filename>] requests to take a detailed snapshot and save it in the given <filename> (default massif.vgdb.out). diff --git a/massif/ms_main.c b/massif/ms_main.c index 609f34d188..4609eadd8b 100644 --- a/massif/ms_main.c +++ b/massif/ms_main.c @@ -1977,8 +1977,8 @@ static void print_monitor_help ( void ) { VG_(gdb_printf) ("\n"); VG_(gdb_printf) ("massif monitor commands:\n"); - VG_(gdb_printf) (" ms.snapshot []\n"); - VG_(gdb_printf) (" ms.detailed_snapshot []\n"); + VG_(gdb_printf) (" snapshot []\n"); + VG_(gdb_printf) (" detailed_snapshot []\n"); VG_(gdb_printf) (" takes a snapshot (or a detailed snapshot)\n"); VG_(gdb_printf) (" and saves it in \n"); VG_(gdb_printf) (" default is massif.vgdb.out\n"); @@ -2396,7 +2396,7 @@ static Bool handle_gdb_monitor_command (ThreadId tid, Char *req) VG_(strcpy) (s, req); wcmd = VG_(strtok_r) (s, " ", &ssaveptr); - switch (VG_(keyword_id) ("help ms.snapshot ms.detailed_snapshot", + switch (VG_(keyword_id) ("help snapshot detailed_snapshot", wcmd, kwd_report_duplicated_matches)) { case -2: /* multiple matches */ return True; @@ -2405,13 +2405,13 @@ static Bool handle_gdb_monitor_command (ThreadId tid, Char *req) case 0: /* help */ print_monitor_help(); return True; - case 1: { /* ms.snapshot */ + case 1: { /* snapshot */ Char* filename; filename = VG_(strtok_r) (NULL, " ", &ssaveptr); handle_snapshot_monitor_command (filename, False /* detailed */); return True; } - case 2: { /* ms.detailed_snapshot */ + case 2: { /* detailed_snapshot */ Char* filename; filename = VG_(strtok_r) (NULL, " ", &ssaveptr); handle_snapshot_monitor_command (filename, True /* detailed */); diff --git a/memcheck/docs/mc-manual.xml b/memcheck/docs/mc-manual.xml index 29c8df0946..479f79363a 100644 --- a/memcheck/docs/mc-manual.xml +++ b/memcheck/docs/mc-manual.xml @@ -1278,7 +1278,7 @@ built-in gdbserver (see + + The command get_vbits cannot be used with registers. To get + the validity bits of a register, you must start Valgrind with the + option . The validity + bits of a register can be obtained by printing the 'shadow 1' + corresponding register. In the below x86 example, the register + eax has all its bits undefined, while the register ebx is fully + defined. + + + - mc.make_memory - [noaccess|undefined|defined|ifaddressabledefined] <addr> + make_memory + [noaccess|undefined|defined|Definedifaddressable] <addr> [<len>] marks the range of <len> (default 1) bytes at <addr> as having the given status. Parameter noaccess marks the range as non-accessible, so @@ -1312,33 +1329,36 @@ ff00ff00 ff__ff00 ff00 undefined or defined mark the area as accessible, but Memcheck regards the bytes in it respectively as having undefined or defined values. - ifaddressabledefined marks as defined, bytes in + Definedifaddressable marks as defined, bytes in the range which are already addressible, but makes no change to - the status of bytes in the range which are not addressible. + the status of bytes in the range which are not addressible. Note + that the first letter of Definedifaddressable + is an uppercase D to avoid confusion with defined. + In the following example, the first byte of the string10 is marked as defined: - mc.check_memory [addressable|defined] <addr> + check_memory [addressable|defined] <addr> [<len>] checks that the range of <len> - (default 1) bytes at <addr> has the specified accessibility. It - then outputs a description of <addr>. In the following example, a - detailed description is given available because - the option - was given Valgrind at startup: + (default 1) bytes at <addr> has the specified accessibility. + It then outputs a description of <addr>. In the following + example, a detailed description is available because the + option was given Valgrind at + startup: - mc.leak_check [full*|summary] - [reachable|leakpossible*|definiteleak] - [increased*|changed|any] + leak_check [full*|summary] + [reachable|possibleleak*|definiteleak] + [increased*|changed|any] performs a leak check. The * in the arguments indicates the default value. @@ -1368,7 +1388,7 @@ Address 0x8049E28 len 1 defined a full leak search. The value definiteleak specifies that only definitely leaked blocks should be shown. The - value leakpossible will also show possibly + value possibleleak will also show possibly leaked blocks (those for which only an interior pointer was found). The value reachable will show all block categories @@ -1390,7 +1410,7 @@ Address 0x8049E28 len 1 defined The following example shows usage of the - mc.leak_check monitor command on + leak_check monitor command on the memcheck/tests/leak-cases.c regression test. The first command outputs one entry having an increase in the leaked bytes. The second command is the same as the first @@ -1398,7 +1418,7 @@ Address 0x8049E28 len 1 defined Valgrind gdbserver. It only outputs the summary information, as there was no increase since the previous leak search. @@ -1431,9 +1451,9 @@ Address 0x8049E28 len 1 defined with to see the reachable blocks. You can obtain the same information without rerunning by - using the GDB command monitor mc.leak_check full + using the GDB command monitor leak_check full reachable any (or, using - abbreviation: mo mc.l f r a). + abbreviation: mo l f r a). diff --git a/memcheck/mc_errors.c b/memcheck/mc_errors.c index ed3627329b..4e2e019a13 100644 --- a/memcheck/mc_errors.c +++ b/memcheck/mc_errors.c @@ -717,7 +717,7 @@ void MC_(pp_Error) ( Error* err ) UInt n_total_records = extra->Err.Leak.n_total_records; LossRecord* lr = extra->Err.Leak.lr; // char arrays to produce the indication of increase/decrease in case - // of delta_mode != LC_Any + // of delta_mode != LCD_Any char d_bytes[20]; char d_direct_bytes[20]; char d_indirect_bytes[20]; diff --git a/memcheck/mc_include.h b/memcheck/mc_include.h index 0b9d345dfb..597b40f670 100644 --- a/memcheck/mc_include.h +++ b/memcheck/mc_include.h @@ -317,7 +317,7 @@ void MC_(detect_memory_leaks) ( ThreadId tid, LeakCheckParams lcp); // maintains the lcp.deltamode given in the last call to detect_memory_leaks extern LeakCheckDeltaMode MC_(detect_memory_leaks_last_delta_mode); -// if delta_mode == LC_Any, prints in buf an empty string +// if delta_mode == LCD_Any, prints in buf an empty string // otherwise prints a delta in the layout " (+%'lu)" or " (-%'lu)" extern char * MC_(snprintf_delta) (char * buf, Int size, SizeT current_val, SizeT old_val, diff --git a/memcheck/mc_leakcheck.c b/memcheck/mc_leakcheck.c index 41c9b71208..80d8290aa2 100644 --- a/memcheck/mc_leakcheck.c +++ b/memcheck/mc_leakcheck.c @@ -994,7 +994,7 @@ static void print_results(ThreadId tid, LeakCheckParams lcp) (MC_(blocks_leaked) + MC_(blocks_indirect) + MC_(blocks_dubious) + MC_(blocks_reachable)) > 0) { if (lcp.requested_by_monitor_command) - VG_(umsg)("To see details of leaked memory, give 'full' arg to mc.leak_check\n"); + VG_(umsg)("To see details of leaked memory, give 'full' arg to leak_check\n"); else VG_(umsg)("Rerun with --leak-check=full to see details " "of leaked memory\n"); @@ -1005,7 +1005,7 @@ static void print_results(ThreadId tid, LeakCheckParams lcp) VG_(umsg)("Reachable blocks (those to which a pointer " "was found) are not shown.\n"); if (lcp.requested_by_monitor_command) - VG_(umsg)("To see them, add 'reachable any' args to mc.leak_check\n"); + VG_(umsg)("To see them, add 'reachable any' args to leak_check\n"); else VG_(umsg)("To see them, rerun with: --leak-check=full " "--show-reachable=yes\n"); diff --git a/memcheck/mc_main.c b/memcheck/mc_main.c index 24ece12e12..36507ecdf7 100644 --- a/memcheck/mc_main.c +++ b/memcheck/mc_main.c @@ -4928,28 +4928,27 @@ static void show_client_block_stats ( void ) cgb_allocs, cgb_discards, cgb_used_MAX, cgb_search ); } - static void print_monitor_help ( void ) { VG_(gdb_printf) ( "\n" "memcheck monitor commands:\n" -" mc.get_vbits []\n" +" get_vbits []\n" " returns validity bits for (or 1) bytes at \n" " bit values 0 = valid, 1 = invalid, __ = unaddressable byte\n" -" Example: mc.get_vbits 0x8049c78 10\n" -" mc.make_memory [noaccess|undefined\n" -" |defined|ifaddressabledefined] []\n" +" Example: get_vbits 0x8049c78 10\n" +" make_memory [noaccess|undefined\n" +" |defined|Definedifaddressable] []\n" " mark (or 1) bytes at with the given accessibility\n" -" mc.check_memory [addressable|defined] []\n" +" check_memory [addressable|defined] []\n" " check that (or 1) bytes at have the given accessibility\n" " and outputs a description of \n" -" mc.leak_check [full*|summary] [reachable|leakpossible*|definiteleak]\n" +" leak_check [full*|summary] [reachable|possibleleak*|definiteleak]\n" " [increased*|changed|any]\n" " * = defaults\n" -" Examples: mc.leak_check\n" -" mc.leak_check summary any\n" +" Examples: leak_check\n" +" leak_check summary any\n" "\n"); } @@ -4964,10 +4963,10 @@ static Bool handle_gdb_monitor_command (ThreadId tid, Char *req) wcmd = VG_(strtok_r) (s, " ", &ssaveptr); /* NB: if possible, avoid introducing a new command below which - starts with the same 4 first letters as an already existing + starts with the same first letter(s) as an already existing command. This ensures a shorter abbreviation for the user. */ switch (VG_(keyword_id) - ("help mc.get_vbits mc.leak_check mc.make_memory mc.check_memory", + ("help get_vbits leak_check make_memory check_memory", wcmd, kwd_report_duplicated_matches)) { case -2: /* multiple matches */ return True; @@ -4976,7 +4975,7 @@ static Bool handle_gdb_monitor_command (ThreadId tid, Char *req) case 0: /* help */ print_monitor_help(); return True; - case 1: { /* mc.get_vbits */ + case 1: { /* get_vbits */ Addr address; SizeT szB = 1; VG_(strtok_get_address_and_size) (&address, &szB, &ssaveptr); @@ -5011,7 +5010,7 @@ static Bool handle_gdb_monitor_command (ThreadId tid, Char *req) } return True; } - case 2: { /* mc.leak_check */ + case 2: { /* leak_check */ Int err = 0; LeakCheckParams lcp; Char* kw; @@ -5027,7 +5026,7 @@ static Bool handle_gdb_monitor_command (ThreadId tid, Char *req) kw = VG_(strtok_r) (NULL, " ", &ssaveptr)) { switch (VG_(keyword_id) ("full summary " - "reachable leakpossible definiteleak " + "reachable possibleleak definiteleak " "increased changed any", kw, kwd_report_all)) { case -2: err++; break; @@ -5039,7 +5038,7 @@ static Bool handle_gdb_monitor_command (ThreadId tid, Char *req) case 2: /* reachable */ lcp.show_reachable = True; lcp.show_possibly_lost = True; break; - case 3: /* leakpossible */ + case 3: /* possibleleak */ lcp.show_reachable = False; lcp.show_possibly_lost = True; break; case 4: /* definiteleak */ @@ -5060,11 +5059,11 @@ static Bool handle_gdb_monitor_command (ThreadId tid, Char *req) return True; } - case 3: { /* mc.make_memory */ + case 3: { /* make_memory */ Addr address; SizeT szB = 1; int kwdid = VG_(keyword_id) - ("noaccess undefined defined ifaddressabledefined", + ("noaccess undefined defined Definedifaddressable", VG_(strtok_r) (NULL, " ", &ssaveptr), kwd_report_all); VG_(strtok_get_address_and_size) (&address, &szB, &ssaveptr); if (address == (Addr) 0 && szB == 0) return True; @@ -5081,7 +5080,7 @@ static Bool handle_gdb_monitor_command (ThreadId tid, Char *req) return True; } - case 4: { /* mc.check_memory */ + case 4: { /* check_memory */ Addr address; SizeT szB = 1; Addr bad_addr; -- 2.47.2