public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* PATCH: Fix file name handling when running on Cygwin
@ 2000-10-04 12:09 Fernando Nasser
  2000-10-04 12:16 ` Syd Polk
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Fernando Nasser @ 2000-10-04 12:09 UTC (permalink / raw)
  To: insight, David Taylor, grante, Taruna Gandhi

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\""
        return -1
        } else {
        set Stwc($name:mtime) $file_time

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PATCH: Fix file name handling when running on Cygwin
  2000-10-04 12:09 PATCH: Fix file name handling when running on Cygwin Fernando Nasser
@ 2000-10-04 12:16 ` Syd Polk
  2000-10-04 14:19 ` PATCH: Fix file name handling when running on Cygwin (REPOST) Fernando Nasser
  2000-10-04 14:28 ` PATCH: Fix file name handling when running on Cygwin Syd Polk
  2 siblings, 0 replies; 7+ messages in thread
From: Syd Polk @ 2000-10-04 12:16 UTC (permalink / raw)
  To: Fernando Nasser, insight, David Taylor, grante, Taruna Gandhi

The patch looks good. Assuming that you have tested it, it is approved.

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\""
>         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.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PATCH: Fix file name handling when running on Cygwin (REPOST)
  2000-10-04 12:09 PATCH: Fix file name handling when running on Cygwin Fernando Nasser
  2000-10-04 12:16 ` Syd Polk
@ 2000-10-04 14:19 ` Fernando Nasser
  2000-10-04 14:31   ` Syd Polk
  2000-10-04 14:28 ` PATCH: Fix file name handling when running on Cygwin Syd Polk
  2 siblings, 1 reply; 7+ messages in thread
From: Fernando Nasser @ 2000-10-04 14:19 UTC (permalink / raw)
  To: insight, David Taylor, grante, Taruna Gandhi

And I made the same mistake on the first patch as well.  Here is the correct patch.

Sorry for any inconvenience caused.

-- 
Fernando Nasser
Red Hat - Toronto                       E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


*** srctextwin.itb      Wed Oct  4 17:12:43 2000
--- srctextwin.itb      Wed Oct  4 16:32:00 2000
***************
*** 865,876 ****
  #                          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
--- 865,885 ----
  #                          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
***************
*** 953,959 ****
      return
    }
    # no source; switch to assembly
! #  debug "no source file; switch to assembly"
    
    # We have to update this data here (it is also done by the caller)
    # because we want to call mode, which calls mode_set, which calls
--- 962,968 ----
      return
    }
    # no source; switch to assembly
!   dbug W "no source file; switch to assembly"
    
    # We have to update this data here (it is also done by the caller)
    # because we want to call mode, which calls mode_set, which calls
