GDB (API)
/home/stan/gdb/src/gdb/gdbtk/library/tdump.tcl
Go to the documentation of this file.
00001 # Trace dump window for Insight
00002 # Copyright (C) 1998, 1999, 2001, 2002, 2004, 2008 Red Hat, Inc.
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 Tdump window for gdb
00017 #
00018 #   PUBLIC ATTRIBUTES:
00019 #
00020 #
00021 #   METHODS:
00022 #
00023 #     reconfig ....... called when preferences change
00024 #
00025 #
00026 #   X11 OPTION DATABASE ATTRIBUTES
00027 #
00028 #
00029 # ----------------------------------------------------------------------
00030 
00031 itcl::class TdumpWin {
00032   inherit ManagedWin GDBWin
00033 
00034   # ------------------------------------------------------------------
00035   #  CONSTRUCTOR - create new tdump window
00036   # ------------------------------------------------------------------
00037   constructor {args} {
00038     window_name "Trace Dump"
00039     build_win
00040     eval itk_initialize $args
00041   }
00042 
00043 
00044   # ------------------------------------------------------------------
00045   #  METHOD:  build_win - build the main tdump window
00046   # ------------------------------------------------------------------
00047   method build_win {} {
00048     itk_component add stext {
00049       iwidgets::scrolledtext $itk_interior.stext -hscrollmode dynamic \
00050   -vscrollmode dynamic -textfont global/fixed \
00051   -background $::Colors(bg)
00052     } {}
00053     [$itk_component(stext) component text] configure \
00054       -background $::Colors(bg)
00055     pack $itk_component(stext) -side left -expand yes -fill both
00056     update dummy
00057   }
00058 
00059 
00060   # ------------------------------------------------------------------
00061   #  METHOD:  update - update widget when PC changes
00062   # ------------------------------------------------------------------
00063   method update {event} {
00064     #debug "tdump: update"
00065     gdbtk_busy
00066     set tframe_num [gdb_get_trace_frame_num]
00067 
00068     if { $tframe_num!=-1 } {
00069       debug "doing tdump"
00070       $itk_component(stext) delete 1.0 end
00071 
00072       if {[catch {gdb_cmd "tdump $tframe_num" 0} tdump_output]} {
00073   tk_messageBox -title "Error" -message $tdump_output -icon error \
00074     -type ok
00075       } else {
00076   #debug "tdum output is $tdump_output"
00077   
00078   $itk_component(stext) insert end $tdump_output
00079   $itk_component(stext) see insert
00080       }
00081     }
00082     gdbtk_idle
00083   }
00084 
00085   # ------------------------------------------------------------------
00086   #  METHOD:  reconfig - used when preferences change
00087   # ------------------------------------------------------------------
00088   method reconfig {} {
00089     if {[winfo exists $itk_interior.stext]} { destroy $itk_interior.stext }
00090     build_win
00091   }
00092 }
00093 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines