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]
Other format: [Raw text]

Patch to add Open External Source File


Hi,all
With this patch you can directly use another stirring feature
got into gdb last few days. GDB support pending breakpoint now, that to
say you can debug shared libraries as you do in vs.net. You can set
breakpoints in shared libraries which do not be loaded at all. GDB will
resolve the breakpoints when the shared libraries are loaded.
    I added a menu item "Open External Source Files" to insight in this
patch. You can open any files to set breakpoints in it.

--
Best Regards
     ______
    /_____/\            Wind Li
   /____ \\ \           Sun Microsystems
  /_____\ \\ /          Email: wind.li@sun.com
 /_____/ \/ / /         Tel: (8610)82618200 ext.82962
/_____/ /   \//\        Fax: (8610)62780969
\_____\//\   / /        Cel: 13691555880
 \_____/ / /\ /
  \_____/ \\ \          China Engineering & Research Institute
   \_____\ \\           10/F, B ChuangXin Plaza
    \_____\/            Beijing 100084, P.R.China


Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.165
diff -u -r1.165 breakpoint.c
--- breakpoint.c	23 Mar 2004 14:47:55 -0000	1.165
+++ breakpoint.c	27 Mar 2004 16:04:22 -0000
@@ -8106,5 +8106,5 @@
 				&breakpoint_set_cmdlist,
 				&breakpoint_show_cmdlist);
 
-  pending_break_support = AUTO_BOOLEAN_AUTO;
+  pending_break_support = AUTO_BOOLEAN_TRUE;
 }
Index: gdbtk/generic/gdbtk-bp.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-bp.c,v
retrieving revision 1.22
diff -u -r1.22 gdbtk-bp.c
--- gdbtk/generic/gdbtk-bp.c	7 Jan 2004 18:35:59 -0000	1.22
+++ gdbtk/generic/gdbtk-bp.c	27 Mar 2004 16:04:25 -0000
@@ -61,6 +61,7 @@
  || (bp)->type == bp_read_watchpoint     \
  || (bp)->type == bp_access_watchpoint)
 
+
 /* Is this breakpoint a watchpoint?  */
 #define BREAKPOINT_IS_WATCHPOINT(bp)					      \
 ((bp)->type == bp_watchpoint						      \
@@ -243,6 +244,7 @@
 {
   struct symtab *s;
   int i, line;
+  char * file=NULL;
 
   if (objc != 3)
     {
@@ -252,7 +254,9 @@
 
   s = lookup_symtab (Tcl_GetStringFromObj (objv[1], NULL));
   if (s == NULL)
-    return TCL_ERROR;
+	  xasprintf(&file,"%s",Tcl_GetStringFromObj (objv[1], NULL));
+  else
+	  xasprintf(&file,"%s",s->filename);
 
   if (Tcl_GetIntFromObj (interp, objv[2], &line) == TCL_ERROR)
     {
@@ -264,10 +268,10 @@
   for (i = 0; i < breakpoint_list_size; i++)
     if (breakpoint_list[i] != NULL
 	&& breakpoint_list[i]->line_number == line
-	&& !strcmp (breakpoint_list[i]->source_file, s->filename))
+	&& !strcmp (breakpoint_list[i]->source_file, file))
       Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr,
 				Tcl_NewIntObj (i));
-
+  free(file);
   return TCL_OK;
 }
 
@@ -310,12 +314,15 @@
       return TCL_ERROR;
     }
 
+
   sal = find_pc_line (b->loc->address, 0);
 
   filename = symtab_to_filename (sal.symtab);
+
+  if (filename == NULL)
+	  filename = b->source_file;
   if (filename == NULL)
     filename = "";
-
   Tcl_SetListObj (result_ptr->obj_ptr, 0, NULL);
   Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr,
 			    Tcl_NewStringObj (filename, -1));
@@ -480,11 +487,10 @@
 gdb_set_bp (ClientData clientData, Tcl_Interp *interp,
 	    int objc, Tcl_Obj *CONST objv[])
 {
-  struct symtab_and_line sal;
   int line, thread = -1;
-  struct breakpoint *b;
-  char *buf, *typestr;
+  char *buf, *file,*typestr;
   enum bpdisp disp;
+  struct breakpoint *b;
 
   if (objc != 4 && objc != 5)
     {
@@ -492,10 +498,6 @@
       return TCL_ERROR;
     }
 
-  sal.symtab = lookup_symtab (Tcl_GetStringFromObj (objv[1], NULL));
-  if (sal.symtab == NULL)
-    return TCL_ERROR;
-
   if (Tcl_GetIntFromObj (interp, objv[2], &line) == TCL_ERROR)
     {
       result_ptr->flags = GDBTK_IN_TCL_RESULT;
@@ -522,25 +524,29 @@
 	}
     }
 