***************
*** 1206,1212 ****
      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 != ""} {
--- 1215,1221 ----
      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 != ""} {
***************
*** 2068,2074 ****
  #  METHOD:  mode_set - change the source mode
  # ------------------------------------------------------------------
  body SrcTextWin::mode_set {new_mode {go 1}} {
! #  debug "$new_mode"
  
    if {$new_mode != $current(mode)} {
  
--- 2077,2083 ----
  #  METHOD:  mode_set - change the source mode
  # ------------------------------------------------------------------
  body SrcTextWin::mode_set {new_mode {go 1}} {
!   debug "$new_mode"
  
    if {$new_mode != $current(mode)} {
  
***************
*** 2510,2517 ****
--- 2519,2528 ----
  # NOTES:      If you call this and a new widget is created which cannot be
  #             filled in later due to errors, call UnLoadFromCache.
  # -----------------------------------------------------------------------------
+ 
  body SrcTextWin::LoadFromCache {w name asm lib} {
    debug "LoadFromCache $w $name $asm"
+   global tcl_platform
    upvar ${w}win win
    upvar _${w}pane pane
  
***************
*** 2525,2531 ****
  
    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
--- 2536,2542 ----
  
    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
***************
*** 2557,2564 ****
      # out.
  
      if {$loadingSource} {
!       if {[catch {file mtime $name} file_time]} {
!       debug "Could not stat file \"$name\" - \"$file_time\""
        return -1
        } else {
          set Stwc($full_name:pane) pane$filenum
--- 2568,2580 ----
      # out.
  
      if {$loadingSource} {
!       if {[string compare $tcl_platform(platform) "windows"] == 0} {
!         set f [ide_cygwin_path to_win32 $name]
!       } else {
!         set f $name
!       }
!       if {[catch {file mtime $f} file_time]} {
!       debug "Could not stat file \"$f\" - \"$file_time\""
        return -1
        } else {
          set Stwc($full_name:pane) pane$filenum

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PATCH: Fix file name handling when running on Cygwin
  2000-10-04 12:09 PATCH: Fix file name handling when running on Cygwin Fernando Nasser
  2000-10-04 12:16 ` Syd Polk
  2000-10-04 14:19 ` PATCH: Fix file name handling when running on Cygwin (REPOST) Fernando Nasser
@ 2000-10-04 14:28 ` Syd Polk
  2 siblings, 0 replies; 7+ messages in thread
From: Syd Polk @ 2000-10-04 14:28 UTC (permalink / raw)
  To: Fernando Nasser, insight, David Taylor, grante, Taruna Gandhi

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.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PATCH: Fix file name handling when running on Cygwin (REPOST)
  2000-10-04 14:19 ` PATCH: Fix file name handling when running on Cygwin (REPOST) Fernando Nasser
@ 2000-10-04 14:31   ` Syd Polk
  2000-10-04 14:37     ` Chris Faylor
  2000-10-04 14:42     ` PATCH: Fix file name handling when running on Cygwin(REPOST) Fernando Nasser
  0 siblings, 2 replies; 7+ messages in thread
From: Syd Polk @ 2000-10-04 14:31 UTC (permalink / raw)
  To: Fernando Nasser, insight, David Taylor, grante, Taruna Gandhi

Approved, but I have a question.

Wouldn't it be easier to run the cygwin conversion when the files are given 
to gdbtk in the first place, instead of every place you might you the name 
in the file system?

At 05:19 PM 10/4/00 -0400, Fernando Nasser wrote:
>And I made the same mistake on the first patch as well.  Here is the 
>correct patch.
>
>Sorry for any inconvenience caused.
>
>--
>Fernando Nasser
>Red Hat - Toronto                       E-Mail:  fnasser@redhat.com
>2323 Yonge Street, Suite #300
>Toronto, Ontario   M4P 2C9
>
>
>*** srctextwin.itb      Wed Oct  4 17:12:43 2000
>--- srctextwin.itb      Wed Oct  4 16:32:00 2000
>***************
>*** 865,876 ****
>   #                          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
>--- 865,885 ----
>   #                          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
>***************
>*** 953,959 ****
>       return
>     }
>     # no source; switch to assembly
>! #  debug "no source file; switch to assembly"
>
>     # We have to update this data here (it is also done by the caller)
>     # because we want to call mode, which calls mode_set, which calls
>--- 962,968 ----
>       return
>     }
>     # no source; switch to assembly
>!   dbug W "no source file; switch to assembly"
>
>     # We have to update this data here (it is also done by the caller)
>     # because we want to call mode, which calls mode_set, which calls
>***************
>*** 1206,1212 ****
>       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 != ""} {
>--- 1215,1221 ----
>       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 != ""} {
>***************
>*** 2068,2074 ****
>   #  METHOD:  mode_set - change the source mode
>   # ------------------------------------------------------------------
>   body SrcTextWin::mode_set {new_mode {go 1}} {
>! #  debug "$new_mode"
>
>     if {$new_mode != $current(mode)} {
>
>--- 2077,2083 ----
>   #  METHOD:  mode_set - change the source mode
>   # ------------------------------------------------------------------
>   body SrcTextWin::mode_set {new_mode {go 1}} {
>!   debug "$new_mode"
>
>     if {$new_mode != $current(mode)} {
>
>***************
>*** 2510,2517 ****
>--- 2519,2528 ----
>   # NOTES:      If you call this and a new widget is created which cannot be
>   #             filled in later due to errors, call UnLoadFromCache.
>   # 
> -----------------------------------------------------------------------------
>+
>   body SrcTextWin::LoadFromCache {w name asm lib} {
>     debug "LoadFromCache $w $name $asm"
>+   global tcl_platform
>     upvar ${w}win win
>     upvar _${w}pane pane
>
>***************
>*** 2525,2531 ****
>
>     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
>--- 2536,2542 ----
>
>     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
>***************
>*** 2557,2564 ****
>       # out.
>
>       if {$loadingSource} {
>!       if {[catch {file mtime $name} file_time]} {
>!       debug "Could not stat file \"$name\" - \"$file_time\""
>         return -1
>         } else {
>           set Stwc($full_name:pane) pane$filenum
>--- 2568,2580 ----
>       # out.
>
>       if {$loadingSource} {
>!       if {[string compare $tcl_platform(platform) "windows"] == 0} {
>!         set f [ide_cygwin_path to_win32 $name]
>!       } else {
>!         set f $name
>!       }
>!       if {[catch {file mtime $f} file_time]} {
>!       debug "Could not stat file \"$f\" - \"$file_time\""
>         return -1
>         } else {
>           set Stwc($full_name:pane) pane$filenum

Syd Polk		spolk@redhat.com
Engineering Manager	+1 415 777 9810 x 241
Red Hat, Inc.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PATCH: Fix file name handling when running on Cygwin (REPOST)
  2000-10-04 14:31   ` Syd Polk
@ 2000-10-04 14:37     ` Chris Faylor
  2000-10-04 14:42     ` PATCH: Fix file name handling when running on Cygwin(REPOST) Fernando Nasser
  1 sibling, 0 replies; 7+ messages in thread
From: Chris Faylor @ 2000-10-04 14:37 UTC (permalink / raw)
  To: Syd Polk; +Cc: Fernando Nasser, insight, David Taylor, grante, Taruna Gandhi

On Wed, Oct 04, 2000 at 02:32:48PM -0700, Syd Polk wrote:
>Approved, but I have a question.
>
>Wouldn't it be easier to run the cygwin conversion when the files are given 
>to gdbtk in the first place, instead of every place you might you the name 
>in the file system?

I thought that this actually was the way it was handled.  I'm not sure why
this is suddenly an issue.  Cygwin has always munged paths, so...

Maybe what we really need is a way of telling cygwin to always "emit
windows paths".

cgf

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PATCH: Fix file name handling when running on Cygwin(REPOST)
  2000-10-04 14:31   ` Syd Polk
  2000-10-04 14:37     ` Chris Faylor
@ 2000-10-04 14:42     ` Fernando Nasser
  1 sibling, 0 replies; 7+ messages in thread
From: Fernando Nasser @ 2000-10-04 14:42 UTC (permalink / raw)
  To: Syd Polk; +Cc: insight, David Taylor, grante, Taruna Gandhi

Syd Polk wrote:
> 
> Approved, but I have a question.
> 
> Wouldn't it be easier to run the cygwin conversion when the files are given
> to gdbtk in the first place, instead of every place you might you the name
> in the file system?
> 

There is only a few places where we run these files through Tcl commands.
Most of the other things go through Cygwin compiled code (gdb/gdbtk itself).
Also, the debug information is stored in the Cygwin way because the compiler
is a Cygwin compiler, not a Win32 program.

I actually followed Jim Ingham suggestion and, after looking a t the code,
I understood clearly why he proposed we did it this way.

-- 
Fernando Nasser
Red Hat - Toronto                       E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2000-10-04 14:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-10-04 12:09 PATCH: Fix file name handling when running on Cygwin Fernando Nasser
2000-10-04 12:16 ` Syd Polk
2000-10-04 14:19 ` PATCH: Fix file name handling when running on Cygwin (REPOST) Fernando Nasser
2000-10-04 14:31   ` Syd Polk
2000-10-04 14:37     ` Chris Faylor
2000-10-04 14:42     ` PATCH: Fix file name handling when running on Cygwin(REPOST) Fernando Nasser
2000-10-04 14:28 ` PATCH: Fix file name handling when running on Cygwin Syd Polk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).