Index: source.c =================================================================== RCS file: /nile.c/cvs/Dev/gdb/gdb-5.3/gdb/source.c,v retrieving revision 1.2 diff -c -3 -p -r1.2 source.c *** source.c 16 Jan 2003 10:40:07 -0000 1.2 --- source.c 10 Mar 2003 01:41:30 -0000 *************** line_info (char *arg, int from_tty) *** 1438,1443 **** --- 1438,1477 ---- xfree (sals.sals); } + + /* Print the table of all pc addresses and lines of code + for the provided (full or base) source file name. */ + + static void + symbol_info_linetable_command (char *arg, int from_tty) + { + char *filename = arg; + struct symtab *s; + int i; + + if (filename == NULL) + error ("Missing source file name"); + + s = lookup_symtab (filename); + + if (s == NULL) + error ("Unknown source file"); + + printf_filtered ("^done,linetable=["); + + if (LINETABLE (s) != NULL && LINETABLE (s)->nitems > 0) + for (i = 0; i < LINETABLE (s)->nitems; i++) + { + printf_filtered ("{pc=\""); + print_address_numeric (LINETABLE (s)->item[i].pc, 1, gdb_stdout); + printf_filtered ("\",line=\"%d\"}", LINETABLE (s)->item[i].line); + if (i != LINETABLE (s)->nitems - 1) + printf_filtered (","); + } + + printf_filtered ("]\n"); + } + /* Commands to search the source file for a regexp. */ /* ARGSUSED */ *************** Default is to describe the last source l *** 1684,1689 **** --- 1718,1726 ---- This sets the default address for \"x\" to the line's first instruction\n\ so that \"x/i\" suffices to start examining the machine code.\n\ The address is also stored as the value of \"$_\".", NULL)); + + add_cmd ("-symbol-info-linetable", no_class, symbol_info_linetable_command, + "Print the line table for a given source file.", &cmdlist); add_com ("forward-search", class_files, forward_search_command, "Search for regular expression (see regex(3)) from last line listed.\n\