public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: Jim Ingham <jingham@apple.com>
To: Mo DeJong <mdejong@cygnus.com>
Cc: Insight <insight@sourceware.cygnus.com>
Subject: Re: Attach filter should use glob matching not regexp.
Date: Mon, 26 Jun 2000 10:48:00 -0000	[thread overview]
Message-ID: <B57CE579.1B41%jingham@apple.com> (raw)
In-Reply-To: <Pine.SOL.3.91.1000626074933.17772N-100000@cse.cygnus.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
> 

  reply	other threads:[~2000-06-26 10:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <394C203C.7882A1A1@cygnus.com>
2000-06-26  7:52 ` Mo DeJong
2000-06-26 10:48   ` Jim Ingham [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B57CE579.1B41%jingham@apple.com \
    --to=jingham@apple.com \
    --cc=insight@sourceware.cygnus.com \
    --cc=mdejong@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).