From b4bff1351397a169d7b7c47a1afea2e49cb9983c Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 21 Dec 2001 22:31:08 +0000 Subject: * generic/gdbtk-cmds.h (full_lookup_symtab): Don't declare. * generic/gdbtk-cmds.c (gdb_find_file_command): Use lookup_symtab. (gdb_listfuncs): Likewise. (gdb_loadfile): Likewise. (full_lookup_symtab): Removed. * generic/gdbtk-bp.c (gdb_find_bp_at_line): Use lookup_symtab. (gdb_set_bp): Likewise. --- gdb/gdbtk/ChangeLog | 11 +++++++ gdb/gdbtk/generic/gdbtk-bp.c | 4 +-- gdb/gdbtk/generic/gdbtk-cmds.c | 68 ++---------------------------------------- gdb/gdbtk/generic/gdbtk-cmds.h | 4 --- 4 files changed, 16 insertions(+), 71 deletions(-) (limited to 'gdb/gdbtk') diff --git a/gdb/gdbtk/ChangeLog b/gdb/gdbtk/ChangeLog index b19314bc26e..b543b911d71 100644 --- a/gdb/gdbtk/ChangeLog +++ b/gdb/gdbtk/ChangeLog @@ -1,3 +1,14 @@ +2001-12-21 Tom Tromey + + * generic/gdbtk-cmds.h (full_lookup_symtab): Don't declare. + * generic/gdbtk-cmds.c (gdb_find_file_command): Use + lookup_symtab. + (gdb_listfuncs): Likewise. + (gdb_loadfile): Likewise. + (full_lookup_symtab): Removed. + * generic/gdbtk-bp.c (gdb_find_bp_at_line): Use lookup_symtab. + (gdb_set_bp): Likewise. + 2001-12-21 Keith Seitz * library/bpwin.ith (_select_and_popup): New private method. diff --git a/gdb/gdbtk/generic/gdbtk-bp.c b/gdb/gdbtk/generic/gdbtk-bp.c index 4c1194d471a..dde0416891e 100644 --- a/gdb/gdbtk/generic/gdbtk-bp.c +++ b/gdb/gdbtk/generic/gdbtk-bp.c @@ -252,7 +252,7 @@ gdb_find_bp_at_line (clientData, interp, objc, objv) return TCL_ERROR; } - s = full_lookup_symtab (Tcl_GetStringFromObj (objv[1], NULL)); + s = lookup_symtab (Tcl_GetStringFromObj (objv[1], NULL)); if (s == NULL) return TCL_ERROR; @@ -493,7 +493,7 @@ gdb_set_bp (ClientData clientData, Tcl_Interp *interp, return TCL_ERROR; } - sal.symtab = full_lookup_symtab (Tcl_GetStringFromObj (objv[1], NULL)); + sal.symtab = lookup_symtab (Tcl_GetStringFromObj (objv[1], NULL)); if (sal.symtab == NULL) return TCL_ERROR; diff --git a/gdb/gdbtk/generic/gdbtk-cmds.c b/gdb/gdbtk/generic/gdbtk-cmds.c index 86502aba7d1..afee12a49df 100644 --- a/gdb/gdbtk/generic/gdbtk-cmds.c +++ b/gdb/gdbtk/generic/gdbtk-cmds.c @@ -1111,7 +1111,7 @@ gdb_find_file_command (clientData, interp, objc, objv) } filename = Tcl_GetStringFromObj (objv[1], NULL); - st = full_lookup_symtab (filename); + st = lookup_symtab (filename); /* We should always get a symtab. */ if (!st) @@ -1479,7 +1479,7 @@ gdb_listfuncs (clientData, interp, objc, objv) return TCL_ERROR; } - symtab = full_lookup_symtab (Tcl_GetStringFromObj (objv[1], NULL)); + symtab = lookup_symtab (Tcl_GetStringFromObj (objv[1], NULL)); if (!symtab) { gdbtk_set_result (interp, "No such file (%s)", @@ -2786,7 +2786,7 @@ gdb_loadfile (ClientData clientData, Tcl_Interp *interp, int objc, file = Tcl_GetStringFromObj (objv[2], NULL); Tcl_GetBooleanFromObj (interp, objv[3], &linenumbers); - symtab = full_lookup_symtab (file); + symtab = lookup_symtab (file); if (!symtab) { gdbtk_set_result (interp, "File not found in symtab"); @@ -3014,68 +3014,6 @@ perror_with_name_wrapper (args) return 1; } -/* The lookup_symtab() in symtab.c doesn't work correctly */ -/* It will not work will full pathnames and if multiple */ -/* source files have the same basename, it will return */ -/* the first one instead of the correct one. */ -/* symtab->fullname will be NULL if the file is not available. */ - -struct symtab * -full_lookup_symtab (file) - char *file; -{ - struct symtab *st; - struct objfile *objfile; - char *bfile, *fullname; - struct partial_symtab *pt; - - if (!file) - return NULL; - - /* first try a direct lookup */ - st = lookup_symtab (file); - if (st) - { - if (!st->fullname) - symtab_to_filename (st); - return st; - } - - /* if the direct approach failed, try */ - /* looking up the basename and checking */ - /* all matches with the fullname */ - bfile = basename (file); - ALL_SYMTABS (objfile, st) - { - if (!strcmp (bfile, basename (st->filename))) - { - if (!st->fullname) - fullname = symtab_to_filename (st); - else - fullname = st->fullname; - - if (!strcmp (file, fullname)) - return st; - } - } - - /* still no luck? look at psymtabs */ - ALL_PSYMTABS (objfile, pt) - { - if (!strcmp (bfile, basename (pt->filename))) - { - st = PSYMTAB_TO_SYMTAB (pt); - if (st) - { - fullname = symtab_to_filename (st); - if (!strcmp (file, fullname)) - return st; - } - } - } - return NULL; -} - /* Look for the function that contains PC and return the source (demangled) name for this function. diff --git a/gdb/gdbtk/generic/gdbtk-cmds.h b/gdb/gdbtk/generic/gdbtk-cmds.h index 932509ae52c..8193dae9801 100644 --- a/gdb/gdbtk/generic/gdbtk-cmds.h +++ b/gdb/gdbtk/generic/gdbtk-cmds.h @@ -38,10 +38,6 @@ struct wrapped_call_args tcl. ALL tcl commands should be wrapped in this call. */ extern int gdbtk_call_wrapper (ClientData, Tcl_Interp *, int, Tcl_Obj * CONST[]); -/* Like lookup_symtab but this deals with full pathnames and multiple - source files with the same basename. FIXME: why doesn't gdb use this? */ -extern struct symtab *full_lookup_symtab (char *file); - /* Returns the source (demangled) name for a function at PC. Returns empty string if not found. Memory is owned by gdb. Do not free it. */ extern char *pc_function_name (CORE_ADDR pc); -- cgit v1.2.1