aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorMartin Hunt <hunt@redhat.com>1997-08-17 07:47:55 +0000
committerMartin Hunt <hunt@redhat.com>1997-08-17 07:47:55 +0000
commit99c98415f22b978e21c9b3c2118a7cb96cf54b22 (patch)
treee2ebba8de9c780e9a7d8009fd90c246c79cc4bc6 /gdb
parente406b8d7f1919326625e28c43e2ebef4d0b48e9f (diff)
downloadgdb-99c98415f22b978e21c9b3c2118a7cb96cf54b22.zip
gdb-99c98415f22b978e21c9b3c2118a7cb96cf54b22.tar.gz
gdb-99c98415f22b978e21c9b3c2118a7cb96cf54b22.tar.bz2
Sun Aug 17 00:42:11 1997 Martin M. Hunt <hunt@cygnus.com>
* gdbtk.c (gdb_listfuncs): New function that returns a list of all the functions in a source file.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/gdbtk.c43
2 files changed, 51 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ce9084d..97f9d6b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+start-sanitize-gdbtk
+Sun Aug 17 00:42:11 1997 Martin M. Hunt <hunt@cygnus.com>
+
+ * gdbtk.c (gdb_listfuncs): New function that returns
+ a list of all the functions in a source file.
+
+end-sanitize-gdbtk
+
Fri Aug 15 13:59:37 1997 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
* infrun.c (wait_for_inferior): Add the symbols for any
diff --git a/gdb/gdbtk.c b/gdb/gdbtk.c
index 0d558f5..60a921f 100644
--- a/gdb/gdbtk.c
+++ b/gdb/gdbtk.c
@@ -90,6 +90,7 @@ static int gdbtk_dis_asm_read_memory PARAMS ((bfd_vma, bfd_byte *, int, disassem
static int gdb_path_conv PARAMS ((ClientData, Tcl_Interp *, int, char *[]));
static int gdb_stop PARAMS ((ClientData, Tcl_Interp *, int, char *[]));
static int gdb_listfiles PARAMS ((ClientData, Tcl_Interp *, int, char *[]));
+static int gdb_listfuncs PARAMS ((ClientData, Tcl_Interp *, int, char *[]));
static int call_wrapper PARAMS ((ClientData, Tcl_Interp *, int, char *[]));
static int gdb_cmd PARAMS ((ClientData, Tcl_Interp *, int, char *argv[]));
static int gdb_fetch_registers PARAMS ((ClientData, Tcl_Interp *, int, char *[]));
@@ -911,6 +912,46 @@ gdb_listfiles (clientData, interp, argc, argv)
}
static int
+gdb_listfuncs (clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ struct symtab *symtab;
+ struct blockvector *bv;
+ struct block *b;
+ struct symbol *sym;
+ int i,j;
+
+ if (argc != 2)
+ error ("wrong # args");
+
+ symtab = lookup_symtab (argv[1]);
+
+ if (!symtab)
+ error ("No such file");
+
+ bv = BLOCKVECTOR (symtab);
+ for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++)
+ {
+ b = BLOCKVECTOR_BLOCK (bv, i);
+ /* Skip the sort if this block is always sorted. */
+ if (!BLOCK_SHOULD_SORT (b))
+ sort_block_syms (b);
+ for (j = 0; j < BLOCK_NSYMS (b); j++)
+ {
+ sym = BLOCK_SYM (b, j);
+ if (SYMBOL_CLASS (sym) == LOC_BLOCK)
+ {
+ Tcl_DStringAppendElement (result_ptr, SYMBOL_NAME(sym));
+ }
+ }
+ }
+ return TCL_OK;
+}
+
+static int
gdb_stop (clientData, interp, argc, argv)
ClientData clientData;
Tcl_Interp *interp;
@@ -1420,6 +1461,8 @@ gdbtk_init ( argv0 )
NULL);
Tcl_CreateCommand (interp, "gdb_listfiles", call_wrapper, gdb_listfiles,
NULL);
+ Tcl_CreateCommand (interp, "gdb_listfuncs", call_wrapper, gdb_listfuncs,
+ NULL);
Tcl_CreateCommand (interp, "gdb_stop", call_wrapper, gdb_stop, NULL);
Tcl_CreateCommand (interp, "gdb_regnames", call_wrapper, gdb_regnames, NULL);
Tcl_CreateCommand (interp, "gdb_fetch_registers", call_wrapper,