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