Fsharp: I can not see top level mutable variabel with debugger

Created on 21 Dec 2017  路  9Comments  路  Source: dotnet/fsharp

Repro steps

  1. Step A

    create mdb file

sample9$ ls
foo.fsx
sample9$ cat foo.fsx 
let x = "apple"
let y = "banana"
let mutable z = "cherry"
z <- "grape"

let foo () =
    let mutable a = 100
    let b = 200
    a <- 300
    (a,b)

foo()
sample9$ fsharpc -g --optimize- foo.fsx
F# Compiler for F# 4.1
Freely distributed under the Apache 2.0 Open Source License
sample9$ ls
foo.exe     foo.exe.mdb foo.fsx
  1. Step B

    debug foo.exe with sdb

sample9$ sdb 'run foo.exe'
Welcome to the Mono soft debugger (sdb 1.5.6548.37600)
Type 'help' for a list of commands or 'quit' to exit

Inferior process '2687' ('foo.exe') started
Inferior process '2687' ('foo.exe') exited with code '0'
(sdb) watch add z
Added watch '0' with expression 'z'
(sdb) bp add at foo.fsx 3
Breakpoint '0' added at '/Users/callmekohei/tmp/sample9/foo.fsx:3'
(sdb) r
Inferior process '2709' ('foo.exe') started
Hit breakpoint at '/Users/callmekohei/tmp/sample9/foo.fsx:3'
#0 [0x0000000D] <StartupCode$foo>.$Foo$fsx.main@ at /Users/callmekohei/tmp/sample9/foo.fsx:3
let mutable z = "cherry"
(sdb) watch
#0 'z': <namespace> it = z
#0 'z': <namespace> it = z
(sdb) s
Inferior process '2709' ('foo.exe') resumed
Inferior process '2709' ('foo.exe') suspended
#0 [0x00000017] <StartupCode$foo>.$Foo$fsx.main@ at /Users/callmekohei/tmp/sample9/foo.fsx:4
z <- "grape"
(sdb) watch
#0 'z': <namespace> it = z
#0 'z': <namespace> it = z
(sdb) s
Inferior process '2709' ('foo.exe') resumed
Inferior process '2709' ('foo.exe') suspended
#0 [0x00000021] <StartupCode$foo>.$Foo$fsx.main@ at /Users/callmekohei/tmp/sample9/foo.fsx:12
foo()
(sdb) watch
#0 'z': <namespace> it = z
#0 'z': <namespace> it = z
(sdb) kill
Inferior process '2709' ('foo.exe') exited with code '0'
(sdb) q
Bye
sample9$ 

like this

untitled

Expected behavior

watch z

#0 'z': string it = "cherry"

step into

watch z

#0 'z': string it = "grape"

Actual behavior

watch z

#0 'z': <namespace> it = z

step into

watch z

#0 'z': <namespace> it = z

Known workarounds

I do not know...

Related information

  • Operating system
tmp$ sw_vers 
ProductName:    Mac OS X
ProductVersion: 10.13.1
BuildVersion:   17B1003

tmp$ uname -a
Darwin callmekoheis-MacBook-Air.local
17.2.0 Darwin Kernel Version 17.2.0: Fri Sep 29 18:27:05 PDT 2017;
root:xnu-4570.20.62~3/RELEASE_X86_64 x86_64
  • .NET Runtime, CoreCLR or Mono Version
tmp$ mono --version
Mono JIT compiler version 5.0.1.1 (2017-02/5077205 Sun Sep 17 18:29:46 BST 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           normal
    SIGSEGV:       altstack
    Notification:  kqueue
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug 
    LLVM:          supported, not enabled.
    GC:            sgen (concurrent by default)
  • Editing Tools (e.g. Visual Studio Version)
tmp$ vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Dec 18 2017 09:51:58)
macOS version
Included patches: 1-1350
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl               +farsi             +mouse_sgr         -tag_any_white
+arabic            +file_in_path      -mouse_sysmouse    -tcl
+autocmd           +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
-balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
-browse            +fork()            -mzscheme          +textobjects
++builtin_terms    -gettext           +netbeans_intg     +timers
+byte_offset       -hangul_input      +num64             +title
+channel           +iconv             +packages          -toolbar
+cindent           +insert_expand     +path_extra        +user_commands
-clientserver      +job               +perl              +vertsplit
+clipboard         +jumplist          +persistent_undo   +virtualedit
+cmdline_compl     +keymap            +postscript        +visual
+cmdline_hist      +lambda            +printer           +visualextra
+cmdline_info      +langmap           +profile           +viminfo
+comments          +libcall           -python            +vreplace
+conceal           +linebreak         +python3           +wildignore
+cryptv            +lispindent        +quickfix          +wildmenu
+cscope            +listcmds          +reltime           +windows
+cursorbind        +localmap          +rightleft         +writebackup
+cursorshape       -lua               +ruby              -X11
+dialog_con        +menu              +scrollbind        -xfontset
+diff              +mksession         +signs             -xim
+digraphs          +modify_fname      +smartindent       -xpm
-dnd               +mouse             +startuptime       -xsmp
-ebcdic            -mouseshape        +statusline        -xterm_clipboard
+emacs_tags        +mouse_dec         -sun_workshop      -xterm_save
+eval              -mouse_gpm         +syntax            
+ex_extra          -mouse_jsbterm     +tag_binary        
+extra_search      +mouse_netterm     +tag_old_static    
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: clang   -L.             -L /BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.Internal.sdk/usr/local/libressl/lib -L/BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.Internal.sdk/usr/local/lib  -L/usr/local/lib -o vim        -lm  -lncurses -liconv -framework AppKit   -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl  -L/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/config-3.6m-darwin -lpython3.6m -framework CoreFoundation  -lruby.2.3.0 -lobjc   
Area-IDE Debug Severity-Medium bug

Most helpful comment

Workaround?
image

All 9 comments

On VS 2017
vs

Try to inspect children of the (magic) "this" node in "Locals" VS debug view.

@vasily-kirichenko
There are no local variable in startup code?
image

:( No "autos" either?

image
Nothing :(

Workaround?
image

Oh... @xuanduc987 Great! (^_^)/

I see.

Top level mutable variable needs namespace to look into a value.

Thanks!

I close issue.

screen shot 2017-12-21 at 17 29 49

screen shot 2017-12-21 at 17 30 06

screen shot 2017-12-21 at 17 30 26

Oh...

re-open

I think this is bug https://github.com/Microsoft/visualfsharp/issues/1003

@KevinRansom It would be really great if we could get the open namespaces propagated to the Portable PDB file

Was this page helpful?
0 / 5 - 0 ratings