+static void print_monitor_help ( void )
+{
+ VG_(gdb_printf) ("\n");
+ VG_(gdb_printf) ("callgrind monitor commands:\n");
+ VG_(gdb_printf) (" ct.dump [<dump_hint>]\n");
+ VG_(gdb_printf) (" dump counters\n");
+ VG_(gdb_printf) (" ct.zero\n");
+ VG_(gdb_printf) (" zero counters\n");
+ VG_(gdb_printf) ("\n");
+}
+
+/* return True if request recognised, False otherwise */
+static Bool handle_gdb_monitor_command (ThreadId tid, Char *req)
+{
+ Char* wcmd;
+ Char s[VG_(strlen(req))]; /* copy for strtok_r */
+ Char *ssaveptr;
+
+ VG_(strcpy) (s, req);
+
+ wcmd = VG_(strtok_r) (s, " ", &ssaveptr);
+ switch (VG_(keyword_id) ("help ct.dump ct.zero",
+ wcmd, kwd_report_duplicated_matches)) {
+ case -2: /* multiple matches */
+ return True;
+ case -1: /* not found */
+ return False;
+ case 0: /* help */
+ print_monitor_help();
+ return True;
+ case 1: { /* ct.dump */
+ CLG_(dump_profile)(req, False);
+ return True;
+ }
+ case 2: { /* ct.zero */
+ CLG_(zero_all_cost)(False);
+ return True;
+ }
+
+ default:
+ tl_assert(0);
+ return False;
+ }
+}