-  sal.line = line;
-  if (!find_line_pc (sal.symtab, sal.line, &sal.pc))
-    return TCL_ERROR;
-
-  sal.section = find_pc_overlay (sal.pc);
-  b = set_raw_breakpoint (sal, bp_breakpoint);
-  set_breakpoint_count (breakpoint_count + 1);
-  b->number = breakpoint_count;
-  b->disposition = disp;
-  b->thread = thread;
 
   /* FIXME: this won't work for duplicate basenames! */
   xasprintf (&buf, "%s:%d", basename (Tcl_GetStringFromObj (objv[1], NULL)),
 	     line);
-  b->addr_string = xstrdup (buf);
+  xasprintf (&file, "%s", Tcl_GetStringFromObj (objv[1], NULL));
+	if (disp == disp_del)
+		  tbreak_command(xstrdup (buf),1);
+	else
+	      break_command(xstrdup (buf),1);
+  b = (breakpoint_count > 0 ? breakpoint_list[breakpoint_count] : NULL);
+  if (b && b->pending && !(strcmp(b->addr_string,buf)) )
+  {
+	  b->source_file = savestring (file,
+				 strlen (file));
+	  b->line_number = line;
+	  /* notification has been sent by t/break_command. But we had changed breakpoint info 
+	  so we had to send notification command back to GUI once more*/
+	  breakpoint_create_event (b->number);
+
+  }
   free(buf);
+  free(file);
 
-  /* now send notification command back to GUI */
-  breakpoint_create_event (b->number);
   return TCL_OK;
 }
 
Index: gdbtk/generic/gdbtk-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.c,v
retrieving revision 1.79
diff -u -r1.79 gdbtk-cmds.c
--- gdbtk/generic/gdbtk-cmds.c	7 Jan 2004 18:35:59 -0000	1.79
+++ gdbtk/generic/gdbtk-cmds.c	27 Mar 2004 16:04:27 -0000
@@ -158,6 +158,8 @@
 static int gdb_listfuncs (ClientData, Tcl_Interp *, int, Tcl_Obj * CONST[]);
 static int gdb_loadfile (ClientData, Tcl_Interp *, int,
 			 Tcl_Obj * CONST objv[]);
+static int gdb_loadextfile (ClientData, Tcl_Interp *, int,
+			 Tcl_Obj * CONST objv[]);
 static int gdb_load_disassembly (ClientData clientData, Tcl_Interp
 				 * interp, int objc, Tcl_Obj * CONST objv[]);
 static int gdb_get_inferior_args (ClientData clientData,
@@ -262,6 +264,8 @@
 			gdbtk_call_wrapper, gdb_find_file_command, NULL);
   Tcl_CreateObjCommand (interp, "gdb_loadfile", gdbtk_call_wrapper, gdb_loadfile,
 			NULL);
+  Tcl_CreateObjCommand (interp, "gdb_loadextfile", gdbtk_call_wrapper, gdb_loadextfile,
+			NULL);
   Tcl_CreateObjCommand (interp, "gdb_load_disassembly", gdbtk_call_wrapper,
 			gdb_load_disassembly,  NULL);
   Tcl_CreateObjCommand (gdbtk_interp, "gdb_search", gdbtk_call_wrapper,
@@ -2805,6 +2809,171 @@
   fclose (fp);
   return TCL_OK;
 }
