Rename field_int to field_signed
[deliverable/binutils-gdb.git] / gdb / mi / mi-symbol-cmds.c
CommitLineData
0d18235f 1/* MI Command Set - symbol commands.
42a4f53d 2 Copyright (C) 2003-2019 Free Software Foundation, Inc.
0d18235f
JB
3
4 This file is part of GDB.
5
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
a9762ec7 8 the Free Software Foundation; either version 3 of the License, or
0d18235f
JB
9 (at your option) any later version.
10
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.
15
16 You should have received a copy of the GNU General Public License
a9762ec7 17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
0d18235f
JB
18
19#include "defs.h"
20#include "mi-cmds.h"
21#include "symtab.h"
5af949e3 22#include "objfiles.h"
0d18235f
JB
23#include "ui-out.h"
24
2b03b41d
SS
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. */
0d18235f 28
ce8f13f8 29void
9f33b8b7 30mi_cmd_symbol_list_lines (const char *command, char **argv, int argc)
0d18235f 31{
5af949e3 32 struct gdbarch *gdbarch;
0d18235f
JB
33 char *filename;
34 struct symtab *s;
35 int i;
79a45e25 36 struct ui_out *uiout = current_uiout;
0d18235f
JB
37
38 if (argc != 1)
1b05df00 39 error (_("-symbol-list-lines: Usage: SOURCE_FILENAME"));
0d18235f
JB
40
41 filename = argv[0];
42 s = lookup_symtab (filename);
43
44 if (s == NULL)
1b05df00 45 error (_("-symbol-list-lines: Unknown source file name."));
0d18235f 46
2b03b41d
SS
47 /* Now, dump the associated line table. The pc addresses are
48 already sorted by increasing values in the symbol table, so no
49 need to perform any other sorting. */
0d18235f 50
eb822aa6 51 gdbarch = get_objfile_arch (SYMTAB_OBJFILE (s));
0d18235f 52
10f489e5 53 ui_out_emit_list list_emitter (uiout, "lines");
8435453b
DE
54 if (SYMTAB_LINETABLE (s) != NULL && SYMTAB_LINETABLE (s)->nitems > 0)
55 for (i = 0; i < SYMTAB_LINETABLE (s)->nitems; i++)
0d18235f 56 {
2e783024 57 ui_out_emit_tuple tuple_emitter (uiout, NULL);
112e8700 58 uiout->field_core_addr ("pc", gdbarch, SYMTAB_LINETABLE (s)->item[i].pc);
381befee 59 uiout->field_signed ("line", SYMTAB_LINETABLE (s)->item[i].line);
0d18235f 60 }
0d18235f 61}
This page took 1.341181 seconds and 4 git commands to generate.