This is the mail archive of the
insight@sourceware.cygnus.com
mailing list for the Insight project.
Re: Attach filter should use glob matching not regexp.
- To: Mo DeJong <mdejong at cygnus dot com>
- Subject: Re: Attach filter should use glob matching not regexp.
- From: Jim Ingham <jingham at apple dot com>
- Date: Mon, 26 Jun 2000 10:48:25 -0700
- CC: Insight <insight at sourceware dot cygnus dot com>
Mo,
I guess using globs is okay, but is entering "*" so much easier than
entering ".*"? It is just that regular expressions are so much more
powerful than globs, that I would like to keep them around if at all
possible. Maybe a check box to switch between the two?
About how to access the process table... There wasn't anything in gdb that
I could find to help with this, but this whole Attach dialog was a really
quick hack so I didn't look that hard...
Also, you want to be careful about doing "ps -awx" because the user won't be
able to attach to anything that the he/she doesn't own (unless running as
root). Showing them a whole lot of processes that they can't actually
attach to is not a very useful thing.
Jim
> 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 <mdejong@redhat.com>
> +
> + * 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 <fnasser@cygnus.com>
>
> * 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
>