public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* Re: Attach filter should use glob matching not regexp.
       [not found] <394C203C.7882A1A1@cygnus.com>
@ 2000-06-26  7:52 ` Mo DeJong
  2000-06-26 10:48   ` Jim Ingham
  0 siblings, 1 reply; 8+ messages in thread
From: Mo DeJong @ 2000-06-26  7:52 UTC (permalink / raw)
  To: insight

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Attach filter should use glob matching not regexp.
  2000-06-26  7:52 ` Attach filter should use glob matching not regexp Mo DeJong
@ 2000-06-26 10:48   ` Jim Ingham
  2000-06-26 10:55     ` Tom Tromey
  2000-06-26 16:12     ` Mo DeJong
  0 siblings, 2 replies; 8+ messages in thread
From: Jim Ingham @ 2000-06-26 10:48 UTC (permalink / raw)
  To: Mo DeJong; +Cc: Insight

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
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Attach filter should use glob matching not regexp.
  2000-06-26 10:48   ` Jim Ingham
@ 2000-06-26 10:55     ` Tom Tromey
  2000-06-26 11:05       ` Jim Ingham
  2000-06-26 16:12     ` Mo DeJong
  1 sibling, 1 reply; 8+ messages in thread
From: Tom Tromey @ 2000-06-26 10:55 UTC (permalink / raw)
  To: Jim Ingham; +Cc: Mo DeJong, Insight

Jim> Also, you want to be careful about doing "ps -awx" because the
Jim> user won't be able to attach to anything that the he/she doesn't
Jim> own (unless running as root).

Not to mention that different "ps" implementations take different
arguments.  For instance "ps -awx" doesn't work on Solaris.

Tom

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Attach filter should use glob matching not regexp.
  2000-06-26 10:55     ` Tom Tromey
@ 2000-06-26 11:05       ` Jim Ingham
  0 siblings, 0 replies; 8+ messages in thread
From: Jim Ingham @ 2000-06-26 11:05 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Mo DeJong, Insight

on 6/26/00 10:55 AM, Tom Tromey at tromey@cygnus.com wrote:

> Jim> Also, you want to be careful about doing "ps -awx" because the
> Jim> user won't be able to attach to anything that the he/she doesn't
> Jim> own (unless running as root).
> 
> Not to mention that different "ps" implementations take different
> arguments.  For instance "ps -awx" doesn't work on Solaris.
> 
> Tom
> 

Yeah, actually, if the full ugly truth be known, this was hacked up in the
last moments before the first CodeFusion release, so I really didn't try
anything but Linux (the CodeFusion target platform) and Solaris (the box I
actually worked on).  Anything else was just gravy.  It really needs to be
worked over to make sure it is general.  Also giving it a whirl under Cygwin
would be a pretty good idea...

Jim

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Attach filter should use glob matching not regexp.
  2000-06-26 10:48   ` Jim Ingham
  2000-06-26 10:55     ` Tom Tromey
@ 2000-06-26 16:12     ` Mo DeJong
  2000-06-26 20:31       ` Tom Tromey
  1 sibling, 1 reply; 8+ messages in thread
From: Mo DeJong @ 2000-06-26 16:12 UTC (permalink / raw)
  To: Jim Ingham; +Cc: Insight

On Mon, 26 Jun 2000, Jim Ingham wrote:

> 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?

I agree, regexps are much cooler but there is nothing in the GUI
that would indicate that I should enter a regexp into that box.
A glob match should be the default because that is what most
people would expect. If there were some way for the user
to indicate "I am going to use a regexp now", then I could
see adding that feature.
 
> 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.

The ps thing is a mess. What we really need is a C library that will
look at the process table and report results in a cross platform way.

later
Mo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Attach filter should use glob matching not regexp.
  2000-06-26 16:12     ` Mo DeJong
@ 2000-06-26 20:31       ` Tom Tromey
  2000-06-27 16:11         ` Jim Ingham
  0 siblings, 1 reply; 8+ messages in thread
From: Tom Tromey @ 2000-06-26 20:31 UTC (permalink / raw)
  To: Mo DeJong; +Cc: Jim Ingham, Insight

Mo> The ps thing is a mess. What we really need is a C library that
Mo> will look at the process table and report results in a cross
Mo> platform way.

Look at libgtop, part of Gnome.

Tom

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Attach filter should use glob matching not regexp.
  2000-06-26 20:31       ` Tom Tromey
@ 2000-06-27 16:11         ` Jim Ingham
  0 siblings, 0 replies; 8+ messages in thread
From: Jim Ingham @ 2000-06-27 16:11 UTC (permalink / raw)
  To: Tom Tromey, Mo DeJong; +Cc: Insight

Also sprach Tom Tromey:

> Mo> The ps thing is a mess. What we really need is a C library that
> Mo> will look at the process table and report results in a cross
> Mo> platform way.
> 
> Look at libgtop, part of Gnome.
> 
> Tom

Have you tried this on Solaris lately?  The last time I tried the gtop
application on Solaris 2.5 (about 3 or 4 months ago) it was pretty unstable,
and I don't think it was the GUI part, since it would just go away every so
often while it was sitting there quietly updating itself; enough so oftens
that I stopped using it.

Maybe it has gotten better...

Jim 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Attach filter should use glob matching not regexp.
@ 2000-06-16 18:27 Mo DeJong
  0 siblings, 0 replies; 8+ messages in thread
From: Mo DeJong @ 2000-06-16 18:27 UTC (permalink / raw)
  To: insight

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.

Mo Dejong
Red Hat Inc.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2000-06-27 16:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <394C203C.7882A1A1@cygnus.com>
2000-06-26  7:52 ` Attach filter should use glob matching not regexp Mo DeJong
2000-06-26 10:48   ` Jim Ingham
2000-06-26 10:55     ` Tom Tromey
2000-06-26 11:05       ` Jim Ingham
2000-06-26 16:12     ` Mo DeJong
2000-06-26 20:31       ` Tom Tromey
2000-06-27 16:11         ` Jim Ingham
2000-06-16 18:27 Mo DeJong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).