GDB (API)
|
00001 # TfindArgs 00002 # Copyright (C) 1998, 1999 Cygnus Solutions 00003 # 00004 # This program is free software; you can redistribute it and/or modify it 00005 # under the terms of the GNU General Public License (GPL) as published by 00006 # the Free Software Foundation; either version 2 of the License, or (at 00007 # your option) any later version. 00008 # 00009 # This program is distributed in the hope that it will be useful, 00010 # but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 # GNU General Public License for more details. 00013 00014 00015 # ---------------------------------------------------------------------- 00016 # Implements tfind arguments dialogs 00017 # 00018 # PUBLIC ATTRIBUTES: 00019 # 00020 # Type .........Type of dialog (tfind pc, tfind line, tfind tracepoint) 00021 # 00022 # config ....... used to change public attributes 00023 # 00024 # PRIVATE METHODS 00025 # 00026 # X11 OPTION DATABASE ATTRIBUTES 00027 # 00028 # 00029 # ---------------------------------------------------------------------- 00030 00031 itcl_class TfindArgs { 00032 # ------------------------------------------------------------------ 00033 # CONSTRUCTOR - create new tfind arguments dialog 00034 # ------------------------------------------------------------------ 00035 constructor {config} { 00036 # 00037 # Create a window with the same name as this object 00038 # 00039 set class [$this info class] 00040 set hull [namespace tail $this] 00041 set old_name $this 00042 ::rename $this $this-tmp- 00043 ::frame $hull -class $class 00044 ::rename $hull $old_name-win- 00045 ::rename $this $old_name 00046 build_win 00047 } 00048 00049 # ------------------------------------------------------------------ 00050 # METHOD: build_win - build the dialog 00051 # ------------------------------------------------------------------ 00052 method build_win {} { 00053 00054 frame $hull.f 00055 frame $hull.f.a 00056 frame $hull.f.b 00057 set f $hull.f.a 00058 00059 switch $Type { 00060 LN { 00061 set text "Enter argument: " 00062 } 00063 PC { 00064 set text "Enter PC value: " 00065 } 00066 TP { 00067 set text "Enter Tracepoint No.: " 00068 } 00069 FR { 00070 set text "Enter Frame No.:" 00071 } 00072 00073 if {[string compare $Type $last_type]} != 0} { 00074 global argument 00075 set argument "" 00076 } 00077 00078 set last_type $Type 00079 00080 label $f.1 -text $text 00081 entry $f.2 -textvariable argument -width 10 00082 $f.2 selection range 0 end 00083 grid $f.1 $f.2 -padx 4 -pady 4 -sticky nwe 00084 00085 button $hull.f.b.ok -text OK -command "$this ok" -width 7 -default active 00086 button $hull.f.b.quit -text Cancel -command "delete object $this" -width 7 00087 grid $hull.f.b.ok $hull.f.b.quit -padx 4 -pady 4 -sticky ews 00088 00089 pack $hull.f.a $hull.f.b 00090 grid $hull.f 00091 00092 focus $f.2 00093 bind $f.2 <Return> "$this.f.b.ok flash; $this.f.b.ok invoke" 00094 00095 } 00096 00097 # ------------------------------------------------------------------ 00098 # DESTRUCTOR - destroy window containing widget 00099 # ------------------------------------------------------------------ 00100 destructor { 00101 set top [winfo toplevel $hull] 00102 manage delete $this 1 00103 destroy $this 00104 destroy $top 00105 } 00106 00107 00108 00109 # ------------------------------------------------------------------ 00110 # METHOD: ok - do it and quit 00111 # ------------------------------------------------------------------ 00112 method ok {} { 00113 do_it 00114 delete 00115 } 00116 00117 00118 # ------------------------------------------------------------------ 00119 # METHOD: do_it - call the gdb command 00120 # ------------------------------------------------------------------ 00121 method do_it {} { 00122 global argument 00123 00124 00125 switch $Type { 00126 LN { tfind_cmd "tfind line $argument"} 00127 PC { tfind_cmd "tfind pc $argument"} 00128 TP { tfind_cmd "tfind tracepoint $argument"} 00129 FR { tfind_cmd "tfind $argument"} 00130 } 00131 } 00132 00133 00134 public Type 00135 common last_type {} 00136 private hull 00137 00138 00139 }