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