This is the mail archive of the insight@sources.redhat.com mailing list for the Insight project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Attempt #2 at attach patch.


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]