Delete gdb/regformats/microblaze.dat
[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
fee354ee 133record_disconnect (struct target_ops *t, const char *args, int from_tty)
7c1687a9
MM
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 287 printf_filtered (_("Active record target: %s\n"), t->to_shortname);
38e229b2 288 t->to_info_record (t);
0156b218
MS
289}
290
d02ed0bb 291/* The "record save" command. */
0156b218
MS
292
293static void
294cmd_record_save (char *args, int from_tty)
295{
296 char *recfilename, recfilename_buffer[40];
0156b218 297
d02ed0bb 298 require_record_target ();
0156b218 299
d02ed0bb 300 if (args != NULL && *args != 0)
0156b218
MS
301 recfilename = args;
302 else
303 {
304 /* Default recfile name is "gdb_record.PID". */
d02ed0bb 305 xsnprintf (recfilename_buffer, sizeof (recfilename_buffer),
dfd4cc63 306 "gdb_record.%d", ptid_get_pid (inferior_ptid));
0156b218
MS
307 recfilename = recfilename_buffer;
308 }
309
d02ed0bb 310 target_save_record (recfilename);
6b04bdb7
MS
311}
312
c2bcbb1d 313/* See record.h. */
6b04bdb7 314
d02ed0bb 315void
c2bcbb1d 316record_goto (const char *arg)
6b04bdb7 317{
742ce053 318 ULONGEST insn;
6b04bdb7
MS
319
320 if (arg == NULL || *arg == '\0')
321 error (_("Command requires an argument (insn number to go to)."));
322
742ce053 323 insn = parse_and_eval_long (arg);
6b04bdb7 324
742ce053
MM
325 require_record_target ();
326 target_goto_record (insn);
327}
328
c2bcbb1d
TT
329/* "record goto" command. Argument is an instruction number,
330 as given by "info record".
331
332 Rewinds the recording (forward or backward) to the given instruction. */
333
334static void
335cmd_record_goto (char *arg, int from_tty)
336{
337 record_goto (arg);
338}
339
742ce053
MM
340/* The "record goto begin" command. */
341
342static void
343cmd_record_goto_begin (char *arg, int from_tty)
344{
345 if (arg != NULL && *arg != '\0')
346 error (_("Junk after argument: %s."), arg);
347
348 require_record_target ();
349 target_goto_record_begin ();
350}
351
352/* The "record goto end" command. */
353
354static void
355cmd_record_goto_end (char *arg, int from_tty)
356{
357 if (arg != NULL && *arg != '\0')
358 error (_("Junk after argument: %s."), arg);
359
360 require_record_target ();
361 target_goto_record_end ();
6b04bdb7
MS
362}
363
67c86d06
MM
364/* Read an instruction number from an argument string. */
365
366static ULONGEST
367get_insn_number (char **arg)
368{
369 ULONGEST number;
370 const char *begin, *end, *pos;
371
372 begin = *arg;
373 pos = skip_spaces_const (begin);
374
375 if (!isdigit (*pos))
376 error (_("Expected positive number, got: %s."), pos);
377
378 number = strtoulst (pos, &end, 10);
379
380 *arg += (end - begin);
381
382 return number;
383}
384
385/* Read a context size from an argument string. */
386
387static int
388get_context_size (char **arg)
389{
390 char *pos;
391 int number;
392
393 pos = skip_spaces (*arg);
394
395 if (!isdigit (*pos))
396 error (_("Expected positive number, got: %s."), pos);
397
398 return strtol (pos, arg, 10);
399}
400
401/* Complain about junk at the end of an argument string. */
402
403static void
404no_chunk (char *arg)
405{
406 if (*arg != 0)
407 error (_("Junk after argument: %s."), arg);
408}
409
410/* Read instruction-history modifiers from an argument string. */
411
412static int
413get_insn_history_modifiers (char **arg)
414{
415 int modifiers;
416 char *args;
417
418 modifiers = 0;
419 args = *arg;
420
421 if (args == NULL)
422 return modifiers;
423
424 while (*args == '/')
425 {
426 ++args;
427
428 if (*args == '\0')
429 error (_("Missing modifier."));
430
431 for (; *args; ++args)
432 {
433 if (isspace (*args))
434 break;
435
436 if (*args == '/')
437 continue;
438
439 switch (*args)
440 {
441 case 'm':
442 modifiers |= DISASSEMBLY_SOURCE;
443 modifiers |= DISASSEMBLY_FILENAME;
444 break;
445 case 'r':
446 modifiers |= DISASSEMBLY_RAW_INSN;
447 break;
448 case 'f':
449 modifiers |= DISASSEMBLY_OMIT_FNAME;
450 break;
946287b7
MM
451 case 'p':
452 modifiers |= DISASSEMBLY_OMIT_PC;
453 break;
67c86d06
MM
454 default:
455 error (_("Invalid modifier: %c."), *args);
456 }
457 }
458
459 args = skip_spaces (args);
460 }
461
462 /* Update the argument string. */
463 *arg = args;
464
465 return modifiers;
466}
467
42c634cb
PA
468/* The "set record instruction-history-size / set record
469 function-call-history-size" commands are unsigned, with UINT_MAX
470 meaning unlimited. The target interfaces works with signed int
471 though, to indicate direction, so map "unlimited" to INT_MAX, which
472 is about the same as unlimited in practice. If the user does have
0ccfeeae
MM
473 a log that huge, she can fetch it in chunks across several requests,
474 but she'll likely have other problems first... */
42c634cb
PA
475
476static int
0ccfeeae 477command_size_to_target_size (unsigned int size)
42c634cb 478{
0ccfeeae 479 gdb_assert (size <= INT_MAX || size == UINT_MAX);
42c634cb 480
0ccfeeae 481 if (size == UINT_MAX)
42c634cb
PA
482 return INT_MAX;
483 else
0ccfeeae 484 return size;
42c634cb
PA
485}
486
67c86d06
MM
487/* The "record instruction-history" command. */
488
489static void
490cmd_record_insn_history (char *arg, int from_tty)
491{
492 int flags, size;
493
494 require_record_target ();
495
496 flags = get_insn_history_modifiers (&arg);
497
0ccfeeae 498 size = command_size_to_target_size (record_insn_history_size);
67c86d06
MM
499
500 if (arg == NULL || *arg == 0 || strcmp (arg, "+") == 0)
501 target_insn_history (size, flags);
502 else if (strcmp (arg, "-") == 0)
503 target_insn_history (-size, flags);
504 else
505 {
506 ULONGEST begin, end;
507
508 begin = get_insn_number (&arg);
509
510 if (*arg == ',')
511 {
512 arg = skip_spaces (++arg);
513
514 if (*arg == '+')
515 {
516 arg += 1;
517 size = get_context_size (&arg);
518
519 no_chunk (arg);
520
521 target_insn_history_from (begin, size, flags);
522 }
523 else if (*arg == '-')
524 {
525 arg += 1;
526 size = get_context_size (&arg);
527
528 no_chunk (arg);
529
530 target_insn_history_from (begin, -size, flags);
531 }
532 else
533 {
534 end = get_insn_number (&arg);
535
536 no_chunk (arg);
537
538 target_insn_history_range (begin, end, flags);
539 }
540 }
541 else
542 {
543 no_chunk (arg);
544
545 target_insn_history_from (begin, size, flags);
546 }
547
548 dont_repeat ();
549 }
550}
551
15984c13
MM
552/* Read function-call-history modifiers from an argument string. */
553
554static int
555get_call_history_modifiers (char **arg)
556{
557 int modifiers;
558 char *args;
559
560 modifiers = 0;
561 args = *arg;
562
563 if (args == NULL)
564 return modifiers;
565
566 while (*args == '/')
567 {
568 ++args;
569
570 if (*args == '\0')
571 error (_("Missing modifier."));
572
573 for (; *args; ++args)
574 {
575 if (isspace (*args))
576 break;
577
578 if (*args == '/')
579 continue;
580
581 switch (*args)
582 {
583 case 'l':
1e038f67 584 modifiers |= RECORD_PRINT_SRC_LINE;
15984c13
MM
585 break;
586 case 'i':
1e038f67 587 modifiers |= RECORD_PRINT_INSN_RANGE;
15984c13 588 break;
8710b709
MM
589 case 'c':
590 modifiers |= RECORD_PRINT_INDENT_CALLS;
591 break;
15984c13
MM
592 default:
593 error (_("Invalid modifier: %c."), *args);
594 }
595 }
596
597 args = skip_spaces (args);
598 }
599
600 /* Update the argument string. */
601 *arg = args;
602
603 return modifiers;
604}
605
606/* The "record function-call-history" command. */
607
608static void
609cmd_record_call_history (char *arg, int from_tty)
610{
611 int flags, size;
612
613 require_record_target ();
614
615 flags = get_call_history_modifiers (&arg);
616
0ccfeeae 617 size = command_size_to_target_size (record_call_history_size);
15984c13
MM
618
619 if (arg == NULL || *arg == 0 || strcmp (arg, "+") == 0)
620 target_call_history (size, flags);
621 else if (strcmp (arg, "-") == 0)
622 target_call_history (-size, flags);
623 else
624 {
625 ULONGEST begin, end;
626
627 begin = get_insn_number (&arg);
628
629 if (*arg == ',')
630 {
631 arg = skip_spaces (++arg);
632
633 if (*arg == '+')
634 {
635 arg += 1;
636 size = get_context_size (&arg);
637
638 no_chunk (arg);
639
640 target_call_history_from (begin, size, flags);
641 }
642 else if (*arg == '-')
643 {
644 arg += 1;
645 size = get_context_size (&arg);
646
647 no_chunk (arg);
648
649 target_call_history_from (begin, -size, flags);
650 }
651 else
652 {
653 end = get_insn_number (&arg);
654
655 no_chunk (arg);
656
657 target_call_history_range (begin, end, flags);
658 }
659 }
660 else
661 {
662 no_chunk (arg);
663
664 target_call_history_from (begin, size, flags);
665 }
666
667 dont_repeat ();
668 }
669}
670
42c634cb
PA
671/* Helper for "set record instruction-history-size" and "set record
672 function-call-history-size" input validation. COMMAND_VAR is the
673 variable registered in the command as control variable. *SETTING
674 is the real setting the command allows changing. */
675
676static void
9c37696b 677validate_history_size (unsigned int *command_var, unsigned int *setting)
42c634cb
PA
678{
679 if (*command_var != UINT_MAX && *command_var > INT_MAX)
680 {
681 unsigned int new_value = *command_var;
682
683 /* Restore previous value. */
684 *command_var = *setting;
685 error (_("integer %u out of range"), new_value);
686 }
687
688 /* Commit new value. */
689 *setting = *command_var;
690}
691
692/* Called by do_setshow_command. We only want values in the
693 [0..INT_MAX] range, while the command's machinery accepts
694 [0..UINT_MAX]. See command_size_to_target_size. */
695
696static void
697set_record_insn_history_size (char *args, int from_tty,
698 struct cmd_list_element *c)
699{
700 validate_history_size (&record_insn_history_size_setshow_var,
701 &record_insn_history_size);
702}
703
704/* Called by do_setshow_command. We only want values in the
705 [0..INT_MAX] range, while the command's machinery accepts
706 [0..UINT_MAX]. See command_size_to_target_size. */
707
708static void
709set_record_call_history_size (char *args, int from_tty,
710 struct cmd_list_element *c)
711{
712 validate_history_size (&record_call_history_size_setshow_var,
713 &record_call_history_size);
714}
715
70221824
PA
716/* Provide a prototype to silence -Wmissing-prototypes. */
717extern initialize_file_ftype _initialize_record;
718
69d05d38
HZ
719void
720_initialize_record (void)
721{
0156b218
MS
722 struct cmd_list_element *c;
723
ccce17b0
YQ
724 add_setshow_zuinteger_cmd ("record", no_class, &record_debug,
725 _("Set debugging of record/replay feature."),
726 _("Show debugging of record/replay feature."),
727 _("When enabled, debugging output for "
728 "record/replay feature is displayed."),
729 NULL, show_record_debug, &setdebuglist,
730 &showdebuglist);
69d05d38 731
67c86d06 732 add_setshow_uinteger_cmd ("instruction-history-size", no_class,
42c634cb 733 &record_insn_history_size_setshow_var, _("\
67c86d06 734Set number of instructions to print in \"record instruction-history\"."), _("\
f81d1120
PA
735Show number of instructions to print in \"record instruction-history\"."), _("\
736A size of \"unlimited\" means unlimited instructions. The default is 10."),
42c634cb
PA
737 set_record_insn_history_size, NULL,
738 &set_record_cmdlist, &show_record_cmdlist);
67c86d06 739
15984c13 740 add_setshow_uinteger_cmd ("function-call-history-size", no_class,
42c634cb 741 &record_call_history_size_setshow_var, _("\
15984c13 742Set number of function to print in \"record function-call-history\"."), _("\
f81d1120
PA
743Show number of functions to print in \"record function-call-history\"."), _("\
744A size of \"unlimited\" means unlimited lines. The default is 10."),
42c634cb
PA
745 set_record_call_history_size, NULL,
746 &set_record_cmdlist, &show_record_cmdlist);
15984c13 747
0156b218 748 c = add_prefix_cmd ("record", class_obscure, cmd_record_start,
d02ed0bb 749 _("Start recording."),
0156b218
MS
750 &record_cmdlist, "record ", 0, &cmdlist);
751 set_cmd_completer (c, filename_completer);
752
69d05d38
HZ
753 add_com_alias ("rec", "record", class_obscure, 1);
754 add_prefix_cmd ("record", class_support, set_record_command,
755 _("Set record options"), &set_record_cmdlist,
756 "set record ", 0, &setlist);
757 add_alias_cmd ("rec", "record", class_obscure, 1, &setlist);
758 add_prefix_cmd ("record", class_support, show_record_command,
759 _("Show record options"), &show_record_cmdlist,
760 "show record ", 0, &showlist);
761 add_alias_cmd ("rec", "record", class_obscure, 1, &showlist);
762 add_prefix_cmd ("record", class_support, info_record_command,
763 _("Info record options"), &info_record_cmdlist,
764 "info record ", 0, &infolist);
765 add_alias_cmd ("rec", "record", class_obscure, 1, &infolist);
766
0156b218
MS
767 c = add_cmd ("save", class_obscure, cmd_record_save,
768 _("Save the execution log to a file.\n\
769Argument is optional filename.\n\
770Default filename is 'gdb_record.<process_id>'."),
771 &record_cmdlist);
772 set_cmd_completer (c, filename_completer);
773
69d05d38
HZ
774 add_cmd ("delete", class_obscure, cmd_record_delete,
775 _("Delete the rest of execution log and start recording it anew."),
776 &record_cmdlist);
777 add_alias_cmd ("d", "delete", class_obscure, 1, &record_cmdlist);
778 add_alias_cmd ("del", "delete", class_obscure, 1, &record_cmdlist);
779
780 add_cmd ("stop", class_obscure, cmd_record_stop,
781 _("Stop the record/replay target."),
782 &record_cmdlist);
783 add_alias_cmd ("s", "stop", class_obscure, 1, &record_cmdlist);
784
742ce053 785 add_prefix_cmd ("goto", class_obscure, cmd_record_goto, _("\
6b04bdb7
MS
786Restore the program to its state at instruction number N.\n\
787Argument is instruction number, as shown by 'info record'."),
742ce053
MM
788 &record_goto_cmdlist, "record goto ", 1, &record_cmdlist);
789
790 add_cmd ("begin", class_obscure, cmd_record_goto_begin,
791 _("Go to the beginning of the execution log."),
792 &record_goto_cmdlist);
793 add_alias_cmd ("start", "begin", class_obscure, 1, &record_goto_cmdlist);
794
795 add_cmd ("end", class_obscure, cmd_record_goto_end,
796 _("Go to the end of the execution log."),
797 &record_goto_cmdlist);
67c86d06
MM
798
799 add_cmd ("instruction-history", class_obscure, cmd_record_insn_history, _("\
800Print disassembled instructions stored in the execution log.\n\
801With a /m modifier, source lines are included (if available).\n\
802With a /r modifier, raw instructions in hex are included.\n\
803With a /f modifier, function names are omitted.\n\
946287b7 804With a /p modifier, current position markers are omitted.\n\
67c86d06
MM
805With no argument, disassembles ten more instructions after the previous \
806disassembly.\n\
807\"record instruction-history -\" disassembles ten instructions before a \
808previous disassembly.\n\
809One argument specifies an instruction number as shown by 'info record', and \
810ten instructions are disassembled after that instruction.\n\
811Two arguments with comma between them specify starting and ending instruction \
812numbers to disassemble.\n\
813If the second argument is preceded by '+' or '-', it specifies the distance \
814from the first argument.\n\
815The number of instructions to disassemble can be defined with \"set record \
816instruction-history-size\"."),
817 &record_cmdlist);
15984c13
MM
818
819 add_cmd ("function-call-history", class_obscure, cmd_record_call_history, _("\
820Prints the execution history at function granularity.\n\
821It prints one line for each sequence of instructions that belong to the same \
822function.\n\
823Without modifiers, it prints the function name.\n\
824With a /l modifier, the source file and line number range is included.\n\
825With a /i modifier, the instruction number range is included.\n\
8710b709 826With a /c modifier, the output is indented based on the call stack depth.\n\
15984c13
MM
827With no argument, prints ten more lines after the previous ten-line print.\n\
828\"record function-call-history -\" prints ten lines before a previous ten-line \
829print.\n\
830One argument specifies a function number as shown by 'info record', and \
831ten lines are printed after that function.\n\
832Two arguments with comma between them specify a range of functions to print.\n\
833If the second argument is preceded by '+' or '-', it specifies the distance \
834from the first argument.\n\
835The number of functions to print can be defined with \"set record \
836function-call-history-size\"."),
837 &record_cmdlist);
42c634cb
PA
838
839 /* Sync command control variables. */
840 record_insn_history_size_setshow_var = record_insn_history_size;
841 record_call_history_size_setshow_var = record_call_history_size;
69d05d38 842}
This page took 0.623957 seconds and 4 git commands to generate.