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: [RFA] syntax error in interface.tcl


John,

What is the syntax problem?  Looks fine to me, but then again I am a bit 
rusty.

However, not so rusty that I can't see this function does not work quite 
right.  The function is documented as returning a null string if the function 
is not found, but the result of a failed gdb_loc will be a location with all 
the values either null or zero.  This confuses the callers and you can see 
error messages in the debug window about this.  Maybe this is what you are 
seeing?  Here is one possible fix:

Index: interface.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/interface.tcl,v
retrieving revision 1.26
diff -u -p -r1.26 interface.tcl
--- interface.tcl	2001/06/04 15:49:53	1.26
+++ interface.tcl	2001/07/06 05:49:25
@@ -774,24 +774,33 @@ proc gdbtk_tcl_exec_file_display {filena
 #  3: source line number
 #  4: address
 #  5: current PC - which will often be the same as address, but not when
-#  6: shared library name if the pc is in a shared lib
 #  we are browsing, or walking the stack.
+#  6: shared library name if the pc is in a shared lib
 #
 # ------------------------------------------------------------------
 proc gdbtk_locate_main {} {
+  set result {}
   set main_names [pref get gdb/main_names]
   debug "Searching $main_names"
+
   foreach main $main_names {
     if {![catch {gdb_search functions $main -static 1}] \
         && ![catch {gdb_loc $main} linespec]} {
-      return $linespec
+      set result $linespec
+      break
     }
   }
-  if {![catch gdb_entry_point entry_point]
+  if {$result == {} 
+      && ![catch gdb_entry_point entry_point]
       && ![catch {gdb_loc "*$entry_point"} linespec]} {
-    return $linespec
+    set result $linespec
   }
-  return {}
+  
+  # need to see if result is valid
+  lassign $result file func ffile line addr rest
+  if {$addr == 0x0 && $func == {}} { set result {} }
+
+  return $result
 }
 
 ##############################################
ĜlD


On Thursday 05 July 2001 17:32, John R. Moore wrote:
> This only fixes the syntax, I didn't follow what the syntax does:
>
> John
>
> 2001-07-05  John R. Moore  <jmoore@cygnus.com>
>         * interface.tcl (gdbtk_locate_main): Correct syntax.
>
> Index: gdb/gdbtk/library/interface.tcl
> ===================================================================
> RCS file: /cvs/cvsfiles/devo/gdb/gdbtk/library/interface.tcl,v
> retrieving revision 1.13
> diff -p -u -r1.13 interface.tcl
> --- gdb/gdbtk/library/interface.tcl	2001/06/14 21:03:25	1.13
> +++ gdb/gdbtk/library/interface.tcl	2001/07/06 00:25:10
> @@ -787,7 +787,7 @@ proc gdbtk_locate_main {} {
>        return $linespec
>      }
>    }
> -  if {![catch gdb_entry_point entry_point]
> +  if {![catch {gdb_entry_point entry_point}] \
>        && ![catch {gdb_loc "*$entry_point"} linespec]} {
>      return $linespec
>    }


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