This is the mail archive of the insight@sources.redhat.com mailing list for the Insight project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [RFC] patch to fix finding sources


"Martin M. Hunt" wrote:
> 
> A couple weeks ago, gdb_find_file was changed to return TCL_ERROR with an
> error message "File not found in symtab (2)"  when no file was found.  I
> disagree with this.  I thought catch was for handling exceptions.  Also,
> the error message is not used and is confusing.
> 

That patch does fix a reported bug as well.  The error message is identical to the existing one issued by gdb_loadfile in a similar situation (hence the (2) ) and describes "exactly" what is happening.

Returning success when the operation failed is unacceptable as it is not giving
the proper error indication.

> Regardless, the functions which use gdb_find_file were not changed, which
> causes some nasty bugs in Insight.  Attached is a patch to get things
> working again.
> 

This is a legitimate complaint.  I probably forgot to check the caller side bits
(too many branches and sandboxes around).  I will check your patch in.



P.S.: Contributions are welcome, but please do not forget the ChangeLog.




> Index: srctextwin.itb
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbtk/library/srctextwin.itb,v
> retrieving revision 1.20
> diff -p -r1.20 srctextwin.itb
> *** srctextwin.itb      2001/01/19 16:09:10     1.20
> --- srctextwin.itb      2001/02/06 16:15:49
> ***************
> *** 1,5 ****
> !  # Paned text widget for source code, for GDBtk.
> ! # Copyright 1997, 1998, 1999 Cygnus Solutions
>   #
>   # This program is free software; you can redistribute it and/or modify it
>   # under the terms of the GNU General Public License (GPL) as published by
> --- 1,5 ----
> ! # Paned text widget for source code, for Insight
> ! # Copyright 1997, 1998, 1999, 2001 Red Hat
>   #
>   # This program is free software; you can redistribute it and/or modify it
>   # under the terms of the GNU General Public License (GPL) as published by
> *************** body SrcTextWin::ClearTags {} {
> *** 888,896 ****
>   body SrcTextWin::_mtime_changed {filename} {
>     global tcl_platform
> 
> !   set f [gdb_find_file $filename]
> 
> !   if {$f == ""} {
>       set r 1
>     } else {
>       if {[string compare $tcl_platform(platform) "windows"] == 0} {
> --- 888,896 ----
>   body SrcTextWin::_mtime_changed {filename} {
>     global tcl_platform
> 
> !   set f [catch {gdb_find_file $filename} errtxt]
> 
> !   if {$f} {
>       set r 1
>     } else {
>       if {[string compare $tcl_platform(platform) "windows"] == 0} {
> Index: srcwin.itb
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbtk/library/srcwin.itb,v
> retrieving revision 1.11
> diff -p -r1.11 srcwin.itb
> *** srcwin.itb  2001/01/25 17:49:22     1.11
> --- srcwin.itb  2001/02/06 16:15:52
> ***************
> *** 1,5 ****
> ! # Source window for GDBtk.
> ! # Copyright 1997, 1998, 1999 Cygnus Solutions
>   #
>   # This program is free software; you can redistribute it and/or modify it
>   # under the terms of the GNU General Public License (GPL) as published by
> --- 1,5 ----
> ! # Source window for Insight.
> ! # Copyright 1997, 1998, 1999, 2001 Red Hat
>   #
>   # This program is free software; you can redistribute it and/or modify it
>   # under the terms of the GNU General Public License (GPL) as published by
> *************** body SrcWin::_name {w {val ""}} {
> *** 295,302 ****
>     if {$val != ""} {
>       if {![info exists _files(short,$val)]} {
>         if {![info exists _files(full,$val)]} {
> !       set full [gdb_find_file $val]
> !       if {$full == ""} {
>           set_status "Cannot find source file \"$val\""
>           $_statbar.name entryset [lindex [file split $current(filename)] end]
>           return
> --- 295,302 ----
>     if {$val != ""} {
>       if {![info exists _files(short,$val)]} {
>         if {![info exists _files(full,$val)]} {
> !       set full [catch {gdb_find_file $val} errtxt ]
> !       if {$full} {
>           set_status "Cannot find source file \"$val\""
>           $_statbar.name entryset [lindex [file split $current(filename)] end]
>           return

-- 
Fernando Nasser
Red Hat - Toronto                       E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]