constify to_rcmd
[deliverable/binutils-gdb.git] / gdb / record.c
CommitLineData
69d05d38
HZ
1/* Process record and replay target for GDB, the GNU debugger.
2
ecd75fc8 3 Copyright (C) 2008-2014 Free Software Foundation, Inc.
69d05d38
HZ
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20#include "defs.h"
21#include "gdbcmd.h"
0156b218 22#include "completer.h"
69d05d38 23#include "record.h"
82a90ccf 24#include "observer.h"
d02ed0bb
MM
25#include "inferior.h"
26#include "common/common-utils.h"
67c86d06
MM
27#include "cli/cli-utils.h"
28#include "disasm.h"
29
30#include <ctype.h>
69d05d38 31
d02ed0bb
MM
32/* This is the debug switch for process record. */
33unsigned int record_debug = 0;
27699eea 34
67c86d06
MM
35/* The number of instructions to print in "record instruction-history". */
36static unsigned int record_insn_history_size = 10;
37
42c634cb
PA
38/* The variable registered as control variable in the "record
39 instruction-history" command. Necessary for extra input
40 validation. */
41static unsigned int record_insn_history_size_setshow_var;
42
15984c13
MM
43/* The number of functions to print in "record function-call-history". */
44static unsigned int record_call_history_size = 10;
45
42c634cb
PA
46/* The variable registered as control variable in the "record
47 call-history" command. Necessary for extra input validation. */
48static unsigned int record_call_history_size_setshow_var;
49
d02ed0bb 50struct cmd_list_element *record_cmdlist = NULL;
742ce053 51struct cmd_list_element *record_goto_cmdlist = NULL;
d02ed0bb
MM
52struct cmd_list_element *set_record_cmdlist = NULL;
53struct cmd_list_element *show_record_cmdlist = NULL;
54struct cmd_list_element *info_record_cmdlist = NULL;
27699eea 55
7c1687a9
MM
56#define DEBUG(msg, args...) \
57 if (record_debug) \
58 fprintf_unfiltered (gdb_stdlog, "record: " msg "\n", ##args)
59
8213266a 60/* See record.h. */
27699eea 61
8213266a 62struct target_ops *
d02ed0bb 63find_record_target (void)
27699eea 64{
8b06beed 65 return find_target_at (record_stratum);
27699eea
MS
66}
67
d02ed0bb 68/* Check that recording is active. Throw an error, if it isn't. */
27699eea 69
d02ed0bb
MM
70static struct target_ops *
71require_record_target (void)
27699eea 72{
d02ed0bb 73 struct target_ops *t;
27699eea 74
d02ed0bb
MM
75 t = find_record_target ();
76 if (t == NULL)
77 error (_("No record target is currently active.\n"
78 "Use one of the \"target record-<tab><tab>\" commands first."));
27699eea 79
d02ed0bb 80 return t;
27699eea
MS
81}
82
d02ed0bb 83/* See record.h. */
27699eea 84
8213266a
PA
85void
86record_preopen (void)
87{
88 /* Check if a record target is already running. */
89 if (find_record_target () != NULL)
90 error (_("The process is already being recorded. Use \"record stop\" to "
91 "stop recording first."));
92}
93
94/* See record.h. */
95
d02ed0bb
MM
96int
97record_read_memory (struct gdbarch *gdbarch,
98 CORE_ADDR memaddr, gdb_byte *myaddr,
99 ssize_t len)
27699eea 100{
d02ed0bb 101 int ret = target_read_memory (memaddr, myaddr, len);
27699eea 102
7c1687a9
MM
103 if (ret != 0)
104 DEBUG ("error reading memory at addr %s len = %ld.\n",
105 paddress (gdbarch, memaddr), (long) len);
106
d02ed0bb 107 return ret;
27699eea
MS
108}
109
7c1687a9
MM
110/* Stop recording. */
111
112static void
113record_stop (struct target_ops *t)
114{
115 DEBUG ("stop %s", t->to_shortname);
116
ee97f592 117 t->to_stop_recording (t);
7c1687a9
MM
118}
119
120/* Unpush the record target. */
121
122static void
123record_unpush (struct target_ops *t)
124{
125 DEBUG ("unpush %s", t->to_shortname);
126
127 unpush_target (t);
128}
129
130/* See record.h. */
131
132void
133record_disconnect (struct target_ops *t, char *args, int from_tty)
134{
135 gdb_assert (t->to_stratum == record_stratum);
136
137 DEBUG ("disconnect %s", t->to_shortname);
138
139 record_stop (t);
140 record_unpush (t);
141
142 target_disconnect (args, from_tty);
143}
144
145/* See record.h. */
146
147void
52554a0e 148record_detach (struct target_ops *t, const char *args, int from_tty)
7c1687a9
MM
149{
150 gdb_assert (t->to_stratum == record_stratum);
151
152 DEBUG ("detach %s", t->to_shortname);
153
154 record_stop (t);
155 record_unpush (t);
156
157 target_detach (args, from_tty);
158}
159
160/* See record.h. */
161
162void
163record_mourn_inferior (struct target_ops *t)
164{
165 gdb_assert (t->to_stratum == record_stratum);
166
167 DEBUG ("mourn inferior %s", t->to_shortname);
168
169 /* It is safer to not stop recording. Resources will be freed when
170 threads are discarded. */
171 record_unpush (t);
172
173 target_mourn_inferior ();
174}
175
176/* See record.h. */
177
178void
179record_kill (struct target_ops *t)
180{
181 gdb_assert (t->to_stratum == record_stratum);
182
183 DEBUG ("kill %s", t->to_shortname);
184
185 /* It is safer to not stop recording. Resources will be freed when
186 threads are discarded. */
187 record_unpush (t);
188
189 target_kill ();
190}
191
6df67667
MS
192/* Implement "show record debug" command. */
193
69d05d38
HZ
194static void
195show_record_debug (struct ui_file *file, int from_tty,
196 struct cmd_list_element *c, const char *value)
197{
198 fprintf_filtered (file, _("Debugging of process record target is %s.\n"),
199 value);
200}
201
202/* Alias for "target record". */
203
204static void
205cmd_record_start (char *args, int from_tty)
206{
d02ed0bb 207 execute_command ("target record-full", from_tty);
69d05d38
HZ
208}
209
210/* Truncate the record log from the present point
211 of replay until the end. */
212
213static void
214cmd_record_delete (char *args, int from_tty)
215{
d02ed0bb
MM
216 require_record_target ();
217
218 if (!target_record_is_replaying ())
69d05d38 219 {
d02ed0bb
MM
220 printf_unfiltered (_("Already at end of record list.\n"));
221 return;
222 }
69d05d38 223
d02ed0bb
MM
224 if (!target_supports_delete_record ())
225 {
226 printf_unfiltered (_("The current record target does not support "
227 "this operation.\n"));
228 return;
69d05d38 229 }
d02ed0bb
MM
230
231 if (!from_tty || query (_("Delete the log from this point forward "
232 "and begin to record the running message "
233 "at current PC?")))
234 target_delete_record ();
69d05d38
HZ
235}
236
6df67667 237/* Implement the "stoprecord" or "record stop" command. */
69d05d38
HZ
238
239static void
240cmd_record_stop (char *args, int from_tty)
241{
d02ed0bb 242 struct target_ops *t;
82a90ccf 243
d02ed0bb 244 t = require_record_target ();
7c1687a9
MM
245
246 record_stop (t);
247 record_unpush (t);
69d05d38 248
d02ed0bb
MM
249 printf_unfiltered (_("Process record is stopped and all execution "
250 "logs are deleted.\n"));
69d05d38 251
d02ed0bb 252 observer_notify_record_changed (current_inferior (), 0);
69d05d38
HZ
253}
254
d02ed0bb 255/* The "set record" command. */
69d05d38
HZ
256
257static void
258set_record_command (char *args, int from_tty)
259{
3e43a32a
MS
260 printf_unfiltered (_("\"set record\" must be followed "
261 "by an apporpriate subcommand.\n"));
69d05d38
HZ
262 help_list (set_record_cmdlist, "set record ", all_commands, gdb_stdout);
263}
264
d02ed0bb
MM
265/* The "show record" command. */
266
69d05d38
HZ
267static void
268show_record_command (char *args, int from_tty)
269{
270 cmd_show_list (show_record_cmdlist, from_tty, "");
271}
272
d02ed0bb 273/* The "info record" command. */
b54295a7 274
69d05d38
HZ
275static void
276info_record_command (char *args, int from_tty)
277{
d02ed0bb 278 struct target_ops *t;
0156b218 279
d02ed0bb
MM
280 t = find_record_target ();
281 if (t == NULL)
0156b218 282 {
d02ed0bb
MM
283 printf_filtered (_("No record target is currently active.\n"));
284 return;
0156b218
MS
285 }
286
d02ed0bb
MM
287 printf_filtered (_("Active record target: %s\n"), t->to_shortname);
288 if (t->to_info_record != NULL)
630d6a4a 289 t->to_info_record (t);
0156b218
MS
290}
291
d02ed0bb 292/* The "record save" command. */
0156b218
MS
293
294static void
295cmd_record_save (char *args, int from_tty)
296{
297 char *recfilename, recfilename_buffer[40];
0156b218 298
d02ed0bb 299 require_record_target ();
0156b218 300
d02ed0bb 301 if (args != NULL && *args != 0)
0156b218
MS
302 recfilename = args;
303 else
304 {
305 /* Default recfile name is "gdb_record.PID". */
d02ed0bb 306 xsnprintf (recfilename_buffer, sizeof (recfilename_buffer),
dfd4cc63 307 "gdb_record.%d", ptid_get_pid (inferior_ptid));
0156b218
MS
308 recfilename = recfilename_buffer;
309 }
310
d02ed0bb 311 target_save_record (recfilename);
6b04bdb7
MS
312}
313
314/* "record goto" command. Argument is an instruction number,
315 as given by "info record".
316
317 Rewinds the recording (forward or backward) to the given instruction. */
318
d02ed0bb 319void
6b04bdb7
MS
320cmd_record_goto (char *arg, int from_tty)
321{
742ce053 322 ULONGEST insn;
6b04bdb7
MS
323
324 if (arg == NULL || *arg == '\0')
325 error (_("Command requires an argument (insn number to go to)."));
326
742ce053 327 insn = parse_and_eval_long (arg);
6b04bdb7 328
742ce053
MM
329 require_record_target ();
330 target_goto_record (insn);
331}
332
333/* The "record goto begin" command. */
334
335static void
336cmd_record_goto_begin (char *arg, int from_tty)
337{
338 if (arg != NULL && *arg != '\0')
339 error (_("Junk after argument: %s."), arg);
340
341 require_record_target ();
342 target_goto_record_begin ();
343}
344
345/* The "record goto end" command. */
346
347static void
348cmd_record_goto_end (char *arg, int from_tty)
349{
350 if (arg != NULL && *arg != '\0')
351 error (_("Junk after argument: %s."), arg);
352
353 require_record_target ();
354 target_goto_record_end ();
6b04bdb7
MS
355}
356
67c86d06
MM
357/* Read an instruction number from an argument string. */
358
359static ULONGEST
360get_insn_number (char **arg)
361{
362 ULONGEST number;
363 const char *begin, *end, *pos;
364
365 begin = *arg;
366 pos = skip_spaces_const (begin);
367
368 if (!isdigit (*pos))
369 error (_("Expected positive number, got: %s."), pos);
370
371 number = strtoulst (pos, &end, 10);
372
373 *arg += (end - begin);
374
375 return number;
376}
377
378/* Read a context size from an argument string. */
379
380static int
381get_context_size (char **arg)
382{
383 char *pos;
384 int number;
385
386 pos = skip_spaces (*arg);
387
388 if (!isdigit (*pos))
389 error (_("Expected positive number, got: %s."), pos);
390
391 return strtol (pos, arg, 10);
392}
393
394/* Complain about junk at the end of an argument string. */
395
396static void
397no_chunk (char *arg)
398{
399 if (*arg != 0)
400 error (_("Junk after argument: %s."), arg);
401}
402
403/* Read instruction-history modifiers from an argument string. */
404
405static int
406get_insn_history_modifiers (char **arg)
407{
408 int modifiers;
409 char *args;
410
411 modifiers = 0;
412 args = *arg;
413
414 if (args == NULL)
415 return modifiers;
416
417 while (*args == '/')
418 {
419 ++args;
420
421 if (*args == '\0')
422 error (_("Missing modifier."));
423
424 for (; *args; ++args)
425 {
426 if (isspace (*args))
427 break;
428
429 if (*args == '/')
430 continue;
431
432 switch (*args)
433 {
434 case 'm':
435 modifiers |= DISASSEMBLY_SOURCE;
436 modifiers |= DISASSEMBLY_FILENAME;
437 break;
438 case 'r':
439 modifiers |= DISASSEMBLY_RAW_INSN;
440 break;
441 case 'f':
442 modifiers |= DISASSEMBLY_OMIT_FNAME;
443 break;
946287b7
MM
444 case 'p':
445 modifiers |= DISASSEMBLY_OMIT_PC;
446 break;
67c86d06
MM
447 default:
448 error (_("Invalid modifier: %c."), *args);
449 }
450 }
451
452 args = skip_spaces (args);
453 }
454
455 /* Update the argument string. */
456 *arg = args;
457
458 return modifiers;
459}
460
42c634cb
PA
461/* The "set record instruction-history-size / set record
462 function-call-history-size" commands are unsigned, with UINT_MAX
463 meaning unlimited. The target interfaces works with signed int
464 though, to indicate direction, so map "unlimited" to INT_MAX, which
465 is about the same as unlimited in practice. If the user does have
0ccfeeae
MM
466 a log that huge, she can fetch it in chunks across several requests,
467 but she'll likely have other problems first... */
42c634cb
PA
468
469static int
0ccfeeae 470command_size_to_target_size (unsigned int size)
42c634cb 471{
0ccfeeae 472 gdb_assert (size <= INT_MAX || size == UINT_MAX);
42c634cb 473
0ccfeeae 474 if (size == UINT_MAX)
42c634cb
PA
475 return INT_MAX;
476 else
0ccfeeae 477 return size;
42c634cb
PA
478}
479
67c86d06
MM
480/* The "record instruction-history" command. */
481
482static void
483cmd_record_insn_history (char *arg, int from_tty)
484{
485 int flags, size;
486
487 require_record_target ();
488
489 flags = get_insn_history_modifiers (&arg);
490
0ccfeeae 491 size = command_size_to_target_size (record_insn_history_size);
67c86d06
MM
492
493 if (arg == NULL || *arg == 0 || strcmp (arg, "+") == 0)
494 target_insn_history (size, flags);
495 else if (strcmp (arg, "-") == 0)
496 target_insn_history (-size, flags);
497 else
498 {
499 ULONGEST begin, end;
500
501 begin = get_insn_number (&arg);
502
503 if (*arg == ',')
504 {
505 arg = skip_spaces (++arg);
506
507 if (*arg == '+')
508 {
509 arg += 1;
510 size = get_context_size (&arg);
511
512 no_chunk (arg);
513
514 target_insn_history_from (begin, size, flags);
515 }
516 else if (*arg == '-')
517 {
518 arg += 1;
519 size = get_context_size (&arg);
520
521 no_chunk (arg);
522
523 target_insn_history_from (begin, -size, flags);
524 }
525 else
526 {
527 end = get_insn_number (&arg);
528
529 no_chunk (arg);
530
531 target_insn_history_range (begin, end, flags);
532 }
533 }
534 else
535 {
536 no_chunk (arg);
537
538 target_insn_history_from (begin, size, flags);
539 }
540
541 dont_repeat ();
542 }
543}
544
15984c13
MM
545/* Read function-call-history modifiers from an argument string. */
546
547static int
548get_call_history_modifiers (char **arg)
549{
550 int modifiers;
551 char *args;
552
553 modifiers = 0;
554 args = *arg;
555
556 if (args == NULL)
557 return modifiers;
558
559 while (*args == '/')
560 {
561 ++args;
562
563 if (*args == '\0')
564 error (_("Missing modifier."));
565
566 for (; *args; ++args)
567 {
568 if (isspace (*args))
569 break;
570
571 if (*args == '/')
572 continue;
573
574 switch (*args)
575 {
576 case 'l':
1e038f67 577 modifiers |= RECORD_PRINT_SRC_LINE;
15984c13
MM
578 break;
579 case 'i':
1e038f67 580 modifiers |= RECORD_PRINT_INSN_RANGE;
15984c13 581 break;
8710b709
MM
582 case 'c':
583 modifiers |= RECORD_PRINT_INDENT_CALLS;
584 break;
15984c13
MM
585 default:
586 error (_("Invalid modifier: %c."), *args);
587 }
588 }
589
590 args = skip_spaces (args);
591 }
592
593 /* Update the argument string. */
594 *arg = args;
595
596 return modifiers;
597}
598
599/* The "record function-call-history" command. */
600
601static void
602cmd_record_call_history (char *arg, int from_tty)
603{
604 int flags, size;
605
606 require_record_target ();
607
608 flags = get_call_history_modifiers (&arg);
609
0ccfeeae 610 size = command_size_to_target_size (record_call_history_size);
15984c13
MM
611
612 if (arg == NULL || *arg == 0 || strcmp (arg, "+") == 0)
613 target_call_history (size, flags);
614 else if (strcmp (arg, "-") == 0)
615 target_call_history (-size, flags);
616 else
617 {
618 ULONGEST begin, end;
619
620 begin = get_insn_number (&arg);
621
622 if (*arg == ',')
623 {
624 arg = skip_spaces (++arg);
625
626 if (*arg == '+')
627 {
628 arg += 1;
629 size = get_context_size (&arg);
630
631 no_chunk (arg);
632
633 target_call_history_from (begin, size, flags);
634 }
635 else if (*arg == '-')
636 {
637 arg += 1;
638 size = get_context_size (&arg);
639
640 no_chunk (arg);
641
642 target_call_history_from (begin, -size, flags);
643 }
644 else
645 {
646 end = get_insn_number (&arg);
647
648 no_chunk (arg);
649
650 target_call_history_range (begin, end, flags);
651 }
652 }
653 else
654 {
655 no_chunk (arg);
656
657 target_call_history_from (begin, size, flags);
658 }
659
660 dont_repeat ();
661 }
662}
663
42c634cb
PA
664/* Helper for "set record instruction-history-size" and "set record
665 function-call-history-size" input validation. COMMAND_VAR is the
666 variable registered in the command as control variable. *SETTING
667 is the real setting the command allows changing. */
668
669static void
9c37696b 670validate_history_size (unsigned int *command_var, unsigned int *setting)
42c634cb
PA
671{
672 if (*command_var != UINT_MAX && *command_var > INT_MAX)
673 {
674 unsigned int new_value = *command_var;
675
676 /* Restore previous value. */
677 *command_var = *setting;
678 error (_("integer %u out of range"), new_value);
679 }
680
681 /* Commit new value. */
682 *setting = *command_var;
683}
684
685/* Called by do_setshow_command. We only want values in the
686 [0..INT_MAX] range, while the command's machinery accepts
687 [0..UINT_MAX]. See command_size_to_target_size. */
688
689static void
690set_record_insn_history_size (char *args, int from_tty,
691 struct cmd_list_element *c)
692{
693 validate_history_size (&record_insn_history_size_setshow_var,
694 &record_insn_history_size);
695}
696
697/* Called by do_setshow_command. We only want values in the
698 [0..INT_MAX] range, while the command's machinery accepts
699 [0..UINT_MAX]. See command_size_to_target_size. */
700
701static void
702set_record_call_history_size (char *args, int from_tty,
703 struct cmd_list_element *c)
704{
705 validate_history_size (&record_call_history_size_setshow_var,
706 &record_call_history_size);
707}
708
70221824
PA
709/* Provide a prototype to silence -Wmissing-prototypes. */
710extern initialize_file_ftype _initialize_record;
711
69d05d38
HZ
712void
713_initialize_record (void)
714{
0156b218
MS
715 struct cmd_list_element *c;
716
ccce17b0
YQ
717 add_setshow_zuinteger_cmd ("record", no_class, &record_debug,
718 _("Set debugging of record/replay feature."),
719 _("Show debugging of record/replay feature."),
720 _("When enabled, debugging output for "
721 "record/replay feature is displayed."),
722 NULL, show_record_debug, &setdebuglist,
723 &showdebuglist);
69d05d38 724
67c86d06 725 add_setshow_uinteger_cmd ("instruction-history-size", no_class,
42c634cb 726 &record_insn_history_size_setshow_var, _("\
67c86d06 727Set number of instructions to print in \"record instruction-history\"."), _("\
f81d1120
PA
728Show number of instructions to print in \"record instruction-history\"."), _("\
729A size of \"unlimited\" means unlimited instructions. The default is 10."),
42c634cb
PA
730 set_record_insn_history_size, NULL,
731 &set_record_cmdlist, &show_record_cmdlist);
67c86d06 732
15984c13 733 add_setshow_uinteger_cmd ("function-call-history-size", no_class,
42c634cb 734 &record_call_history_size_setshow_var, _("\
15984c13 735Set number of function to print in \"record function-call-history\"."), _("\
f81d1120
PA
736Show number of functions to print in \"record function-call-history\"."), _("\
737A size of \"unlimited\" means unlimited lines. The default is 10."),
42c634cb
PA
738 set_record_call_history_size, NULL,
739 &set_record_cmdlist, &show_record_cmdlist);
15984c13 740
0156b218 741 c = add_prefix_cmd ("record", class_obscure, cmd_record_start,
d02ed0bb 742 _("Start recording."),
0156b218
MS
743 &record_cmdlist, "record ", 0, &cmdlist);
744 set_cmd_completer (c, filename_completer);
745
69d05d38
HZ
746 add_com_alias ("rec", "record", class_obscure, 1);
747 add_prefix_cmd ("record", class_support, set_record_command,
748 _("Set record options"), &set_record_cmdlist,
749 "set record ", 0, &setlist);
750 add_alias_cmd ("rec", "record", class_obscure, 1, &setlist);
751 add_prefix_cmd ("record", class_support, show_record_command,
752 _("Show record options"), &show_record_cmdlist,
753 "show record ", 0, &showlist);
754 add_alias_cmd ("rec", "record", class_obscure, 1, &showlist);
755 add_prefix_cmd ("record", class_support, info_record_command,
756 _("Info record options"), &info_record_cmdlist,
757 "info record ", 0, &infolist);
758 add_alias_cmd ("rec", "record", class_obscure, 1, &infolist);
759
0156b218
MS
760 c = add_cmd ("save", class_obscure, cmd_record_save,
761 _("Save the execution log to a file.\n\
762Argument is optional filename.\n\
763Default filename is 'gdb_record.<process_id>'."),
764 &record_cmdlist);
765 set_cmd_completer (c, filename_completer);
766
69d05d38
HZ
767 add_cmd ("delete", class_obscure, cmd_record_delete,
768 _("Delete the rest of execution log and start recording it anew."),
769 &record_cmdlist);
770 add_alias_cmd ("d", "delete", class_obscure, 1, &record_cmdlist);
771 add_alias_cmd ("del", "delete", class_obscure, 1, &record_cmdlist);
772
773 add_cmd ("stop", class_obscure, cmd_record_stop,
774 _("Stop the record/replay target."),
775 &record_cmdlist);
776 add_alias_cmd ("s", "stop", class_obscure, 1, &record_cmdlist);
777
742ce053 778 add_prefix_cmd ("goto", class_obscure, cmd_record_goto, _("\
6b04bdb7
MS
779Restore the program to its state at instruction number N.\n\
780Argument is instruction number, as shown by 'info record'."),
742ce053
MM
781 &record_goto_cmdlist, "record goto ", 1, &record_cmdlist);
782
783 add_cmd ("begin", class_obscure, cmd_record_goto_begin,
784 _("Go to the beginning of the execution log."),
785 &record_goto_cmdlist);
786 add_alias_cmd ("start", "begin", class_obscure, 1, &record_goto_cmdlist);
787
788 add_cmd ("end", class_obscure, cmd_record_goto_end,
789 _("Go to the end of the execution log."),
790 &record_goto_cmdlist);
67c86d06
MM
791
792 add_cmd ("instruction-history", class_obscure, cmd_record_insn_history, _("\
793Print disassembled instructions stored in the execution log.\n\
794With a /m modifier, source lines are included (if available).\n\
795With a /r modifier, raw instructions in hex are included.\n\
796With a /f modifier, function names are omitted.\n\
946287b7 797With a /p modifier, current position markers are omitted.\n\
67c86d06
MM
798With no argument, disassembles ten more instructions after the previous \
799disassembly.\n\
800\"record instruction-history -\" disassembles ten instructions before a \
801previous disassembly.\n\
802One argument specifies an instruction number as shown by 'info record', and \
803ten instructions are disassembled after that instruction.\n\
804Two arguments with comma between them specify starting and ending instruction \
805numbers to disassemble.\n\
806If the second argument is preceded by '+' or '-', it specifies the distance \
807from the first argument.\n\
808The number of instructions to disassemble can be defined with \"set record \
809instruction-history-size\"."),
810 &record_cmdlist);
15984c13
MM
811
812 add_cmd ("function-call-history", class_obscure, cmd_record_call_history, _("\
813Prints the execution history at function granularity.\n\
814It prints one line for each sequence of instructions that belong to the same \
815function.\n\
816Without modifiers, it prints the function name.\n\
817With a /l modifier, the source file and line number range is included.\n\
818With a /i modifier, the instruction number range is included.\n\
8710b709 819With a /c modifier, the output is indented based on the call stack depth.\n\
15984c13
MM
820With no argument, prints ten more lines after the previous ten-line print.\n\
821\"record function-call-history -\" prints ten lines before a previous ten-line \
822print.\n\
823One argument specifies a function number as shown by 'info record', and \
824ten lines are printed after that function.\n\
825Two arguments with comma between them specify a range of functions to print.\n\
826If the second argument is preceded by '+' or '-', it specifies the distance \
827from the first argument.\n\
828The number of functions to print can be defined with \"set record \
829function-call-history-size\"."),
830 &record_cmdlist);
42c634cb
PA
831
832 /* Sync command control variables. */
833 record_insn_history_size_setshow_var = record_insn_history_size;
834 record_call_history_size_setshow_var = record_call_history_size;
69d05d38 835}
This page took 0.601877 seconds and 4 git commands to generate.