1 /* MI Command Set - symbol commands.
2 Copyright (C) 2003-2016 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program 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 3 of the License, or
9 (at your option) any later version.
11 This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
25 /* Print the list of all pc addresses and lines of code for the
26 provided (full or base) source file name. The entries are sorted
27 in ascending PC order. */
30 mi_cmd_symbol_list_lines (char *command
, char **argv
, int argc
)
32 struct gdbarch
*gdbarch
;
36 struct cleanup
*cleanup_stack
, *cleanup_tuple
;
37 struct ui_out
*uiout
= current_uiout
;
40 error (_("-symbol-list-lines: Usage: SOURCE_FILENAME"));
43 s
= lookup_symtab (filename
);
46 error (_("-symbol-list-lines: Unknown source file name."));
48 /* Now, dump the associated line table. The pc addresses are
49 already sorted by increasing values in the symbol table, so no
50 need to perform any other sorting. */
52 gdbarch
= get_objfile_arch (SYMTAB_OBJFILE (s
));
53 cleanup_stack
= make_cleanup_ui_out_list_begin_end (uiout
, "lines");
55 if (SYMTAB_LINETABLE (s
) != NULL
&& SYMTAB_LINETABLE (s
)->nitems
> 0)
56 for (i
= 0; i
< SYMTAB_LINETABLE (s
)->nitems
; i
++)
58 cleanup_tuple
= make_cleanup_ui_out_tuple_begin_end (uiout
, NULL
);
59 ui_out_field_core_addr (uiout
, "pc", gdbarch
,
60 SYMTAB_LINETABLE (s
)->item
[i
].pc
);
61 ui_out_field_int (uiout
, "line", SYMTAB_LINETABLE (s
)->item
[i
].line
);
62 do_cleanups (cleanup_tuple
);
65 do_cleanups (cleanup_stack
);
This page took 0.042137 seconds and 4 git commands to generate.