public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* Attempt #2 at attach patch.
@ 2000-10-25  1:23 Mo DeJong
  2000-10-26 11:26 ` Fernando Nasser
  0 siblings, 1 reply; 2+ messages in thread
From: Mo DeJong @ 2000-10-25  1:23 UTC (permalink / raw)
  To: insight

Here is my second attempt to get this patch in. Last
time, Jim objected to changing the ps command because
it would no longer work on Solaris. This time, I made
the patch conditional so that it would do the right
thing under Linux and do the current thing in any
other case. This patch also changes the kind of
matching done on the ps filter. IMHO, it should
be a glob style match by default.

Ok to check in?

Mo DeJong
Red Hat Inc

Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/ChangeLog,v
retrieving revision 1.37
diff -u -r1.37 ChangeLog
--- ChangeLog	2000/10/23 22:44:07	1.37
+++ ChangeLog	2000/10/25 08:18:40
@@ -1,3 +1,10 @@
+2000-10-24  Mo DeJong  <mdejong@redhat.com>
+
+	* attachdlg.itb (list_pids): Use "ps axw" to get pid list
+	when running under Linux. Use string match instead of
+	regexp match is ps filter entry.
+	* attachdlg.ith (list_pids): Change default argument to "*".
+
 2000-10-23  Fernando Nasser  <fnasser@cygnus.com>
 
 	* util.tcl (find_iwidgets_library): Use the directories that were
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/10/25 08:18:40
@@ -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 {}
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/10/25 08:18:40
@@ -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
@@ -152,9 +154,19 @@
 #           all the different ps flags & output formats.  At some
 #           point we should steal some C code to do it by hand.
 # ------------------------------------------------------------------
+
+body AttachDlg::list_pids {{pattern *}} {
+  global tcl_platform
 
-body AttachDlg::list_pids {{expr {}}} {
-  if {[catch {::open "|ps w" r} psH]} {
+  switch $tcl_platform(os) {
+    Linux {
+      set ps_cmd "ps axw"
+    }
+    default {
+      set ps_cmd "ps w"
+    }
+  }
+  if {[catch {::open "|$ps_cmd" 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 +175,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 +187,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
     }

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

* Re: Attempt #2 at attach patch.
  2000-10-25  1:23 Attempt #2 at attach patch Mo DeJong
@ 2000-10-26 11:26 ` Fernando Nasser
  0 siblings, 0 replies; 2+ messages in thread
From: Fernando Nasser @ 2000-10-26 11:26 UTC (permalink / raw)
  To: Mo DeJong; +Cc: insight

Mo DeJong wrote:
> 
> Here is my second attempt to get this patch in. Last
> time, Jim objected to changing the ps command because
> it would no longer work on Solaris. This time, I made
> the patch conditional so that it would do the right
> thing under Linux and do the current thing in any
> other case. This patch also changes the kind of
> matching done on the ps filter. IMHO, it should
> be a glob style match by default.
> 
> Ok to check in?
> 
> Mo DeJong
> Red Hat Inc
> 

Sure.  Go ahead.

Thanks for the patch.

Regards,
Fernando



> Index: ChangeLog
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbtk/library/ChangeLog,v
> retrieving revision 1.37
> diff -u -r1.37 ChangeLog
> --- ChangeLog   2000/10/23 22:44:07     1.37
> +++ ChangeLog   2000/10/25 08:18:40
> @@ -1,3 +1,10 @@
> +2000-10-24  Mo DeJong  <mdejong@redhat.com>
> +
> +       * attachdlg.itb (list_pids): Use "ps axw" to get pid list
> +       when running under Linux. Use string match instead of
> +       regexp match is ps filter entry.
> +       * attachdlg.ith (list_pids): Change default argument to "*".
> +
>  2000-10-23  Fernando Nasser  <fnasser@cygnus.com>
> 
>         * util.tcl (find_iwidgets_library): Use the directories that were
> 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/10/25 08:18:40
> @@ -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 {}
> 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/10/25 08:18:40
> @@ -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
> @@ -152,9 +154,19 @@
>  #           all the different ps flags & output formats.  At some
>  #           point we should steal some C code to do it by hand.
>  # ------------------------------------------------------------------
> +
> +body AttachDlg::list_pids {{pattern *}} {
> +  global tcl_platform
> 
> -body AttachDlg::list_pids {{expr {}}} {
> -  if {[catch {::open "|ps w" r} psH]} {
> +  switch $tcl_platform(os) {
> +    Linux {
> +      set ps_cmd "ps axw"
> +    }
> +    default {
> +      set ps_cmd "ps w"
> +    }
> +  }
> +  if {[catch {::open "|$ps_cmd" 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 +175,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 +187,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
>      }

-- 
Fernando Nasser
Red Hat - Toronto                       E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9

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

end of thread, other threads:[~2000-10-26 11:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-10-25  1:23 Attempt #2 at attach patch Mo DeJong
2000-10-26 11:26 ` Fernando Nasser

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).