|
|
1.1 root 1: /* Memory-access and commands for inferior process, for GDB.
2: Copyright (C) 1986, 1987, 1988 Free Software Foundation, Inc.
3:
4: GDB is distributed in the hope that it will be useful, but WITHOUT ANY
5: WARRANTY. No author or distributor accepts responsibility to anyone
6: for the consequences of using it or for whether it serves any
7: particular purpose or works at all, unless he says so in writing.
8: Refer to the GDB General Public License for full details.
9:
10: Everyone is granted permission to copy, modify and redistribute GDB,
11: but only under the conditions described in the GDB General Public
12: License. A copy of this license is supposed to have been given to you
13: along with GDB so you can know your rights and responsibilities. It
14: should be in a file named COPYING. Among other things, the copyright
15: notice and this notice must be preserved on all copies.
16:
17: In other words, go ahead and share GDB, but don't try to stop
18: anyone else from sharing it farther. Help stamp out software hoarding!
19: */
20:
21: #include "defs.h"
22: #include "initialize.h"
23: #include "symtab.h"
24: #include "param.h"
25: #include "frame.h"
26: #include "inferior.h"
27: #include "environ.h"
28: #include "value.h"
29:
30: #include <stdio.h>
31: #include <signal.h>
32: #include <sys/param.h>
33:
34: extern char *sys_siglist[];
35:
36: #define ERROR_NO_INFERIOR \
37: if (inferior_pid == 0) error ("The program is not being run.");
38:
39: /* String containing arguments to give to the program,
40: with a space added at the front. Just a space means no args. */
41:
42: static char *inferior_args;
43:
44: /* File name for default use for standard in/out in the inferior. */
45:
46: char *inferior_io_terminal;
47:
48: /* Pid of our debugged inferior, or 0 if no inferior now. */
49:
50: int inferior_pid;
51:
52: /* Last signal that the inferior received (why it stopped). */
53:
54: int stop_signal;
55:
56: /* Address at which inferior stopped. */
57:
58: CORE_ADDR stop_pc;
59:
60: /* Stack frame when program stopped. */
61:
62: FRAME stop_frame;
63:
64: /* Number of breakpoint it stopped at, or 0 if none. */
65:
66: int stop_breakpoint;
67:
68: /* Nonzero if stopped due to a step command. */
69:
70: int stop_step;
71:
72: /* Nonzero if stopped due to completion of a stack dummy routine. */
73:
74: int stop_stack_dummy;
75:
76: /* Range to single step within.
77: If this is nonzero, respond to a single-step signal
78: by continuing to step if the pc is in this range. */
79:
80: CORE_ADDR step_range_start; /* Inclusive */
81: CORE_ADDR step_range_end; /* Exclusive */
82:
83: /* Stack frame address as of when stepping command was issued.
84: This is how we know when we step into a subroutine call,
85: and how to set the frame for the breakpoint used to step out. */
86:
87: CORE_ADDR step_frame;
88:
89: /* 1 means step over all subroutine calls.
90: -1 means step over calls to undebuggable functions. */
91:
92: int step_over_calls;
93:
94: /* If stepping, nonzero means step count is > 1
95: so don't print frame next time inferior stops
96: if it stops due to stepping. */
97:
98: int step_multi;
99:
100: /* Environment to use for running inferior,
101: in format described in environ.h. */
102:
103: struct environ *inferior_environ;
104:
105: CORE_ADDR read_pc ();
106: struct command_line *get_breakpoint_commands ();
107:
108: START_FILE
109:
110: int
111: have_inferior_p ()
112: {
113: return inferior_pid != 0;
114: }
115:
116: static void
117: set_args_command (args)
118: char *args;
119: {
120: free (inferior_args);
121: if (!args) args = "";
122: inferior_args = concat (" ", args, "");
123: }
124:
125: void
126: tty_command (file)
127: char *file;
128: {
129: if (file == 0)
130: error_no_arg ("terminal name for running target process");
131:
132: inferior_io_terminal = savestring (file, strlen (file));
133: }
134:
135: static void
136: run_command (args, from_tty)
137: char *args;
138: int from_tty;
139: {
140: extern char **environ;
141: register int i;
142: char *exec_file;
143: char *allargs;
144:
145: extern int sys_nerr;
146: extern char *sys_errlist[];
147: extern int errno;
148:
149: dont_repeat ();
150:
151: if (inferior_pid)
152: {
153: if (query ("The program being debugged has been started already.\n\
154: Start it from the beginning? "))
155: kill_inferior ();
156: else
157: error ("Program already started.");
158: }
159:
160: if (remote_debugging)
161: {
162: free (allargs);
163: if (from_tty)
164: {
165: printf ("Starting program: %s%s\n",
166: exec_file, inferior_args);
167: fflush (stdout);
168: }
169: }
170: else
171: {
172: if (args)
173: set_args_command (args);
174:
175: exec_file = (char *) get_exec_file (1);
176: if (from_tty)
177: {
178: printf ("Starting program: %s%s\n",
179: exec_file, inferior_args);
180: fflush (stdout);
181: }
182:
183: allargs = concat ("exec ", exec_file, inferior_args);
184: inferior_pid = create_inferior (allargs, environ_vector (inferior_environ));
185: }
186:
187: clear_proceed_status ();
188:
189: start_inferior ();
190: }
191:
192: void
193: cont_command (proc_count_exp, from_tty)
194: char *proc_count_exp;
195: int from_tty;
196: {
197: ERROR_NO_INFERIOR;
198:
199: clear_proceed_status ();
200:
201: /* If have argument, set proceed count of breakpoint we stopped at. */
202:
203: if (stop_breakpoint && proc_count_exp)
204: {
205: set_ignore_count (stop_breakpoint,
206: parse_and_eval_address (proc_count_exp) - 1,
207: from_tty);
208: if (from_tty)
209: printf (" ");
210: }
211:
212: if (from_tty)
213: printf ("Continuing.\n");
214:
215: proceed (-1, -1, 0);
216: }
217:
218: /* Step until outside of current statement. */
219: static void step_1 ();
220:
221: static void
222: step_command (count_string)
223: {
224: step_1 (0, 0, count_string);
225: }
226:
227: /* Likewise, but skip over subroutine calls as if single instructions. */
228:
229: static void
230: next_command (count_string)
231: {
232: step_1 (1, 0, count_string);
233: }
234:
235: /* Likewise, but step only one instruction. */
236:
237: static void
238: stepi_command (count_string)
239: {
240: step_1 (0, 1, count_string);
241: }
242:
243: static void
244: nexti_command (count_string)
245: {
246: step_1 (1, 1, count_string);
247: }
248:
249: static void
250: step_1 (skip_subroutines, single_inst, count_string)
251: int skip_subroutines;
252: int single_inst;
253: char *count_string;
254: {
255: register int count = 1;
256:
257: ERROR_NO_INFERIOR;
258: count = count_string ? parse_and_eval_address (count_string) : 1;
259:
260: for (; count > 0; count--)
261: {
262: clear_proceed_status ();
263:
264: step_frame = get_current_frame ();
265:
266: if (! single_inst)
267: {
268: find_pc_line_pc_range (stop_pc, &step_range_start, &step_range_end);
269: if (step_range_end == 0)
270: {
271: terminal_ours ();
272: error ("Current function has no line number information.");
273: }
274: }
275: else
276: {
277: /* Say we are stepping, but stop after one insn whatever it does.
278: Don't step through subroutine calls even to undebuggable functions. */
279: step_range_start = step_range_end = 1;
280: if (!skip_subroutines)
281: step_over_calls = 0;
282: }
283:
284: if (skip_subroutines)
285: step_over_calls = 1;
286:
287: step_multi = (count > 1);
288: proceed (-1, -1, 1);
289: if (! stop_step)
290: break;
291: }
292: }
293:
294: /* Continue program at specified address. */
295:
296: static void
297: jump_command (arg, from_tty)
298: char *arg;
299: int from_tty;
300: {
301: register CORE_ADDR addr;
302: struct symtab_and_line sal;
303:
304: ERROR_NO_INFERIOR;
305:
306: if (!arg)
307: error_no_arg ("starting address");
308:
309: sal = decode_line_spec (arg, 1);
310:
311: if (sal.symtab == 0 && sal.pc == 0)
312: error ("No source file has been specified.");
313:
314: if (sal.pc == 0)
315: sal.pc = find_line_pc (sal.symtab, sal.line);
316:
317: {
318: struct symbol *fn = get_frame_function (get_current_frame ());
319: struct symbol *sfn = find_pc_function (sal.pc);
320: if (fn != 0 && sfn != fn
321: && ! query ("Line %d is not in `%s'. Jump anyway? ",
322: sal.line, SYMBOL_NAME (fn)))
323: error ("Not confirmed.");
324: }
325:
326: if (sal.pc == 0)
327: error ("No line %d in file \"%s\".", sal.line, sal.symtab->filename);
328:
329: addr = sal.pc;
330:
331: clear_proceed_status ();
332:
333: if (from_tty)
334: printf ("Continuing at 0x%x.\n", addr);
335:
336: proceed (addr, 0, 0);
337: }
338:
339: /* Continue program giving it specified signal. */
340:
341: static void
342: signal_command (signum_exp, from_tty)
343: char *signum_exp;
344: int from_tty;
345: {
346: register int signum;
347:
348: dont_repeat (); /* Too dangerous. */
349: ERROR_NO_INFERIOR;
350:
351: if (!signum_exp)
352: error_no_arg ("signal number");
353:
354: signum = parse_and_eval_address (signum_exp);
355:
356: clear_proceed_status ();
357:
358: if (from_tty)
359: printf ("Continuing with signal %d.\n", signum);
360:
361: proceed (stop_pc, signum, 0);
362: }
363:
364: /* Execute a "stack dummy", a piece of code stored in the stack
365: by the debugger to be executed in the inferior.
366:
367: To call: first, do PUSH_DUMMY_FRAME.
368: Then push the contents of the dummy. It should end with a breakpoint insn.
369: Then call here, passing address at which to start the dummy.
370:
371: The contents of all registers are saved before the dummy frame is popped
372: and copied into the buffer BUFFER.
373:
374: The dummy's frame is automatically popped whenever that break is hit.
375: If that is the first time the program stops, run_stack_dummy
376: returns to its caller with that frame already gone.
377: Otherwise, the caller never gets returned to. */
378:
379: /* 4 => return instead of letting the stack dummy run. */
380:
381: static int stack_dummy_testing = 0;
382:
383: void
384: run_stack_dummy (addr, buffer)
385: CORE_ADDR addr;
386: REGISTER_TYPE *buffer;
387: {
388: int saved_pc_changed = pc_changed;
389: int saved_stop_signal = stop_signal;
390: int saved_stop_pc = stop_pc;
391: int saved_stop_frame = stop_frame;
392: int saved_stop_breakpoint = stop_breakpoint;
393: int saved_stop_step = stop_step;
394: int saved_stop_stack_dummy = stop_stack_dummy;
395: FRAME saved_selected_frame;
396: int saved_selected_level;
397: struct command_line *saved_breakpoint_commands
398: = get_breakpoint_commands ();
399:
400: record_selected_frame (&saved_selected_frame, &saved_selected_level);
401:
402: /* Now proceed, having reached the desired place. */
403: clear_proceed_status ();
404: if (stack_dummy_testing & 4)
405: {
406: POP_FRAME;
407: return;
408: }
409: proceed (addr, 0, 0);
410:
411: if (!stop_stack_dummy)
412: error ("Cannot continue previously requested operation.");
413:
414: set_breakpoint_commands (saved_breakpoint_commands);
415: select_frame (saved_selected_frame, saved_selected_level);
416: stop_signal = saved_stop_signal;
417: stop_pc = saved_stop_pc;
418: stop_frame = saved_stop_frame;
419: stop_breakpoint = saved_stop_breakpoint;
420: stop_step = saved_stop_step;
421: stop_stack_dummy = saved_stop_stack_dummy;
422: pc_changed = saved_pc_changed;
423:
424: /* On return, the stack dummy has been popped already. */
425:
426: bcopy (stop_registers, buffer, sizeof stop_registers);
427: }
428:
429: /* "finish": Set a temporary breakpoint at the place
430: the selected frame will return to, then continue. */
431:
432: static void
433: finish_command (arg, from_tty)
434: char *arg;
435: int from_tty;
436: {
437: struct symtab_and_line sal;
438: register FRAME frame;
439: struct frame_info fi;
440:
441: register struct symbol *function;
442:
443: if (!have_inferior_p ())
444: error ("The program is not being run.");
445: if (arg)
446: error ("The \"finish\" command does not take any arguments.");
447:
448: frame = get_prev_frame (selected_frame);
449: if (frame == 0)
450: error ("\"finish\" not meaningful in the outermost frame.");
451:
452: clear_proceed_status ();
453:
454: fi = get_frame_info (frame);
455: sal = find_pc_line (fi.pc, 0);
456: sal.pc = fi.pc;
457: set_momentary_breakpoint (sal, frame);
458:
459: /* Find the function we will return from. */
460:
461: fi = get_frame_info (fi.next_frame);
462: function = find_pc_function (fi.pc);
463:
464: if (from_tty)
465: {
466: printf ("Run till exit from ");
467: print_selected_frame ();
468: }
469:
470: proceed (-1, -1, 0);
471:
472: if (stop_breakpoint == -3 && function != 0)
473: {
474: struct type *value_type;
475: register value val;
476:
477: value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (function));
478: if (TYPE_CODE (value_type) == TYPE_CODE_VOID)
479: return;
480:
481: val = value_being_returned (value_type, stop_registers);
482: printf ("Value returned is $%d = ", record_latest_value (val));
483: value_print (val, stdout, 0);
484: putchar ('\n');
485: }
486: }
487:
488: static void
489: program_info ()
490: {
491: if (inferior_pid == 0)
492: {
493: printf ("The program being debugged is not being run.\n");
494: return;
495: }
496:
497: printf ("Program being debugged is in process %d, stopped at 0x%x.\n",
498: inferior_pid, stop_pc);
499: if (stop_step)
500: printf ("It stopped after being stepped.\n");
501: else if (stop_breakpoint)
502: printf ("It stopped at breakpoint %d.\n", stop_breakpoint);
503: else if (stop_signal)
504: printf ("It stopped with signal %d (%s).\n",
505: stop_signal, sys_siglist[stop_signal]);
506:
507: printf ("\nType \"info stack\" or \"info reg\" for more information.\n");
508: }
509:
510: static void
511: environment_info (var)
512: char *var;
513: {
514: if (var)
515: {
516: register char *val = get_in_environ (inferior_environ, var);
517: if (val)
518: printf ("%s = %s\n", var, val);
519: else
520: printf ("Environment variable \"%s\" not defined.\n", var);
521: }
522: else
523: {
524: register char **vector = environ_vector (inferior_environ);
525: while (*vector)
526: printf ("%s\n", *vector++);
527: }
528: }
529:
530: static void
531: set_environment_command (arg)
532: char *arg;
533: {
534: register char *p, *val, *var;
535:
536: if (arg == 0)
537: error_no_arg ("environment variable and value");
538:
539: p = (char *) index (arg, '=');
540: val = (char *) index (arg, ' ');
541: if (p != 0 && val != 0)
542: p = arg + min (p - arg, val - arg);
543: else if (val != 0 && p == 0)
544: p = val;
545:
546: if (p == 0)
547: error ("Space or \"=\" must separate variable name and its value");
548: if (p[1] == 0)
549: error_no_arg ("value for the variable");
550: if (p == arg)
551: error_no_arg ("environment variable to set");
552:
553: val = p + 1;
554: while (*val == ' ' || *val == '\t') val++;
555: while (p != arg && (p[-1] == ' ' || p[-1] == '\t')) p--;
556:
557: var = savestring (arg, p - arg);
558: set_in_environ (inferior_environ, var, val);
559: free (var);
560: }
561:
562: static void
563: unset_environment_command (var)
564: char *var;
565: {
566: if (var == 0)
567: error_no_arg ("environment variable");
568:
569: unset_in_environ (inferior_environ, var);
570: }
571:
572: /* Read an integer from debugged memory, given address and number of bytes. */
573:
574: read_memory_integer (memaddr, len)
575: CORE_ADDR memaddr;
576: int len;
577: {
578: char cbuf;
579: short sbuf;
580: int ibuf;
581: long lbuf;
582:
583: if (len == sizeof (char))
584: {
585: read_memory (memaddr, &cbuf, len);
586: return cbuf;
587: }
588: if (len == sizeof (short))
589: {
590: read_memory (memaddr, &sbuf, len);
591: return sbuf;
592: }
593: if (len == sizeof (int))
594: {
595: read_memory (memaddr, &ibuf, len);
596: return ibuf;
597: }
598: if (len == sizeof (lbuf))
599: {
600: read_memory (memaddr, &lbuf, len);
601: return lbuf;
602: }
603: error ("Cannot handle integers of %d bytes.", len);
604: }
605:
606: CORE_ADDR
607: read_pc ()
608: {
609: return (CORE_ADDR) read_register (PC_REGNUM);
610: }
611:
612: write_pc (val)
613: CORE_ADDR val;
614: {
615: write_register (PC_REGNUM, (long) val);
616: }
617:
618: char *reg_names[] = REGISTER_NAMES;
619:
620: static void
621: registers_info (addr_exp)
622: char *addr_exp;
623: {
624: register int i;
625: int regnum;
626:
627: if (addr_exp)
628: {
629: if (*addr_exp >= '0' && *addr_exp <= '9')
630: regnum = atoi (addr_exp);
631: else
632: {
633: register char *p = addr_exp;
634: if (p[0] == '$')
635: p++;
636: for (regnum = 0; regnum < NUM_REGS; regnum++)
637: if (!strcmp (p, reg_names[regnum]))
638: break;
639: if (regnum == NUM_REGS)
640: error ("%s: invalid register name.", addr_exp);
641: }
642: }
643: else
644: printf ("Reg\tContents\n\n");
645:
646: for (i = 0; i < NUM_REGS; i++)
647: {
648: unsigned char raw_buffer[MAX_REGISTER_RAW_SIZE];
649: unsigned char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE];
650: REGISTER_TYPE val;
651:
652: if (addr_exp != 0 && i != regnum)
653: continue;
654:
655: /* On machines with lots of registers, pause every 16 lines
656: so user can read the output. */
657: if (addr_exp == 0 && i > 0 && i % 16 == 0)
658: {
659: printf ("--Type Return to print more--");
660: fflush (stdout);
661: read_line ();
662: }
663:
664: /* Get the data in raw format, then convert also to virtual format. */
665: read_relative_register_raw_bytes (i, raw_buffer);
666: REGISTER_CONVERT_TO_VIRTUAL (i, raw_buffer, virtual_buffer);
667:
668: printf ("%s\t", reg_names[i]);
669:
670: /* If virtual format is floating, print it that way. */
671: if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT
672: && ! INVALID_FLOAT (virtual_buffer, REGISTER_VIRTUAL_SIZE (i)))
673: val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, stdout, 0);
674: /* Else if virtual format is too long for printf,
675: print in hex a byte at a time. */
676: else if (REGISTER_VIRTUAL_SIZE (i) > sizeof (long))
677: {
678: register int j;
679: printf ("0x");
680: for (j = 0; j < REGISTER_VIRTUAL_SIZE (i); j++)
681: printf ("%02x", virtual_buffer[j]);
682: }
683: /* Else print as integer in hex and in decimal. */
684: else
685: {
686: long val;
687:
688: bcopy (virtual_buffer, &val, sizeof (long));
689: if (val == 0)
690: printf ("0");
691: else
692: printf ("0x%08x %d", val, val);
693: }
694:
695: /* If register has different raw and virtual formats,
696: print the raw format in hex now. */
697:
698: if (REGISTER_CONVERTIBLE (i))
699: {
700: register int j;
701:
702: printf (" (raw 0x");
703: for (j = 0; j < REGISTER_RAW_SIZE (i); j++)
704: printf ("%02x", raw_buffer[j]);
705: printf (")");
706: }
707: printf ("\n");
708: }
709:
710: printf ("Contents are relative to selected stack frame.\n");
711: }
712:
713: #ifdef ATTACH_DETACH
714: /*
715: * TODO:
716: * Should save/restore the tty state since it might be that the
717: * program to be debugged was started on this tty and it wants
718: * the tty in some state other than what we want. If it's running
719: * on another terminal or without a terminal, then saving and
720: * restoring the tty state is a harmless no-op.
721: */
722:
723: /*
724: * attach_command --
725: * takes a program started up outside of gdb and ``attaches'' to it.
726: * This stops it cold in its tracks and allows us to start tracing it.
727: * For this to work, we must be able to send the process a
728: * signal and we must have the same effective uid as the program.
729: */
730: static void
731: attach_command (args, from_tty)
732: char *args;
733: int from_tty;
734: {
735: char *exec_file;
736: int pid;
737: int remote = 0;
738:
739: dont_repeat();
740:
741: if (!args)
742: error_no_arg ("process-id to attach");
743:
744: while (*args == ' ' || *args == '\t') args++;
745:
746: if (args[0] == '/')
747: remote = 1;
748: else
749: pid = atoi (args);
750:
751: if (inferior_pid)
752: {
753: if (query ("A program is being debugged already. Kill it? "))
754: kill_inferior ();
755: else
756: error ("Inferior not killed.");
757: }
758:
759: exec_file = (char *) get_exec_file (1);
760:
761: if (from_tty)
762: {
763: if (remote)
764: printf ("Attaching remote machine\n");
765: else
766: printf ("Attaching program: %s pid %d\n",
767: exec_file, pid);
768: fflush (stdout);
769: }
770:
771: if (remote)
772: {
773: remote_open (args, from_tty);
774: start_remote ();
775: }
776: else
777: attach_program (pid);
778: }
779:
780: /*
781: * detach_command --
782: * takes a program previously attached to and detaches it.
783: * The program resumes execution and will no longer stop
784: * on signals, etc. We better not have left any breakpoints
785: * in the program or it'll die when it hits one. For this
786: * to work, it may be necessary for the process to have been
787: * previously attached. It *might* work if the program was
788: * started via the normal ptrace (PTRACE_TRACEME).
789: */
790:
791: static void
792: detach_command (args, from_tty)
793: char *args;
794: int from_tty;
795: {
796: int signal = 0;
797:
798: if (!inferior_pid)
799: error ("Not currently tracing a program\n");
800: if (from_tty)
801: {
802: char *exec_file = (char *)get_exec_file (0);
803: if (exec_file == 0)
804: exec_file = "";
805: printf ("Detaching program: %s pid %d\n",
806: exec_file, inferior_pid);
807: fflush (stdout);
808: }
809: if (args)
810: signal = atoi (args);
811:
812: detach (signal);
813: inferior_pid = 0;
814: }
815: #endif /* ATTACH_DETACH */
816:
817: static
818: initialize ()
819: {
820: add_com ("tty", class_run, tty_command,
821: "Set terminal for future runs of program being debugged.");
822:
823: add_com ("set-args", class_run, set_args_command,
824: "Specify arguments to give program being debugged when it is started.\n\
825: Follow this command with any number of args, to be passed to the program.");
826:
827: add_info ("environment", environment_info,
828: "The environment to give the program, or one variable's value.\n\
829: With an argument VAR, prints the value of environment variable VAR to\n\
830: give the program being debugged. With no arguments, prints the entire\n\
831: environment to be given to the program.");
832:
833: add_com ("unset-environment", class_run, unset_environment_command,
834: "Cancel environment variable VAR for the program.\n\
835: This does not affect the program until the next \"run\" command.");
836: add_com ("set-environment", class_run, set_environment_command,
837: "Set environment variable value to give the program.\n\
838: Arguments are VAR VALUE where VAR is variable name and VALUE is value.\n\
839: VALUES of environment variables are uninterpreted strings.\n\
840: This does not affect the program until the next \"run\" command.");
841:
842: #ifdef ATTACH_DETACH
843: add_com ("attach", class_run, attach_command,
844: "Attach to a process that was started up outside of GDB.\n\
845: To do this, you must have permission to send the process a signal.\n\
846: And it must have the same effective uid as the debugger.\n\n\
847: Before using \"attach\", you must use the \"exec-file\" command\n\
848: to specify the program running in the process,\n\
849: and the \"symbol-file\" command to load its symbol table.");
850: add_com ("detach", class_run, detach_command,
851: "Detach the process previously attached.\n\
852: The process is no longer traced and continues its execution.");
853: #endif /* ATTACH_DETACH */
854:
855: add_com ("signal", class_run, signal_command,
856: "Continue program giving it signal number SIGNUMBER.");
857:
858: add_com ("stepi", class_run, stepi_command,
859: "Step one instruction exactly.\n\
860: Argument N means do this N times (or till program stops for another reason).");
861: add_com_alias ("si", "stepi", class_alias, 0);
862:
863: add_com ("nexti", class_run, nexti_command,
864: "Step one instruction, but proceed through subroutine calls.\n\
865: Argument N means do this N times (or till program stops for another reason).");
866: add_com_alias ("ni", "nexti", class_alias, 0);
867:
868: add_com ("finish", class_run, finish_command,
869: "Execute until selected stack frame returns.\n\
870: Upon return, the value returned is printed and put in the value history.");
871:
872: add_com ("next", class_run, next_command,
873: "Step program, proceeding through subroutine calls.\n\
874: Like the \"step\" command as long as subroutine calls do not happen;\n\
875: when they do, the call is treated as one instruction.\n\
876: Argument N means do this N times (or till program stops for another reason).");
877: add_com_alias ("n", "next", class_run, 1);
878:
879: add_com ("step", class_run, step_command,
880: "Step program until it reaches a different source line.\n\
881: Argument N means do this N times (or till program stops for another reason).");
882: add_com_alias ("s", "step", class_run, 1);
883:
884: add_com ("jump", class_run, jump_command,
885: "Continue program being debugged at specified line or address.\n\
886: Give as argument either LINENUM or *ADDR, where ADDR is an expression\n\
887: for an address to start at.");
888:
889: add_com ("cont", class_run, cont_command,
890: "Continue program being debugged, after signal or breakpoint.\n\
891: If proceeding from breakpoint, a number N may be used as an argument:\n\
892: then the same breakpoint won't break until the Nth time it is reached.");
893: add_com_alias ("c", "cont", class_run, 1);
894:
895: add_com ("run", class_run, run_command,
896: "Start debugged program. You may specify arguments to give it.\n\
897: Args may include \"*\", or \"[...]\"; they are expanded using \"sh\".\n\
898: Input and output redirection with \">\", \"<\", or \">>\" are also allowed.\n\n\
899: With no arguments, uses arguments last specified (with \"run\" or \"set-args\".\n\
900: To cancel previous arguments and run with no arguments,\n\
901: use \"set-args\" without arguments.");
902: add_com_alias ("r", "run", class_run, 1);
903:
904: add_info ("registers", registers_info,
905: "List of registers and their contents, for selected stack frame.\n\
906: Register name as argument means describe only that register.");
907:
908: add_info ("program", program_info,
909: "Execution status of the program.");
910:
911: inferior_args = savestring (" ", 1); /* By default, no args. */
912: inferior_environ = make_environ ();
913: init_environ (inferior_environ);
914: }
915:
916: END_FILE
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.