OSDN Git Service

* attachdlg.itb (list_pids): Use "ps axw" to get pid list
authormdejong <mdejong>
Thu, 26 Oct 2000 18:31:38 +0000 (18:31 +0000)
committermdejong <mdejong>
Thu, 26 Oct 2000 18:31:38 +0000 (18:31 +0000)
        when running under Linux. Use string match instead of
        regexp match is ps filter entry.
        * attachdlg.ith (list_pids): Change default argument to "*".

gdb/gdbtk/library/ChangeLog
gdb/gdbtk/library/attachdlg.itb
gdb/gdbtk/library/attachdlg.ith

index f0b73d7..b6ad980 100644 (file)
@@ -1,3 +1,10 @@
+2000-10-26  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 3b1c78d..00d5a44 100644 (file)
@@ -37,6 +37,8 @@ body AttachDlg::build_win {} {
       -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,18 @@ body AttachDlg::choose_symbol_file {} {
 #           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 *}} {
+  global tcl_platform
+
+  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 @@ You will have to enter the PID by hand."
   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 @@ You will have to enter the PID by hand."
 
   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 b0b6a11..b31130c 100644 (file)
@@ -21,7 +21,7 @@ class AttachDlg {
     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 {}