From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28297 invoked by alias); 16 Sep 2005 09:56:55 -0000 Mailing-List: contact insight-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: insight-owner@sourceware.org Received: (qmail 28267 invoked by uid 22791); 16 Sep 2005 09:56:43 -0000 Received: from mail5.kpit.com (HELO sohm.kpit.com) (203.197.93.231) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Fri, 16 Sep 2005 09:56:43 +0000 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: Patch for Memory Window of Insight Date: Fri, 16 Sep 2005 09:56:00 -0000 Message-ID: <4A1BE23A7B777442B60F4B4916AE0F130791B494@sohm.kpit.com> From: "Aditya Katti" To: X-SW-Source: 2005-q3/txt/msg00103.txt.bz2 Hi, Please find below a patch for Insight (memwin.itb). It addresses the follow= ing problems of Memory Window: 1. On selecting the "Go To" option in pop-up menu of Memory Window with no = active cell in table we get an error: 'wrong # args: should be ".memwin0.me= mwin goto addr"'. This patch handles that error. 2. If the user selects a cell, clears the contents of that cell i.e makes t= hat cell blank and clicks on "Go To" in pop-up menu then that too gives an = error. The error is same as mentioned in (1). This patch handles that error. 3. Select Octal/Signed Decimal/Unsigned Decimal Format by clicking "Prefere= nces" in pop-up menu or from Addresses menu. Now, select a cell in the table of Memory Window, edit the value of that ce= ll and move to another cell. You will notice that the previous cell is upda= ted but data is always Hexadecimal irrespective of the selected format (Oct= al,Signed Decimal,Unsigned Decimal,Hexadecimal etc.). This patch will now d= isplay the data in selected format for Octal, Signed Decimal, Unsigned Deci= mal and Hexadecimal Format. Note: Binary Format still needs to be fixed. 4. When user moves to a new cell leaving the previous cell blank i.e no dat= a then we get an error: 'expected integer but got ""'. This patch will hand= le that error. 5. Select any cell, type invalid values in that, say "xyz". Use the Go To o= ption in pop-up menu. Memory window cells are disabled but at the top left = of Memory Window the address is shown as "xyz". Now if you try to increment= or decrement the address using the widget (Spinner Widget - Arrows) at the= top left of Memory Window then Insight crashes. This patch handles that pr= oblem. For gdb/gdbtk/ChangeLog: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3Dgdb/gdbtk/ChangeLo= g=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 2005-09-01 Aditya Katti * library/memwin.itb (do_popup): * library/memwin.itb (goto): Validates Address * library/memwin.itb (edit): Validates Address, Changes format of "val" t= o selected format for Octal, Signed Decimal, Unsigned Decimal and Hexadecim= al Formats. =20=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D For gdb/gdbtk/library/memwin.itb: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3Dgdb/gdbtk/library/memwin.itb= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D *** insight-6.1/gdb/gdbtk/library/memwin.itb.orig Fri Sep 2 15:40:00 2005 --- insight-6.1/gdb/gdbtk/library/memwin.itb Wed Sep 14 12:16:20 2005 *************** *** 274,278 **** if {$col =3D=3D $Numcols} {=20 # editing the ASCII field ! set addr [gdb_incr_addr $current_addr [expr {$bytes_per_row * $row}]] set start_addr $addr =20=20 --- 274,283 ---- if {$col =3D=3D $Numcols} {=20 # editing the ASCII field ! # Check whether address is valid using format ! if { [catch {format "%x" $current_addr}] } { ! return ! } else { ! set addr [gdb_incr_addr $current_addr [expr {$bytes_per_row * $row}= ]] ! } set start_addr $addr =20=20 *************** *** 306,317 **** return } !=20 ! # calculate address based on row and column ! set addr [gdb_incr_addr $current_addr [expr {$bytes_per_row * $row + $s= ize * $col}]] #debug " edit $row,$col $addr =3D $val" =20=20 # Pad the value with zeros, if necessary set s [expr {$size * 2}] ! set val [format "0x%0${s}x" $val] =20=20 # set memory --- 311,329 ---- return } !=20=20=20 ! # Check whether address is valid using format ! if { [catch {format "%x" $current_addr}] } { ! return ! } else { ! # calculate address based on row and column ! set addr [gdb_incr_addr $current_addr [expr {$bytes_per_row * $row + = $size * $col}]] ! } #debug " edit $row,$col $addr =3D $val" =20=20 # Pad the value with zeros, if necessary set s [expr {$size * 2}] ! if { [catch {set val [format "0x%0${s}x" $val]}] } { ! return ! } =20=20 # set memory *************** *** 338,341 **** --- 350,364 ---- set val [string trimright $val] set val [string trimleft $val] + if { $format =3D=3D "o" } { + # Selected Format is Octal + catch { set val [format "0%o" $val]} + } elseif { $format =3D=3D "u" } { + # Selected Format is Unsigned Decimal + catch { set val [format "%u" $val]} + } elseif { $format =3D=3D "d" } { + # Selected Format is Signed Decimal + catch { set val [format "%d" $val]} + } +=20=20=20 set ${this}_memval($row,$col) $val } *************** *** 544,550 **** return } set old_addr $current_addr ! set current_addr [gdb_incr_addr $current_addr [expr {$bytes_per_row * $= num}]] !=20 # A memory address less than zero is probably not a good thing... # --- 567,580 ---- return } +=20=20=20 + if { [catch {format "%x" $current_addr}] } { + return + }=20 +=20=20=20 set old_addr $current_addr ! if { [catch {set current_addr [gdb_incr_addr $current_addr [expr {$byte= s_per_row * $num}]] } ] } { ! return ! } !=20=20=20 # A memory address less than zero is probably not a good thing... # *************** *** 662,666 **** -command [code $this _update_address 1] $itk_component(table).menu add command -label "Go To [$itk_component(ta= ble) curvalue]" -underline 0 \ ! -command "$this goto [$itk_component(table) curvalue]" $itk_component(table).menu add command -label "Open New Window at [$itk= _component(table) curvalue]" -underline 0 \ -command [list ManagedWin::open MemWin -force -addr_exp [$itk_compone= nt(table) curvalue]] --- 692,696 ---- -command [code $this _update_address 1] $itk_component(table).menu add command -label "Go To [$itk_component(ta= ble) curvalue]" -underline 0 \ ! -command [code $this goto [$itk_component(table) curvalue]] $itk_component(table).menu add command -label "Open New Window at [$itk= _component(table) curvalue]" -underline 0 \ -command [list ManagedWin::open MemWin -force -addr_exp [$itk_compone= nt(table) curvalue]] *************** *** 675,682 **** # ------------------------------------------------------------------ itcl::body MemWin::goto { addr } { ! set current_addr $addr ! $itk_interior.f.cntl delete 0 end ! $itk_interior.f.cntl insert end $addr ! _update_address 1 } =20=20 --- 705,726 ---- # ------------------------------------------------------------------ itcl::body MemWin::goto { addr } { ! set goto_error_flag "no_error" ! # Check whether address is valid using format ! if { [catch {set temp [format "%x" $addr]}]} { ! if { [catch {set temp [format "%f" $addr]}]} { ! set goto_error_flag "error"=20 ! } ! } else { ! set temp 0x$temp ! } !=20=20=20 ! if { $goto_error_flag =3D=3D "error"} { ! error_dialog "Invalid Address $addr" ! } else { ! set current_addr $temp ! $itk_interior.f.cntl delete 0 end ! $itk_interior.f.cntl insert end $temp ! _update_address 1=20=20=20 ! } } =20=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3DEnd Of Patch=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Regards, Aditya Katti KPIT Cummins Infosystems Limited Pune, INDIA