OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.1/] [gdb/] [mi/] [mi-symbol-cmds.c] - Blame information for rev 318

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
/* MI Command Set - symbol commands.
2
   Copyright (C) 2003, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
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
8
   the Free Software Foundation; either version 3 of the License, or
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
17
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
18
 
19
#include "defs.h"
20
#include "mi-cmds.h"
21
#include "symtab.h"
22
#include "objfiles.h"
23
#include "ui-out.h"
24
 
25
/* SYMBOL-LIST-LINES:
26
 
27
   Print the list of all pc addresses and lines of code for
28
   the provided (full or base) source file name.  The entries
29
   are sorted in ascending PC order. */
30
 
31
void
32
mi_cmd_symbol_list_lines (char *command, char **argv, int argc)
33
{
34
  struct gdbarch *gdbarch;
35
  char *filename;
36
  struct symtab *s;
37
  int i;
38
  struct cleanup *cleanup_stack, *cleanup_tuple;
39
 
40
  if (argc != 1)
41
    error (_("mi_cmd_symbol_list_lines: Usage: SOURCE_FILENAME"));
42
 
43
  filename = argv[0];
44
  s = lookup_symtab (filename);
45
 
46
  if (s == NULL)
47
    error (_("mi_cmd_symbol_list_lines: Unknown source file name."));
48
 
49
  /* Now, dump the associated line table.  The pc addresses are already
50
     sorted by increasing values in the symbol table, so no need to
51
     perform any other sorting. */
52
 
53
  gdbarch = get_objfile_arch (s->objfile);
54
  cleanup_stack = make_cleanup_ui_out_list_begin_end (uiout, "lines");
55
 
56
  if (LINETABLE (s) != NULL && LINETABLE (s)->nitems > 0)
57
    for (i = 0; i < LINETABLE (s)->nitems; i++)
58
    {
59
      cleanup_tuple = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
60
      ui_out_field_core_addr (uiout, "pc", gdbarch, LINETABLE (s)->item[i].pc);
61
      ui_out_field_int (uiout, "line", LINETABLE (s)->item[i].line);
62
      do_cleanups (cleanup_tuple);
63
    }
64
 
65
  do_cleanups (cleanup_stack);
66
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.