This is the mail archive of the
insight@sourceware.org
mailing list for the Insight project.
[PATCH] Fix Target Selection Dialog
- From: Keith Seitz <keiths at redhat dot com>
- To: insight <insight at sourceware dot org>
- Date: Thu, 30 Nov 2006 17:10:36 -0800
- Subject: [PATCH] Fix Target Selection Dialog
Hi,
This patch fixes the target selection dialog, which I noticed wasn't
working this morning. Alas, after inspecting the code, I can see there
are a bunch of issues with it... [Most annoyingly: sessions and
targetselection overlap when it comes to arguments.. Grr. All this needs
to be rewritten.]
Keith
ChangeLog
2006-11-30 Keith Seitz <keiths@redhat.com>
* library/targetselection.itb (constructor): "top" is unused.
Remove it.
(get_target_list): Use "scan" to parse "help target" output.
Index: library/targetselection.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/targetselection.itb,v
retrieving revision 1.19
diff -u -p -r1.19 targetselection.itb
--- library/targetselection.itb 23 Dec 2005 18:26:50 -0000 1.19
+++ library/targetselection.itb 1 Dec 2006 01:07:35 -0000
@@ -1,5 +1,5 @@
# Target selection dialog for Insight.
-# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc.
+# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc.
#
# 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
@@ -21,7 +21,6 @@
# ------------------------------------------------------------------
itcl::body TargetSelection::constructor {args} {
eval itk_initialize $args
- set top [winfo toplevel $itk_interior]
_init
build_win
}
@@ -907,20 +906,22 @@ itcl::body TargetSelection::port_list {}
itcl::body TargetSelection::get_target_list {} {
set native [native_debugging]
set names ""
- set res [gdb_cmd "help target"]
- foreach line [split $res \n] {
- if {![string compare [lindex $line 0] "target"]} {
- set name [lindex $line 1]
+ set res [gdb_cmd "help target"]; # this just screams MI...
+ # targets are listed with lines like "target NAME -- DESCRIPTION"
+ foreach line [split $res \n] {
+ if {[scan $line "target %s --" name] == 1} {
# For cross debuggers, do not allow the target "exec"
if {$name == "exec" && !$native} {
continue
}
+
lappend names $name
}
}
+
lappend names gdbserver
- return $names
+ return [lsort $names]
}
# ------------------------------------------------------------------