This is the mail archive of the
insight@sources.redhat.com
mailing list for the Insight project.
Re: PATCH: Fix file name handling when running on Cygwin
- To: Fernando Nasser <fnasser at cygnus dot com>, insight at sourceware dot cygnus dot com, David Taylor <taylor at cygnus dot com>, grante at visi dot com, Taruna Gandhi <taruna at cygnus dot com>
- Subject: Re: PATCH: Fix file name handling when running on Cygwin
- From: Syd Polk <spolk at redhat dot com>
- Date: Wed, 04 Oct 2000 14:29:42 -0700
At 03:09 PM 10/4/00 -0400, Fernando Nasser wrote:
>This problem was detected by David Taylor and Grant Edwards.
>The solution followed a hint by Jim Ingham (thanks Jim) and was
>implemented by me after a nightmare walkthrough through the SrcWin (and
>friends)
>code (which I will cleanup as soon as possible!!!).
>
>The problem happened when your source files where at some cygwin path that
>was not syntactically equal to the native Windows path (anything that was
>created by the mount table or cygdrives would cause that).
>
>I have also fixed a small annoyance that caused the mode combobox to
>remain showing SOURCE when the user changed the mode in the combobox
>to SOURCE, reading the source failed and ASSEMBLER was assumed.
>
>Please give this a try and let me know if it works for you.
>
>
>
>--
>Fernando Nasser
>Red Hat - Toronto E-Mail: fnasser@redhat.com
>2323 Yonge Street, Suite #300
>Toronto, Ontario M4P 2C9
>
>
>Index: srctextwin.itb
>===================================================================
>RCS file: /cvs/cvsfiles/devo/gdb/gdbtk/library/srctextwin.itb,v
>retrieving revision 1.5
>diff -c -p -r1.5 srctextwin.itb
>*** srctextwin.itb 2000/05/01 04:46:49 1.5
>--- srctextwin.itb 2000/10/04 19:02:02
>*************** body SrcTextWin::ClearTags {} {
>*** 859,870 ****
> # has changed.
> # ------------------------------------------------------------------
> body SrcTextWin::_mtime_changed {filename} {
> set f [gdb_find_file $filename]
>
> if {$f == ""} {
> set r 1
> } else {
>! set mtime [file mtime $f]
> if {![info exists Stwc($filename:mtime)]} {
> debug "no mtime. resetting to zero"
> set Stwc($filename:mtime) 0
>--- 859,879 ----
> # has changed.
> # ------------------------------------------------------------------
> body SrcTextWin::_mtime_changed {filename} {
>+ global tcl_platform
>+
> set f [gdb_find_file $filename]
>
> if {$f == ""} {
> set r 1
> } else {
>! if {[string compare $tcl_platform(platform) "windows"] == 0} {
>! set f [ide_cygwin_path to_win32 $f]
>! }
>! if {[catch {file mtime $f} mtime]} {
>! debug "Could not stat file \"$f\" - \"$mtime\""
>! # The return code is not of much significance in this case
>! return 1
>! }
> if {![info exists Stwc($filename:mtime)]} {
> debug "no mtime. resetting to zero"
> set Stwc($filename:mtime) 0
>*************** body SrcTextWin::FillSource {w tagname f
>*** 942,948 ****
> return
> }
> # no source; switch to assembly
>! # debug "no source file; switch to assembly"
> set current(line) $line
> set current(tag) $tagname
> set current(addr) $addr
>--- 951,957 ----
> return
> }
> # no source; switch to assembly
>! dbug W "no source file; switch to assembly"
> set current(line) $line
> set current(tag) $tagname
> set current(addr) $addr
>*************** body SrcTextWin::location {tagname filen
>*** 1180,1185 ****
>--- 1189,1195 ----
> # ------------------------------------------------------------------
> body SrcTextWin::LoadFile {w name lib mtime_changed} {
> debug "$name $current(filename) $current(mode)"
>+ global tcl_platform
> upvar ${w}win win
> upvar _${w}pane pane
>
>*************** body SrcTextWin::LoadFile {w name lib mt
>*** 1190,1196 ****
> return 0
> } elseif {$result == 1 || $mtime_changed} {
> $win delete 0.0 end
>! # debug "READING $name"
> if {[catch {gdb_loadfile $win $name $Linenums} msg]} {
> dbug W "Error opening $name: $msg"
> #if {$msg != ""} {
>--- 1200,1206 ----
> return 0
> } elseif {$result == 1 || $mtime_changed} {
> $win delete 0.0 end
>! debug "READING $name"
> if {[catch {gdb_loadfile $win $name $Linenums} msg]} {
> dbug W "Error opening $name: $msg"
> #if {$msg != ""} {
>*************** body SrcTextWin::mode_get {} {
>*** 2006,2012 ****
> # METHOD: mode_set - change the source mode
> # ------------------------------------------------------------------
> body SrcTextWin::mode_set {new_mode {go 1}} {
>! # debug "$new_mode"
>
> if {$new_mode != $current(mode)} {
>
>--- 2016,2022 ----
> # METHOD: mode_set - change the source mode
> # ------------------------------------------------------------------
> body SrcTextWin::mode_set {new_mode {go 1}} {
>! debug "$new_mode"
>
> if {$new_mode != $current(mode)} {
>
>*************** body SrcTextWin::search {exp direction}
>*** 2450,2455 ****
>--- 2460,2466 ----
> #
> -----------------------------------------------------------------------------
> body SrcTextWin::LoadFromCache {w name asm lib} {
> debug "LoadFromCache $w $name $asm"
>+ global tcl_platform
> upvar ${w}win win
> upvar _${w}pane pane
>
>*************** body SrcTextWin::LoadFromCache {w name a
>*** 2463,2469 ****
>
> set oldpane $pane
> if {[info exists Stwc($full_name:pane)]} {
>! #debug "READING CACHE $full_name->$Stwc($full_name:pane)"
> set pane $Stwc($full_name:pane)
> if {$oldpane != ""} {
> $itk_interior.p replace $oldpane $pane
>--- 2474,2480 ----
>
> set oldpane $pane
> if {[info exists Stwc($full_name:pane)]} {
>! debug "READING CACHE $full_name->$Stwc($full_name:pane)"
> set pane $Stwc($full_name:pane)
> if {$oldpane != ""} {
> $itk_interior.p replace $oldpane $pane
>*************** body SrcTextWin::LoadFromCache {w name a
>*** 2489,2503 ****
>
> } else {
> debug "name=$name"
>- set Stwc($full_name:pane) pane$filenum
> # If we are trying to load a source file, check the time
> # to see if we need to update it. If we can't stat the
> # file then we probably can't open it either, so error
> # out.
>
> if {$loadingSource} {
>! if {[catch {file mtime $name} file_time]} {
>! debug "Could not stat file \"$name\" - \"$file_time\""
> return -1
> } else {
> set Stwc($name:mtime) $file_time
>--- 2500,2516 ----
>
> } else {
> debug "name=$name"
> # If we are trying to load a source file, check the time
> # to see if we need to update it. If we can't stat the
> # file then we probably can't open it either, so error
> # out.
>
> if {$loadingSource} {
>! if {[string compare $tcl_platform(platform) "windows"] == 0} {
>! set f [ide_cygwin_path to_win32 $name]
>! }
>! if {[catch {file mtime $f} file_time]} {
>! debug "Could not stat file \"$f\" - \"$file_time\""
This also looks bogus on non-windows platforms. f is not defined.
> return -1
> } else {
> set Stwc($name:mtime) $file_time
Syd Polk spolk@redhat.com
Engineering Manager +1 415 777 9810 x 241
Red Hat, Inc.