+
+/* This implements the tcl command "gdb_loadextfile"
+ * It loads a c source file into a text widget.
+ *
+ * Tcl Arguments:
+ *    widget: the name of the text widget to fill
+ *    filename: the name of the file to load
+ *    linenumbers: A boolean indicating whether or not to display line numbers.
+ * Tcl Result:
+ *
+ */
+
+/* In this routine, we will build up a "line table", i.e. a
+ * table of bits showing which lines in the source file are executible.
+ * LTABLE_SIZE is the number of bytes to allocate for the line table.
+ *
+ * Its size limits the maximum number of lines 
+ * in a file to 8 * LTABLE_SIZE.  This memory is freed after 
+ * the file is loaded, so it is OK to make this very large. 
+ * Additional memory will be allocated if needed. */
+#define LTABLE_SIZE 20000
+
+static int
+gdb_loadextfile (ClientData clientData, Tcl_Interp *interp, int objc,
+	      Tcl_Obj *CONST objv[])
+{
+  char *file, *widget;
+  int linenumbers, ln, lnum, ltable_size;
+  FILE *fp;
+  char *ltable;
+  struct linetable_entry *le;
+  long mtime = 0;
+  struct stat st;
+  char line[10000], line_num_buf[18];
+  const char *text_argv[9];
+  Tcl_CmdInfo text_cmd;
+
+ 
+  if (objc != 4)
+    {
+      Tcl_WrongNumArgs(interp, 1, objv, "widget filename linenumbers");
+      return TCL_ERROR; 
+    }
+
+  widget = Tcl_GetStringFromObj (objv[1], NULL);
+  if ( Tk_NameToWindow (interp, widget, Tk_MainWindow (interp)) == NULL)
+    {
+      return TCL_ERROR;
+    }
+
+  if (!Tcl_GetCommandInfo (interp, widget, &text_cmd))
+    {
+      gdbtk_set_result (interp, "Can't get widget command info");
+      return TCL_ERROR;
+    }
+  
+  file  = Tcl_GetStringFromObj (objv[2], NULL);
+  Tcl_GetBooleanFromObj (interp, objv[3], &linenumbers);
+
+  if ((fp = fopen ( file, "r" )) == NULL)
+    {
+      gdbtk_set_result (interp, "Can't open file for reading");
+      return TCL_ERROR;
+    }
+
+  if (stat (file, &st) < 0)
+    {
+      catch_errors (perror_with_name_wrapper, "gdbtk: get time stamp", "",
+                    RETURN_MASK_ALL);
+      return TCL_ERROR;
+    }
+
+  
+  /* Source linenumbers don't appear to be in order, and a sort is */
+  /* too slow so the fastest solution is just to allocate a huge */
+  /* array and set the array entry for each linenumber */
+
+  ltable_size = LTABLE_SIZE;
+  ltable = (char *)malloc (LTABLE_SIZE);
+  if (ltable == NULL)
+    {
+      fclose (fp);
+      gdbtk_set_result (interp, "Out of memory.");
+      return TCL_ERROR;
+    }
+
+  memset (ltable, 0, LTABLE_SIZE);
+      
+  ln = 1;
+
+  line[0] = '\t'; 
+  text_argv[0] = widget;
+  text_argv[1] = "insert";
+  text_argv[2] = "end";
+  text_argv[5] = line;
+  text_argv[6] = "source_tag";
+  text_argv[8] = NULL;
+  
+  if (linenumbers)
+    {
+      int found_carriage_return = 1;
+      
+      line_num_buf[1] = '\t';
+       
+      text_argv[3] = line_num_buf;
+      
+      while (fgets (line + 1, 9980, fp))
+        {
+	  /* Look for DOS style \r\n endings, and if found,
+	   * strip off the \r.  We assume (for the sake of
+	   * speed) that ALL lines in the file have DOS endings,
+	   * or none do.
+	   */
+	  
+	  if (found_carriage_return)
+	    {
+	      char *p = strrchr(line, '\0') - 2;
+	      if (*p == '\r')
+		{
+		  *p = '\n';
+		  *(p + 1) = '\0';
+		} 
+	      else 
+		found_carriage_return = 0;
+	    }
+	  
+          sprintf (line_num_buf+2, "%d", ln);
+	      line_num_buf[0] = '-';
+              text_argv[4] = "break_rgn_tag";
+
+          text_cmd.proc(text_cmd.clientData, interp, 7, text_argv);
+          ln++;
+        }
+    }
+  else
+    {
+      int found_carriage_return = 1;
+            
+      while (fgets (line + 1, 9980, fp))
+        {
+	  if (found_carriage_return)
+	    {
+	      char *p = strrchr(line, '\0') - 2;
+	      if (*p == '\r')
+		{
+		  *p = '\n';
+		  *(p + 1) = '\0';
+		} 
+	      else
+		found_carriage_return = 0;
+	    }
+
+              text_argv[3] = "- ";
+              text_argv[4] = "break_rgn_tag";
+
+          text_cmd.proc(text_cmd.clientData, interp, 7, text_argv);
+          ln++;
+	}
+    }
+
+  free (ltable);
+  fclose (fp);
+  return TCL_OK;
+}
+
 
 /*
  * This section contains a bunch of miscellaneous utility commands
Index: gdbtk/library/bpwin.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/bpwin.itb,v
retrieving revision 1.17
diff -u -r1.17 bpwin.itb
--- gdbtk/library/bpwin.itb	6 Mar 2003 01:25:50 -0000	1.17
+++ gdbtk/library/bpwin.itb	27 Mar 2004 16:04:27 -0000
@@ -547,6 +547,7 @@
     tracepoint { set type "tracepoint" }
   }
 
+  debug "delete $type $index_to_bpnum($i)"
   gdb_cmd "delete $type $index_to_bpnum($i)"
 }
 
@@ -583,6 +584,8 @@
 # ------------------------------------------------------------------
 itcl::body BpWin::bp_delete {bp_event} {
   set number [$bp_event get number]
+  debug "bp_delete number : $number"
+
   for {set i 1} {$i < $next_row} {incr i} {
     if { $number == $index_to_bpnum($i) } {
       if {$tracepoints} {
Index: gdbtk/library/interface.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/interface.tcl,v
retrieving revision 1.48
diff -u -r1.48 interface.tcl
--- gdbtk/library/interface.tcl	10 Feb 2003 20:10:56 -0000	1.48
+++ gdbtk/library/interface.tcl	27 Mar 2004 16:04:29 -0000
@@ -499,7 +499,7 @@
 #                               gui.
 # ------------------------------------------------------------------
 proc gdbtk_tcl_breakpoint {action bpnum} {
-#  debug "BREAKPOINT: $action $bpnum"
+  debug "BREAKPOINT: $action $bpnum"
   set e [BreakpointEvent \#auto -action $action -number $bpnum]
   GDBEventHandler::dispatch $e
   delete object $e
@@ -1666,6 +1666,7 @@
    }
    return 1
  }
+
 
 # ------------------------------------------------------------------
 # PROC: source_file -
Index: gdbtk/library/session.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/session.tcl,v
retrieving revision 1.14
diff -u -r1.14 session.tcl
--- gdbtk/library/session.tcl	4 Feb 2003 07:15:49 -0000	1.14
+++ gdbtk/library/session.tcl	27 Mar 2004 16:04:29 -0000
@@ -184,11 +184,11 @@
     # Breakpoints.
     set values(breakpoints) [_serialize_bps]
 
-    # Recompute list of recent sessions.  Trim to no more than 5 sessions.
+    # Recompute list of recent sessions.  Trim to no more than 10 sessions.
     set recent [concat [list $name] \
 		  [lremove [pref getd gdb/recent-projects] $name]]
-    if {[llength $recent] > 5} then {
-      set recent [lreplace $recent 5 end]
+    if {[llength $recent] > 10} then {
+      set recent [lreplace $recent 10 end]
     }
     pref setd gdb/recent-projects $recent
 
Index: gdbtk/library/srcbar.itcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/srcbar.itcl,v
retrieving revision 1.22
diff -u -r1.22 srcbar.itcl
--- gdbtk/library/srcbar.itcl	20 Dec 2002 22:01:36 -0000	1.22
+++ gdbtk/library/srcbar.itcl	27 Mar 2004 16:04:30 -0000
@@ -36,7 +36,8 @@
   # ------------------------------------------------------------------
   constructor {src args} {
     set source $src
-
+    debug "src $src"
+    
     # Load the images to be used in toolbar buttons
     _load_images
     _load_src_images
@@ -165,9 +166,12 @@
     $Menu add command Other "Close" \
       "_close_file" -underline 0 -accelerator "Ctrl+W" -state $state
 
+    $Menu add command Other "Open External Source Files" \
+      "[code $source ext_source_file]" -underline 0  -accelerator "Ctrl+E" -state $state
+
     $Menu add command Other "Source..." \
       "source_file" -underline 0
-
+    
     set sessions [Session::list_names]
     if {[llength $sessions]} {
       $Menu add separator
Index: gdbtk/library/srctextwin.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/srctextwin.itb,v
retrieving revision 1.41
diff -u -r1.41 srctextwin.itb
--- gdbtk/library/srctextwin.itb	6 Mar 2003 04:34:51 -0000	1.41
+++ gdbtk/library/srctextwin.itb	27 Mar 2004 16:04:31 -0000
@@ -956,7 +956,7 @@
       }
     }
 
-#    debug "cf=$current(filename) pc=$pc(filename) filename=$filename"
+    debug "cf=$current(filename) pc=$pc(filename) filename=$filename"
     if {$current(filename) != ""} {
       if {$gdb_running && $pc(filename) == $filename} {
 	# set the PC tag in this file
@@ -1174,7 +1174,7 @@
 # METHOD: location - display a location in a file
 # ------------------------------------------------------------------
 itcl::body SrcTextWin::location {tagname filename funcname line addr pc_addr lib} {
-#  debug "$tagname $filename $line $addr $pc_addr,  mode=$current(mode) oldmode=$oldmode  cf=$current(filename) lib=$lib"
+  debug "$tagname $filename $line $addr $pc_addr,  mode=$current(mode) oldmode=$oldmode  cf=$current(filename) lib=$lib"
   
   ClearTags
   
@@ -1241,6 +1241,9 @@
   set current(funcname) $funcname
   set current(filename) $filename
   set current(lib) $lib
+
+  debug "$tagname $filename $line $addr $pc_addr,  mode=$current(mode) oldmode=$oldmode  cf=$current(filename) lib=$lib"
+  debug "do_display_breaks $do_display_breaks"
   if {$do_display_breaks} {
     display_breaks
     set do_display_breaks 0
@@ -1264,14 +1267,21 @@
     $win delete 0.0 end
     debug "READING $name"
     if {[catch {gdb_loadfile $win $name $Linenums} msg]} {
-      dbug W "Error opening $name:  $msg"
+	    debug "Error Reading $name"
+		
+	 		if {[catch {gdb_loadextfile $win $name $Linenums} msg]} {
+			  debug "Error Reading External source $name"
+		      dbug W "Error opening $name:  $msg"
+				
+
       #if {$msg != ""} {
       #  tk_messageBox -icon error -title "GDB" -type ok \
 	#    -modal task -message $msg
       #}
-      UnLoadFromCache $w $oldpane $name "" $lib
-      return 0
-    }
+	      UnLoadFromCache $w $oldpane $name "" $lib
+	      return 0
+	    }
+	}
   }
   set current(filename) $name
   # Display all breaks/traces
@@ -1352,7 +1362,7 @@
 #         into the text window WIN, at line linenum.
 # ------------------------------------------------------------------
 itcl::body SrcTextWin::insertBreakTag {win linenum tag} {
-#  debug "$win $linenum $tag"
+  debug "insertBreakTag $win $linenum $tag"
   
   # Get the tags at the current line.  
   
@@ -1396,7 +1406,7 @@
 #         line reinstall the break_rgn_tag
 # ------------------------------------------------------------------
 itcl::body SrcTextWin::removeBreakTag {win linenum tag } {
-#  debug "$win $linenum $tag"
+  debug "removeBreakTag $win $linenum $tag"
 
   set tag_list [$win tag names $linenum.0]
 
@@ -1449,6 +1459,9 @@
 #                   or modify event from the backend.
 # ------------------------------------------------------------------
 itcl::body SrcTextWin::breakpoint {bp_event} {
+debug  "$bp_event get action] [$bp_event get number] [$bp_event get address] \
+    [$bp_event get line] [$bp_event get file] [$bp_event get disposition]  \
+    [$bp_event get enabled] [$bp_event get thread]"
 
   bp [$bp_event get action] [$bp_event get number] [$bp_event get address] \
     [$bp_event get line] [$bp_event get file] [$bp_event get disposition]  \
@@ -1474,7 +1487,7 @@
 #  a breakpoint will be set in the source window if appropriate.
 # ------------------------------------------------------------------
 itcl::body SrcTextWin::bp {action bpnum addr {linenum {}} {file {}} {type 0} {enabled 0}  {thread -1}} {
-#  debug "$action addr=$addr line=$linenum file=$file type=$type current(filename)=$current(filename)"
+  debug "$action addr=$addr line=$linenum file=$file type=$type current(filename)=$current(filename)"
 
   switch $current(mode) {
     SOURCE {
@@ -1513,7 +1526,7 @@
 #  METHOD:  do_bp - bp helper function
 # ------------------------------------------------------------------
 itcl::body SrcTextWin::do_bp { win action linenum type bpnum enabled thread asm} {
-#  debug "$action line=$linenum type=$type bpnum=$bpnum enabled=$enabled thread=$thread"
+  debug "$action line=$linenum type=$type bpnum=$bpnum enabled=$enabled thread=$thread"
 
   if {$dont_change_appearance} {
     return
@@ -1522,6 +1535,7 @@
   if {$action == "delete" && [string compare $type tracepoint] != 0} {
     # make sure there are no more breakpoints on
     # this line.
+    debug "delete breakpoint at $current(filename) $linenum"
     if {!$asm} {
       set bps [gdb_find_bp_at_line $current(filename) $linenum]
     } else {
@@ -1782,6 +1796,7 @@
   gdb_immediate "continue"
   gdb_cmd "enable"
   foreach i [gdb_get_breakpoint_list] {
+    debug "delete i: $i y: $y"
     if {![info exists enabled($i)]} {
       gdb_cmd "delete $i"
     } elseif {!$enabled($i)} {
@@ -1799,7 +1814,7 @@
 #  The threads parameter is not currently used.
 # ------------------------------------------------------------------
 itcl::body SrcTextWin::jump_to_here {{win {}} {y -1} {threads -1}} {
-  
+  debug "jump_to_here"
   # Look up the line...  This foreach is an lassign...
   foreach {name line addr type set_cmd} [lookup_line $win $y] {
     break
@@ -1932,12 +1947,13 @@
   # FIXME: if there are multiple bp/tp at a single line,
   # we will (right now) always take the first one we find...
   switch $type {
-    src { set bps [gdb_find_bp_at_line $name $addr] }
+    src { set bps [gdb_find_bp_at_line $current(filename) $line] }
     asm { set bps [gdb_find_bp_at_addr $addr] }
   }
 
   set number [lindex $bps 0]
-  gdb_cmd "delete $number"
+  debug "$name $addr $line $number $y"
+  if {"$number" != "" } {  gdb_cmd "delete $number" }
 }
 
 
Index: gdbtk/library/srcwin.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/srcwin.itb,v
retrieving revision 1.32
diff -u -r1.32 srcwin.itb
--- gdbtk/library/srcwin.itb	17 Feb 2004 18:43:57 -0000	1.32
+++ gdbtk/library/srcwin.itb	27 Mar 2004 16:04:32 -0000
@@ -274,6 +274,41 @@
   $twin reconfig
 }
 
+# ------------------------------------------------------------------
+#  PUBLIC METHOD:  openfile - open external source file
+# ------------------------------------------------------------------
+itcl::body SrcWin::openfile {val} {
+  global _files
+
+  if {$val != ""} {
+    if {![info exists _files(short,$val)]} {
+      if {![info exists _files(full,$val)]} {
+		set _files(short,$val) $val
+		set _files(full,$val) $val
+	     }
+      set full $_files(full,$val)
+    } else {
+      set full $val
+      set val $_files(short,$full)
+         }
+    $_statbar.name entryset $val
+    location BROWSE_TAG [list $val "" $full 0 0 0 {}]
+  }
+}
+
+# ------------------------------------------------------------------
+# PUBLIC METHOD: ext_source_file -
+# ------------------------------------------------------------------
+itcl::body SrcWin::ext_source_file {} {
+  global tcl_platform
+  set file_name [tk_getOpenFile -title "Choose GDB Command file"]
+  if {$file_name != ""} {
+    if {$tcl_platform(platform) == "windows"} {
+      set file_name [ide_cygwin_path to_posix $file_name]
+    }
+    openfile $file_name
+  }
+}
 
 # ------------------------------------------------------------------
 #  PRIVATE METHOD:  _name - filename combobox callback
@@ -282,6 +317,7 @@
 #  once the debugger is started. 
 # ------------------------------------------------------------------
 itcl::body SrcWin::_name {w {val ""}} {
+
   global _files
   debug "$w $val"
   if {$val != ""} {
@@ -379,10 +415,10 @@
   if {$name != ""} {
     set maxlen 10
     if {[catch {gdb_listfuncs $name} listfuncs]} {
-      tk_messageBox -icon error -default ok \
-	-title "GDB" -type ok \
-	-message "This file can not be found or does not contain\ndebugging information."
-      _set_name ""
+#      tk_messageBox -icon error -default ok \
+#	-title "GDB" -type ok \
+#	-message "This file can not be found or does not contain\ndebugging information."
+#      _set_name ""
       return
     }
     foreach f [lsort -increasing $listfuncs] {
Index: gdbtk/library/srcwin.ith
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/srcwin.ith,v
retrieving revision 1.11
diff -u -r1.11 srcwin.ith
--- gdbtk/library/srcwin.ith	15 Oct 2002 21:19:51 -0000	1.11
+++ gdbtk/library/srcwin.ith	27 Mar 2004 16:04:32 -0000
@@ -52,7 +52,8 @@
     method get_file {}
     method is_fixed {}
     method search {direction string}
-
+    method openfile {val}
+    method ext_source_file {}
     proc choose_and_update {}
     proc choose_and_display {tag linespec}
     proc point_to_main {}
Index: gdbtk/library/tclIndex
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/tclIndex,v
retrieving revision 1.29
diff -u -r1.29 tclIndex
--- gdbtk/library/tclIndex	10 Feb 2003 09:47:52 -0000	1.29
+++ gdbtk/library/tclIndex	27 Mar 2004 16:04:33 -0000
@@ -520,6 +520,8 @@
 set auto_index(::SrcWin::_set_state) [list source [file join $dir srcwin.itb]]
 set auto_index(::SrcWin::download_progress) [list source [file join $dir srcwin.itb]]
 set auto_index(::SrcWin::reconfig) [list source [file join $dir srcwin.itb]]
+set auto_index(::SrcWin::openfile) [list source [file join $dir srcwin.itb]]
+set auto_index(::SrcWin::ext_source_file) [list source [file join $dir srcwin.itb]]
 set auto_index(::SrcWin::_name) [list source [file join $dir srcwin.itb]]
 set auto_index(::SrcWin::toggle_updates) [list source [file join $dir srcwin.itb]]
 set auto_index(::SrcWin::goto_func) [list source [file join $dir srcwin.itb]]
Index: gdbtk/library/bpwin.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/bpwin.itb,v
retrieving revision 1.13
diff -c -p -r1.13 bpwin.itb
*** gdbtk/library/bpwin.itb	14 Mar 2002 17:12:10 -0000	1.13
--- gdbtk/library/bpwin.itb	23 May 2002 21:34:53 -0000
@@ -66,6 +66,8 @@
   } 
   label $twin.thread0 -text "Thread" -relief raised -bd 2 -anchor center \
     -font global/fixed
+  label $twin.enabled0 -text "Enabled" -relief raised -bd 2 -anchor center \
+    -font global/fixed
   label $twin.addr0 -text "Address" -relief raised -bd 2 -anchor center \
     -font global/fixed
   label $twin.file0 -text "File" -relief raised -bd 2 -anchor center \
@@ -78,16 +80,16 @@
   if {$tracepoints} {
     label $twin.pass0 -text "PassCount" -relief raised -borderwidth 2 \
       -anchor center -font global/fixed
-    grid x $twin.num0 $twin.addr0 $twin.file0 $twin.line0 $twin.func0 $twin.pass0 \
+    grid $twin.enabled0 $twin.num0 $twin.addr0 $twin.file0 $twin.line0 $twin.func0 $twin.pass0 \
       -sticky new
   } else {
     if {$show_threads} {
-      grid x $twin.thread0 $twin.addr0 $twin.file0 $twin.line0 $twin.func0 -sticky new
+      grid $twin.enabled0 $twin.thread0 $twin.addr0 $twin.file0 $twin.line0 $twin.func0 -sticky new
       # Let the File and Function columns expand; no others.
       grid columnconfigure $twin 3 -weight 1
       grid columnconfigure $twin 5 -weight 1
     } else {
-      grid x $twin.addr0 $twin.file0 $twin.line0 $twin.func0 -sticky new
+      grid $twin.enabled0 $twin.addr0 $twin.file0 $twin.line0 $twin.func0 -sticky new
       # Let the File and Function columns expand; no others.
       grid columnconfigure $twin 2 -weight 1
       grid columnconfigure $twin 4 -weight 1
@@ -307,7 +309,7 @@
   foreach breakpoint [gdb_get_breakpoint_list] {
     # This is an lassign
     foreach {file function line_no address type \
-	       enable_p disp ignore cmds thread hit_count user_spec} \
+	       enable_p disp ignore cmds cond thread hit_count user_spec} \
       [gdb_get_breakpoint_info $breakpoint] {
 	break
       }



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