From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mo DeJong To: insight@sourceware.cygnus.com Subject: Re: Attach filter should use glob matching not regexp. Date: Mon, 26 Jun 2000 07:52:00 -0000 Message-id: References: <394C203C.7882A1A1@cygnus.com> X-SW-Source: 2000-q2/msg00328.html On Sun, 18 Jun 2000, Fernando Nasser wrote: > You are probably right. Could you write a patch if you have time? > If not I will try to look at that next month as part of the GNUPro > 2000 cleanups. > > Thanks. > Fernando > > Mo DeJong wrote: > > > > I just tried to type * into the Filter: entry in the attach > > to process dialog. It errored out saying "regular expression > > * follows nothing". This really should use glob matching not > > regexp matching. How about this? Is there a better way to look at the process table? Is this something that gdb provides an interface to? Index: ChangeLog =================================================================== RCS file: /cvs/src/src/gdb/gdbtk/library/ChangeLog,v retrieving revision 1.22 diff -u -r1.22 ChangeLog --- ChangeLog 2000/06/08 20:30:07 1.22 +++ ChangeLog 2000/06/26 14:48:45 @@ -1,3 +1,9 @@ +2000-06-26 Mo DeJong + + * attachdlg.itb (list_pids): Use "ps axw" to get pid list, use + string match instead of regexp in ps filter. + * attachdlg.ith (list_pids): Change default argument to "*". + 2000-06-06 Fernando Nasser * util.tcl (find_iwidgets_library): Add missing global declaration Index: attachdlg.itb =================================================================== RCS file: /cvs/src/src/gdb/gdbtk/library/attachdlg.itb,v retrieving revision 1.3 diff -u -r1.3 attachdlg.itb --- attachdlg.itb 2000/03/09 16:02:27 1.3 +++ attachdlg.itb 2000/06/26 14:48:46 @@ -37,6 +37,8 @@ -command [code $this filter_pid_selection] } + $itk_component(pid_filter) insert 0 * + itk_component add pid_sep { frame [$itk_component(choose_pid) childsite].sep \ -height 2 -borderwidth 1 -relief sunken @@ -153,8 +155,8 @@ # point we should steal some C code to do it by hand. # ------------------------------------------------------------------ -body AttachDlg::list_pids {{expr {}}} { - if {[catch {::open "|ps w" r} psH]} { +body AttachDlg::list_pids {{pattern *}} { + if {[catch {::open "|ps axw" r} psH]} { set errTxt "Could not exec ps: $psH You will have to enter the PID by hand." ManagedWin::open WarningDlg -message [list $errTxt] @@ -163,7 +165,7 @@ gets $psH header set nfields [llength $header] - set nfields_m_1 [expr $nfields - 1] + set nfields_m_1 [expr {$nfields - 1}] set regexp {^ *([^ ]*) +} for {set i 1} {$i < $nfields_m_1} {incr i} { append regexp {[^ ]* +} @@ -175,7 +177,7 @@ while {[gets $psH line] >= 0} { regexp $regexp $line dummy PID COMMAND - if {$expr == "" || [regexp $expr $COMMAND dummy]} { + if {[string match $pattern $COMMAND]} { lappend pid_list [list $PID $COMMAND] $itk_component(choose_pid) insert end $COMMAND } Index: attachdlg.ith =================================================================== RCS file: /cvs/src/src/gdb/gdbtk/library/attachdlg.ith,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 attachdlg.ith --- attachdlg.ith 2000/02/07 00:19:42 1.1.1.1 +++ attachdlg.ith 2000/06/26 14:48:46 @@ -21,7 +21,7 @@ method cancel {} method choose_symbol_file {} method doit {} - method list_pids {{expr {}}} + method list_pids {{pattern *}} method select_pid {} method clear_pid_selection {} method filter_pid_selection {} Mo DeJong Red Hat Inc