1 /* List lines of source files for GDB, the GNU debugger.
2 Copyright (C) 1986, 1987, 1988, 1989, 1991 Free Software Foundation, Inc.
4 This file is part of GDB.
6 GDB is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 1, or (at your option)
11 GDB is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GDB; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
29 #include <sys/types.h>
33 #include <sys/param.h>
38 extern char *strstr();
40 extern void set_next_address ();
44 /* Path of directories to search for source files.
45 Same format as the PATH environment variable's value. */
49 /* Symtab of default file for listing lines of. */
51 struct symtab
*current_source_symtab
;
53 /* Default next line to list. */
55 int current_source_line
;
57 /* Line number of last line printed. Default for various commands.
58 current_source_line is usually, but not always, the same as this. */
60 static int last_line_listed
;
62 /* First line number listed by last listing command. */
64 static int first_line_listed
;
67 /* Set the source file default for the "list" command, specifying a
68 symtab. Sigh. Behavior specification: If it is called with a
69 non-zero argument, that is the symtab to select. If it is not,
70 first lookup "main"; if it exists, use the symtab and line it
71 defines. If not, take the last symtab in the symtab_list (if it
72 exists) or the last symtab in the psymtab_list (if *it* exists). If
73 none of this works, report an error. */
76 select_source_symtab (s
)
77 register struct symtab
*s
;
79 struct symtabs_and_lines sals
;
80 struct symtab_and_line sal
;
81 struct partial_symtab
*ps
;
82 struct partial_symtab
*cs_pst
= 0;
86 current_source_symtab
= s
;
87 current_source_line
= 1;
91 /* Make the default place to list be the function `main'
93 if (lookup_symbol ("main", 0, VAR_NAMESPACE
, 0, NULL
))
95 sals
= decode_line_spec ("main", 1);
98 current_source_symtab
= sal
.symtab
;
99 current_source_line
= max (sal
.line
- (lines_to_list () - 1), 1);
103 /* All right; find the last file in the symtab list (ignoring .h's). */
109 char *name
= s
->filename
;
110 int len
= strlen (name
);
111 if (! (len
> 2 && !strcmp (&name
[len
- 2], ".h")))
112 current_source_symtab
= s
;
116 current_source_line
= 1;
118 else if (partial_symtab_list
)
120 ps
= partial_symtab_list
;
123 char *name
= ps
->filename
;
124 int len
= strlen (name
);
125 if (! (len
> 2 && !strcmp (&name
[len
- 2], ".h")))
131 fatal ("Internal: select_source_symtab: readin pst found and no symtabs.");
133 current_source_symtab
= PSYMTAB_TO_SYMTAB (cs_pst
);
135 current_source_symtab
= 0;
136 current_source_line
= 1;
143 printf ("Source directories searched: %s\n", source_path
);
146 /* Forget what we learned about line positions in source files,
147 and which directories contain them;
148 must check again now since files may be found in
149 a different directory now. */
152 forget_cached_source_info ()
154 register struct symtab
*s
;
156 for (s
= symtab_list
; s
; s
= s
->next
)
158 if (s
->line_charpos
!= 0)
160 free (s
->line_charpos
);
163 if (s
->fullname
!= 0)
174 source_path
= savestring ("$cdir:$cwd", /* strlen of it */ 10);
175 forget_cached_source_info ();
178 /* Add zero or more directories to the front of the source path. */
181 directory_command (dirname
, from_tty
)
186 /* FIXME, this goes to "delete dir"... */
189 if (query ("Reinitialize source path to empty? ", ""))
196 mod_path (dirname
, from_tty
, &source_path
);
199 forget_cached_source_info ();
202 /* Add zero or more directories to the front of an arbitrary path. */
205 mod_path (dirname
, from_tty
, which_path
)
210 char *old
= *which_path
;
216 dirname
= strsave (dirname
);
217 make_cleanup (free
, dirname
);
221 extern char *index ();
222 char *name
= dirname
;
227 char *colon
= index (name
, ':');
228 char *space
= index (name
, ' ');
229 char *tab
= index (name
, '\t');
230 if (colon
== 0 && space
== 0 && tab
== 0)
231 p
= dirname
= name
+ strlen (name
);
235 if (colon
!= 0 && (p
== 0 || colon
< p
))
237 if (space
!= 0 && (p
== 0 || space
< p
))
239 if (tab
!= 0 && (p
== 0 || tab
< p
))
242 while (*dirname
== ':' || *dirname
== ' ' || *dirname
== '\t')
248 /* Sigh. "foo/" => "foo" */
256 /* "." => getwd (). */
257 name
= current_directory
;
260 else if (p
[-2] == '/')
270 /* "...foo/." => "...foo". */
281 name
= tilde_expand (name
);
282 else if (name
[0] != '/' && name
[0] != '$')
283 name
= concat (current_directory
, "/", name
);
285 name
= savestring (name
, p
- name
);
286 make_cleanup (free
, name
);
288 /* Unless it's a variable, check existence. */
289 if (name
[0] != '$') {
290 if (stat (name
, &st
) < 0)
291 perror_with_name (name
);
292 if ((st
.st_mode
& S_IFMT
) != S_IFDIR
)
293 error ("%s is not a directory.", name
);
298 register unsigned int len
= strlen (name
);
303 if (!strncmp (p
, name
, len
)
304 && (p
[len
] == '\0' || p
[len
] == ':'))
306 /* Found it in the search path, remove old copy */
308 p
--; /* Back over leading colon */
309 if (prefix
> p
- *which_path
)
310 goto skip_dup
; /* Same dir twice in one cmd */
311 strcpy (p
, &p
[len
+1]); /* Copy from next \0 or : */
321 /* If we have already tacked on a name(s) in this command, be sure they stay on the front as we tack on some more. */
328 temp
= concat (old
, ":", name
);
330 *which_path
= concat (temp
, "", &old
[prefix
]);
331 prefix
= strlen (temp
);
336 *which_path
= concat (name
, (old
[0]? ":" : old
), old
);
337 prefix
= strlen (name
);
344 } while (*dirname
!= '\0');
351 register struct symtab
*s
= current_source_symtab
;
355 printf("No current source file.\n");
358 printf ("Current source file is %s\n", s
->filename
);
360 printf ("Compilation directory is %s\n", s
->dirname
);
362 printf ("Located in %s\n", s
->fullname
);
364 printf ("Contains %d lines\n", s
->nlines
);
366 switch (s
->language
) {
368 printf("Written in the C language.\n");
369 /* Add more cases here when -Wswitch complains... */
370 case language_unknown
:
377 /* Open a file named STRING, searching path PATH (dir names sep by colons)
378 using mode MODE and protection bits PROT in the calls to open.
379 If TRY_CWD_FIRST, try to open ./STRING before searching PATH.
380 (ie pretend the first element of PATH is ".")
381 If FILENAMED_OPENED is non-null, set it to a newly allocated string naming
382 the actual file opened (this string will always start with a "/". We
383 have to take special pains to avoid doubling the "/" between the directory
384 and the file, sigh! Emacs gets confuzzed by this when we print the
387 If a file is found, return the descriptor.
388 Otherwise, return -1, with errno set for the last name we tried to open. */
390 /* >>>> This should only allow files of certain types,
391 >>>> eg executable, non-directory */
393 openp (path
, try_cwd_first
, string
, mode
, prot
, filename_opened
)
399 char **filename_opened
;
402 register char *filename
;
403 register char *p
, *p1
;
411 while (string
[0] == '.' && string
[1] == '/')
414 if (try_cwd_first
|| string
[0] == '/')
417 fd
= open (filename
, mode
, prot
);
418 if (fd
>= 0 || string
[0] == '/')
422 alloclen
= strlen (path
) + strlen (string
) + 2;
423 filename
= (char *) alloca (alloclen
);
425 for (p
= path
; p
; p
= p1
? p1
+ 1 : 0)
427 p1
= (char *) index (p
, ':');
433 if (len
== 4 && p
[0] == '$' && p
[1] == 'c'
434 && p
[2] == 'w' && p
[3] == 'd') {
435 /* Name is $cwd -- insert current directory name instead. */
438 /* First, realloc the filename buffer if too short. */
439 len
= strlen (current_directory
);
440 newlen
= len
+ strlen (string
) + 2;
441 if (newlen
> alloclen
) {
443 filename
= (char *) alloca (alloclen
);
445 strcpy (filename
, current_directory
);
447 /* Normal file name in path -- just use it. */
448 strncpy (filename
, p
, len
);
452 /* Beware the // my son, the Emacs barfs, the botch that catch... */
453 while (len
> 1 && filename
[len
-1] == '/')
455 strcat (filename
+len
, "/");
456 strcat (filename
, string
);
458 fd
= open (filename
, mode
, prot
);
465 *filename_opened
= (char *) 0;
466 else if (filename
[0] == '/')
467 *filename_opened
= savestring (filename
, strlen (filename
));
470 /* Beware the // my son, the Emacs barfs, the botch that catch... */
472 *filename_opened
= concat (current_directory
,
473 '/' == current_directory
[strlen(current_directory
)-1]? "": "/",
480 /* Open a source file given a symtab S. Returns a file descriptor
481 or negative number for error. */
486 char *path
= source_path
;
490 /* Quick way out if we already know its full name */
493 result
= open (s
->fullname
, O_RDONLY
);
496 /* Didn't work -- free old one, try again. */
501 if (s
->dirname
!= NULL
)
503 /* Replace a path entry of $cdir with the compilation directory name */
505 p
= strstr (source_path
, "$cdir");
506 if (p
&& (p
== path
|| p
[-1] == ':')
507 && (p
[cdir_len
] == ':' || p
[cdir_len
] == '\0')) {
511 alloca (strlen (source_path
) + 1 + strlen (s
->dirname
) + 1);
512 len
= p
- source_path
;
513 strncpy (path
, source_path
, len
); /* Before $cdir */
514 strcpy (path
+ len
, s
->dirname
); /* new stuff */
515 strcat (path
+ len
, source_path
+ len
+ cdir_len
); /* After $cdir */
519 return openp (path
, 0, s
->filename
, O_RDONLY
, 0, &s
->fullname
);
523 /* Create and initialize the table S->line_charpos that records
524 the positions of the lines in the source file, which is assumed
525 to be open on descriptor DESC.
526 All set S->nlines to the number of such lines. */
529 find_source_lines (s
, desc
)
534 register char *data
, *p
, *end
;
536 int lines_allocated
= 1000;
537 int *line_charpos
= (int *) xmalloc (lines_allocated
* sizeof (int));
539 if (fstat (desc
, &st
) < 0)
540 perror_with_name (s
->filename
);
541 if (exec_bfd
&& bfd_get_mtime(exec_bfd
) < st
.st_mtime
)
542 printf ("Source file is more recent than executable.\n");
544 #if defined (BROKEN_LARGE_ALLOCA)
545 data
= (char *) xmalloc (st
.st_size
);
546 make_cleanup (free
, data
);
548 data
= (char *) alloca (st
.st_size
);
550 if (myread (desc
, data
, st
.st_size
) < 0)
551 perror_with_name (s
->filename
);
552 end
= data
+ st
.st_size
;
559 /* A newline at the end does not start a new line. */
562 if (nlines
== lines_allocated
)
564 lines_allocated
*= 2;
565 line_charpos
= (int *) xrealloc (line_charpos
,
566 sizeof (int) * lines_allocated
);
568 line_charpos
[nlines
++] = p
- data
;
572 s
->line_charpos
= (int *) xrealloc (line_charpos
, nlines
* sizeof (int));
575 /* Return the character position of a line LINE in symtab S.
576 Return 0 if anything is invalid. */
579 source_line_charpos (s
, line
)
584 if (!s
->line_charpos
|| line
<= 0) return 0;
585 if (line
> s
->nlines
)
587 return s
->line_charpos
[line
- 1];
590 /* Return the line number of character position POS in symtab S. */
593 source_charpos_line (s
, chr
)
594 register struct symtab
*s
;
597 register int line
= 0;
600 if (s
== 0 || s
->line_charpos
== 0) return 0;
601 lnp
= s
->line_charpos
;
602 /* Files are usually short, so sequential search is Ok */
603 while (line
< s
->nlines
&& *lnp
<= chr
)
608 if (line
>= s
->nlines
)
613 /* Get full pathname and line number positions for a symtab.
614 Return nonzero if line numbers may have changed.
615 Set *FULLNAME to actual name of the file as found by `openp',
616 or to 0 if the file is not found. */
619 get_filename_and_charpos (s
, fullname
)
623 register int desc
, linenums_changed
= 0;
625 desc
= open_source_file (s
);
633 *fullname
= s
->fullname
;
634 if (s
->line_charpos
== 0) linenums_changed
= 1;
635 if (linenums_changed
) find_source_lines (s
, desc
);
637 return linenums_changed
;
640 /* Print text describing the full name of the source file S
641 and the line number LINE and its corresponding character position.
642 The text starts with two Ctrl-z so that the Emacs-GDB interface
645 MID_STATEMENT is nonzero if the PC is not at the beginning of that line.
647 Return 1 if successful, 0 if could not find the file. */
650 identify_source_line (s
, line
, mid_statement
)
655 if (s
->line_charpos
== 0)
656 get_filename_and_charpos (s
, (char **)NULL
);
657 if (s
->fullname
== 0)
659 printf ("\032\032%s:%d:%d:%s:0x%x\n", s
->fullname
,
660 line
, s
->line_charpos
[line
- 1],
661 mid_statement
? "middle" : "beg",
662 get_frame_pc (get_current_frame()));
663 current_source_line
= line
;
664 first_line_listed
= line
;
665 last_line_listed
= line
;
666 current_source_symtab
= s
;
670 /* Print source lines from the file of symtab S,
671 starting with line number LINE and stopping before line number STOPLINE. */
674 print_source_lines (s
, line
, stopline
, noerror
)
681 register FILE *stream
;
682 int nlines
= stopline
- line
;
684 /* Regardless of whether we can open the file, set current_source_symtab. */
685 current_source_symtab
= s
;
686 current_source_line
= line
;
687 first_line_listed
= line
;
689 desc
= open_source_file (s
);
693 char *name
= alloca (strlen (s
->filename
) + 100);
694 sprintf (name
, "%s:%d", s
->filename
, line
);
695 print_sys_errmsg (name
, errno
);
700 if (s
->line_charpos
== 0)
701 find_source_lines (s
, desc
);
703 if (line
< 1 || line
> s
->nlines
)
706 error ("Line number %d out of range; %s has %d lines.",
707 line
, s
->filename
, s
->nlines
);
710 if (lseek (desc
, s
->line_charpos
[line
- 1], 0) < 0)
713 perror_with_name (s
->filename
);
716 stream
= fdopen (desc
, "r");
723 last_line_listed
= current_source_line
;
724 printf_filtered ("%d\t", current_source_line
++);
727 if (c
< 040 && c
!= '\t' && c
!= '\n')
728 printf_filtered ("^%c", c
+ 0100);
730 printf_filtered ("^?");
732 printf_filtered ("%c", c
);
733 } while (c
!= '\n' && (c
= fgetc (stream
)) >= 0);
743 Print a list of files and line numbers which a user may choose from
744 in order to list a function which was specified ambiguously
745 (as with `list classname::overloadedfuncname', for example).
746 The vector in SALS provides the filenames and line numbers.
749 ambiguous_line_spec (sals
)
750 struct symtabs_and_lines
*sals
;
754 for (i
= 0; i
< sals
->nelts
; ++i
)
755 printf("file: \"%s\", line number: %d\n",
756 sals
->sals
[i
].symtab
->filename
, sals
->sals
[i
].line
);
761 list_command (arg
, from_tty
)
765 struct symtabs_and_lines sals
, sals_end
;
766 struct symtab_and_line sal
, sal_end
;
775 if (symtab_list
== 0 && partial_symtab_list
== 0)
776 error ("No symbol table is loaded. Use the \"symbol-file\" command.");
778 /* Pull in a current source symtab if necessary */
779 if (current_source_symtab
== 0 &&
780 (arg
== 0 || arg
[0] == '+' || arg
[0] == '-'))
781 select_source_symtab (0);
783 /* "l" or "l +" lists next ten lines. */
785 if (arg
== 0 || !strcmp (arg
, "+"))
787 if (current_source_symtab
== 0)
788 error ("No default source file yet. Do \"help list\".");
789 print_source_lines (current_source_symtab
, current_source_line
,
790 current_source_line
+ lines_to_list (), 0);
794 /* "l -" lists previous ten lines, the ones before the ten just listed. */
795 if (!strcmp (arg
, "-"))
797 if (current_source_symtab
== 0)
798 error ("No default source file yet. Do \"help list\".");
799 print_source_lines (current_source_symtab
,
800 max (first_line_listed
- lines_to_list (), 1),
801 first_line_listed
, 0);
805 /* Now if there is only one argument, decode it in SAL
807 If there are two arguments, decode them in SAL and SAL_END
808 and clear NO_END; however, if one of the arguments is blank,
809 set DUMMY_BEG or DUMMY_END to record that fact. */
816 sals
= decode_line_1 (&arg1
, 0, 0, 0);
818 if (! sals
.nelts
) return; /* C++ */
821 ambiguous_line_spec (&sals
);
830 /* Record whether the BEG arg is all digits. */
832 for (p
= arg
; p
!= arg1
&& *p
>= '0' && *p
<= '9'; p
++);
833 linenum_beg
= (p
== arg1
);
835 while (*arg1
== ' ' || *arg1
== '\t')
841 while (*arg1
== ' ' || *arg1
== '\t')
848 sals_end
= decode_line_1 (&arg1
, 0, 0, 0);
850 sals_end
= decode_line_1 (&arg1
, 0, sal
.symtab
, sal
.line
);
851 if (sals_end
.nelts
== 0)
853 if (sals_end
.nelts
> 1)
855 ambiguous_line_spec (&sals_end
);
856 free (sals_end
.sals
);
859 sal_end
= sals_end
.sals
[0];
860 free (sals_end
.sals
);
865 error ("Junk at end of line specification.");
867 if (!no_end
&& !dummy_beg
&& !dummy_end
868 && sal
.symtab
!= sal_end
.symtab
)
869 error ("Specified start and end are in different files.");
870 if (dummy_beg
&& dummy_end
)
871 error ("Two empty args do not say what lines to list.");
873 /* if line was specified by address,
874 first print exactly which line, and which file.
875 In this case, sal.symtab == 0 means address is outside
876 of all known source files, not that user failed to give a filename. */
880 error ("No source file for address 0x%x.", sal
.pc
);
881 sym
= find_pc_function (sal
.pc
);
883 printf ("0x%x is in %s (%s, line %d).\n",
884 sal
.pc
, SYMBOL_NAME (sym
), sal
.symtab
->filename
, sal
.line
);
886 printf ("0x%x is in %s, line %d.\n",
887 sal
.pc
, sal
.symtab
->filename
, sal
.line
);
890 /* If line was not specified by just a line number,
891 and it does not imply a symtab, it must be an undebuggable symbol
892 which means no source code. */
894 if (! linenum_beg
&& sal
.symtab
== 0)
895 error ("No line number known for %s.", arg
);
897 /* If this command is repeated with RET,
898 turn it into the no-arg variant. */
903 if (dummy_beg
&& sal_end
.symtab
== 0)
904 error ("No default source file yet. Do \"help list\".");
906 print_source_lines (sal_end
.symtab
,
907 max (sal_end
.line
- (lines_to_list () - 1), 1),
908 sal_end
.line
+ 1, 0);
909 else if (sal
.symtab
== 0)
910 error ("No default source file yet. Do \"help list\".");
912 print_source_lines (sal
.symtab
,
913 max (sal
.line
- (lines_to_list () / 2), 1),
914 sal
.line
+ (lines_to_list() / 2), 0);
916 print_source_lines (sal
.symtab
, sal
.line
,
918 ? sal
.line
+ lines_to_list ()
923 /* Print info on range of pc's in a specified line. */
926 line_info (arg
, from_tty
)
930 struct symtabs_and_lines sals
;
931 struct symtab_and_line sal
;
932 CORE_ADDR start_pc
, end_pc
;
937 sal
.symtab
= current_source_symtab
;
938 sal
.line
= last_line_listed
;
940 sals
.sals
= (struct symtab_and_line
*)
941 xmalloc (sizeof (struct symtab_and_line
));
946 sals
= decode_line_spec_1 (arg
, 0);
948 /* If this command is repeated with RET,
949 turn it into the no-arg variant. */
954 /* C++ More than one line may have been specified, as when the user
955 specifies an overloaded function name. Print info on them all. */
956 for (i
= 0; i
< sals
.nelts
; i
++)
961 error ("No source file specified.");
964 && find_line_pc_range (sal
.symtab
, sal
.line
, &start_pc
, &end_pc
))
966 if (start_pc
== end_pc
)
967 printf ("Line %d of \"%s\" is at pc 0x%x but contains no code.\n",
968 sal
.line
, sal
.symtab
->filename
, start_pc
);
970 printf ("Line %d of \"%s\" starts at pc 0x%x and ends at 0x%x.\n",
971 sal
.line
, sal
.symtab
->filename
, start_pc
, end_pc
);
972 /* x/i should display this line's code. */
973 set_next_address (start_pc
);
974 /* Repeating "info line" should do the following line. */
975 last_line_listed
= sal
.line
+ 1;
978 printf ("Line number %d is out of range for \"%s\".\n",
979 sal
.line
, sal
.symtab
->filename
);
983 /* Commands to search the source file for a regexp. */
986 forward_search_command (regex
, from_tty
)
992 register FILE *stream
;
993 int line
= last_line_listed
+ 1;
996 msg
= (char *) re_comp (regex
);
1000 if (current_source_symtab
== 0)
1001 select_source_symtab (0);
1003 /* Search from last_line_listed+1 in current_source_symtab */
1005 desc
= open_source_file (current_source_symtab
);
1007 perror_with_name (current_source_symtab
->filename
);
1009 if (current_source_symtab
->line_charpos
== 0)
1010 find_source_lines (current_source_symtab
, desc
);
1012 if (line
< 1 || line
> current_source_symtab
->nlines
)
1015 error ("Expression not found");
1018 if (lseek (desc
, current_source_symtab
->line_charpos
[line
- 1], 0) < 0)
1021 perror_with_name (current_source_symtab
->filename
);
1024 stream
= fdopen (desc
, "r");
1027 char buf
[4096]; /* Should be reasonable??? */
1028 register char *p
= buf
;
1035 } while (c
!= '\n' && (c
= fgetc (stream
)) >= 0);
1037 /* we now have a source line in buf, null terminate and match */
1039 if (re_exec (buf
) > 0)
1043 print_source_lines (current_source_symtab
,
1045 current_source_line
= max (line
- lines_to_list () / 2, 1);
1051 printf ("Expression not found\n");
1056 reverse_search_command (regex
, from_tty
)
1062 register FILE *stream
;
1063 int line
= last_line_listed
- 1;
1066 msg
= (char *) re_comp (regex
);
1070 if (current_source_symtab
== 0)
1071 select_source_symtab (0);
1073 /* Search from last_line_listed-1 in current_source_symtab */
1075 desc
= open_source_file (current_source_symtab
);
1077 perror_with_name (current_source_symtab
->filename
);
1079 if (current_source_symtab
->line_charpos
== 0)
1080 find_source_lines (current_source_symtab
, desc
);
1082 if (line
< 1 || line
> current_source_symtab
->nlines
)
1085 error ("Expression not found");
1088 if (lseek (desc
, current_source_symtab
->line_charpos
[line
- 1], 0) < 0)
1091 perror_with_name (current_source_symtab
->filename
);
1094 stream
= fdopen (desc
, "r");
1098 char buf
[4096]; /* Should be reasonable??? */
1099 register char *p
= buf
;
1106 } while (c
!= '\n' && (c
= fgetc (stream
)) >= 0);
1108 /* We now have a source line in buf; null terminate and match. */
1110 if (re_exec (buf
) > 0)
1114 print_source_lines (current_source_symtab
,
1116 current_source_line
= max (line
- lines_to_list () / 2, 1);
1120 if (fseek (stream
, current_source_symtab
->line_charpos
[line
- 1], 0) < 0)
1123 perror_with_name (current_source_symtab
->filename
);
1127 printf ("Expression not found\n");
1133 _initialize_source ()
1135 current_source_symtab
= 0;
1136 init_source_path ();
1138 add_com ("directory", class_files
, directory_command
,
1139 "Add directory DIR to beginning of search path for source files.\n\
1140 Forget cached info on source file locations and line positions.\n\
1141 DIR can also be $cwd for the current working directory, or $cdir for the\n\
1142 directory in which the source file was compiled into object code.\n\
1143 With no argument, reset the search path to $cdir:$cwd, the default.");
1145 add_cmd ("directories", no_class
, show_directories
,
1146 "Current search path for finding source files.\n\
1147 $cwd in the path means the current working directory.\n\
1148 $cdir in the path means the compilation directory of the source file.",
1151 add_info ("source", source_info
,
1152 "Information about the current source file.");
1154 add_info ("line", line_info
,
1155 "Core addresses of the code for a source line.\n\
1156 Line can be specified as\n\
1157 LINENUM, to list around that line in current file,\n\
1158 FILE:LINENUM, to list around that line in that file,\n\
1159 FUNCTION, to list around beginning of that function,\n\
1160 FILE:FUNCTION, to distinguish among like-named static functions.\n\
1161 Default is to describe the last source line that was listed.\n\n\
1162 This sets the default address for \"x\" to the line's first instruction\n\
1163 so that \"x/i\" suffices to start examining the machine code.\n\
1164 The address is also stored as the value of \"$_\".");
1166 add_com ("forward-search", class_files
, forward_search_command
,
1167 "Search for regular expression (see regex(3)) from last line listed.");
1168 add_com_alias ("search", "forward-search", class_files
, 0);
1170 add_com ("reverse-search", class_files
, reverse_search_command
,
1171 "Search backward for regular expression (see regex(3)) from last line listed.");
1173 add_com ("list", class_files
, list_command
,
1174 "List specified function or line.\n\
1175 With no argument, lists ten more lines after or around previous listing.\n\
1176 \"list -\" lists the ten lines before a previous ten-line listing.\n\
1177 One argument specifies a line, and ten lines are listed around that line.\n\
1178 Two arguments with comma between specify starting and ending lines to list.\n\
1179 Lines can be specified in these ways:\n\
1180 LINENUM, to list around that line in current file,\n\
1181 FILE:LINENUM, to list around that line in that file,\n\
1182 FUNCTION, to list around beginning of that function,\n\
1183 FILE:FUNCTION, to distinguish among like-named static functions.\n\
1184 *ADDRESS, to list around the line containing that address.\n\
1185 With two args if one is empty it stands for ten lines away from the other arg.");
1186 add_com_alias ("l", "list", class_files
, 0);
This page took 0.065715 seconds and 5 git commands to generate.