From: mdejong Date: Thu, 26 Oct 2000 18:31:38 +0000 (+0000) Subject: * attachdlg.itb (list_pids): Use "ps axw" to get pid list X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=ece194f66a46a0037aa0db0a831edb931ef4aa89;p=pf3gnuchains%2Fsourceware.git * 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 "*". --- diff --git a/gdb/gdbtk/library/ChangeLog b/gdb/gdbtk/library/ChangeLog index f0b73d7ddb..b6ad980303 100644 --- a/gdb/gdbtk/library/ChangeLog +++ b/gdb/gdbtk/library/ChangeLog @@ -1,3 +1,10 @@ +2000-10-26 Mo DeJong + + * 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 * util.tcl (find_iwidgets_library): Use the directories that were diff --git a/gdb/gdbtk/library/attachdlg.itb b/gdb/gdbtk/library/attachdlg.itb index 3b1c78d544..00d5a44059 100644 --- a/gdb/gdbtk/library/attachdlg.itb +++ b/gdb/gdbtk/library/attachdlg.itb @@ -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 } diff --git a/gdb/gdbtk/library/attachdlg.ith b/gdb/gdbtk/library/attachdlg.ith index b0b6a1131a..b31130c243 100644 --- a/gdb/gdbtk/library/attachdlg.ith +++ b/gdb/gdbtk/library/attachdlg.ith @@ -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 {}