I'm stepping through some Swift code in Xcode and I'd like to watch values. Following the advice in many of the answers here (e.g. this one) I can add the expression to the local variables window.
The breakpoint I am on is the last line of this fragment from the Starscream library (by daltoniam) which I include as a pod.
for i in 0..<dataLength {
buffer[offset] = data[i] ^ maskKey[i % MemoryLayout<UInt32>.size]
offset += 1
}
var total = 0
I've added two expressions to watch:
buffer[0] and
MemoryLayout<UInt32>.size
For both the value I see is "invalid expression":
These expressions are clearly are not invalid, if they were the code would have thrown an exception when they were encountered executing the previous few lines. What am I missing? How should I watch and not get 'invalid expression'
N.B. If I call p buffer[0] from the lldb prompt I get the cryptic error:
(lldb) p buffer[0]
error: warning: :12:9: warning: initialization of variable
'$__lldb_error_result' was never used; consider replacing with assignment to '_'
or removing it
var $__lldb_error_result = __lldb_tmp_error
~~~~^~~~~~~~~~~~~~~~~~~~
_
error: :19:5: error: value of type 'WebSocket' has no member
'$__lldb_wrapped_expr_72'
$__lldb_injected_self.$__lldb_wrapped_expr_72(
^~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~
I have tried changing the podfile (as per Jim's answer) so that it explicitly gets the debug code:
pod 'Starscream', '~> 3.0.6', :configuration => 'Debug'
and I have even gone as far as removing the pods, cloning Starscream, and including the source code as a sub-project. I still get the same error.
An expression that accesses buffer[0] where buffer is a UnsafeMutablePointer works correctly in the expression parser when I'm stopped in some simple function. And from your experience with the expr command directly, it looks like your problem is not with this particular expression. Rather it looks like there's something about the context you are stopped in that's tripping up the expression parser altogether.
Make sure that you aren't using binary cocoapods's and that you've rebuilt all your code and all the pods you are using have been rebuilt from scratch with the same swift compiler. At present, lldb and swiftc are version locked - lldb can only debug programs built with the swiftc that it ships with.
If that doesn't fix the issue, then we'll need to figure out what about the particular function you are stopped in that's causing the problem. This seems like the sort of thing better dealt with by filing a bug with the swift project (http://bugs.swift.org).
Related
i'm using 2 functions simultaneously, one that takes input with getChar and other that draws some characters con the terminal, however, i'm using ansi-terminal to move the cursor on the screen
the problem is that when i compile throws the next error
user error (pattern match failure in do expression at libraries\Win32\System\Win32\Types.hsc
this only happens when i set "+RTS --io-manager=native" flag, but that is necesary 'cause getChar doesn's work properly without it
This has been fixed in version 2.12.0.1 of Win32. See this issue.
If you're using cabal I think you can make a cabal.project file with these contents:
packages: .
constraints: Win32 >= 2.12.0.1
Or if you use stack I believe you can add Win32-2.12.0.1 to your extra-deps in your stack.yaml.
I am trying to install ghc-mod so that I can use ide-haskell in Atom.
The instructions say to use stack build ghc-mod. It seems that GHC 8.2+ is not supported by ghc-mod, so I set my resolver to lts-9.21.
When running stack build ghc-mod, I keep getting this error (emphasis mine; not using code formatting because line wrap helps readability):
aeson > : can't load .so/.DLL for: /Users/timoffex/.stack/snapshots/x86_64-osx/db354248ca37308313a93487c93190e1d5b819629b60b38b68871c9a691e52b9/8.0.2/lib/x86_64-osx-ghc-8.0.2/libHStime-locale-compat-0.1.1.3-KZ1jqNx8uhlHjmuPPj6V1Y-ghc8.0.2.dylib (dlopen(/Users/timoffex/.stack/snapshots/x86_64-osx/db354248ca37308313a93487c93190e1d5b819629b60b38b68871c9a691e52b9/8.0.2/lib/x86_64-osx-ghc-8.0.2/libHStime-locale-compat-0.1.1.3-KZ1jqNx8uhlHjmuPPj6V1Y-ghc8.0.2.dylib, 5): REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB has segment 2 which is not a writable segment (__LINKEDIT) in /Users/timoffex/.stack/snapshots/x86_64-osx/db354248ca37308313a93487c93190e1d5b819629b60b38b68871c9a691e52b9/8.0.2/lib/x86_64-osx-ghc-8.0.2/libHStime-locale-compat-0.1.1.3-KZ1jqNx8uhlHjmuPPj6V1Y-ghc8.0.2.dylib)
... (later)
-- While building package aeson-1.1.2.0 using:
/Users/timoffex/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-osx/Cabal-1.24.2.0 build --ghc-options ""
Process exited with code: ExitFailure 1
Progress 1/4
Here's a snippet from the above that looks weird to me:
REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB has segment 2 which is not a writable segment
I am running macOS Catalina 10.15.3.
I can't find any mention of this online except for this open GitHub issue: https://github.com/facebook/duckling/issues/446
I also tried lts-7.24. I get the exact same error, except it happens while building profunctors.
What could be the problem? Where can I file a bug?
I had the same error in a project using resolver: lts-9.17.
What fixed it for me is to update stack.yaml and use this line:
resolver: lts-10.9
I'm trying to get the example code (HelloScalaFX) on http://www.scalafx.org/ to run. However, the line
fill <== when (hover) choose Color.Green
otherwise Color.Red
give me the error
overloaded method value <== with alternatives: (v:
scalafx.beans.value.ObservableValue[_ <:
javafx.scene.paint.Paint, _ <: javafx.scene.paint.Paint])Unit <and> (v:
javafx.beans.value.ObservableValue[_ <: javafx.scene.paint.Paint])Unit cannot be applied to
(scalafx.Includes.ObjectConditionBuilder[javafx.scene.paint.Color])
If I delete the offending lines, I get no compile errors, but running it gives:
Error: Could not find or load main class HelloStageDemo
How do I resolve the overloading and get this to work?
OSX 10.11.5
JavaSE-1.8
Scala IDE build of Eclipse SDK (4.3.0)
Scala Library container 2.11.8
scalafx_2.12.0-M4-8.0.92-R10.jar
Thanks,
Dave
First, there should be no line break before otherwise, that code would not compile in Scala. It should be:
fill <== when (hover) choose Color.Green otherwise Color.Red
There was a break on the http://www.scalafx.org/ due to page layout, it is now corrected.
The second error, "Could not find or load main class", is not ScalaFX or JavaFX related but probably something with your code that you did not include in the question or with Eclipse setup.
When building the latest grub2 (2.00) I get this error.
I have tried adding -Wno-unused-function to both HOST_CFLAGS, HOST_CPPFLAGS, TARGET_CPPFLAGS and TARGET_CFLAGS in the Makefile. I even tried deleting that function whilst make was running!
Unfortunately the error remains.
Have you seen this?
The latest flex makes the GRUB-2.00 build fail. I can work around the issues with --disable-werror, but grub-core/script/yylex.l causes two warnings that do not work with -Werror.
./grub-core/script/yylex.l: At top level:
grub_script.yy.c:2351:13: error: 'yy_fatal_error' defined but not used
This can be fixed by removing #define YY_FATAL_ERROR(msg) in yylex.l.
However, according to this post this seems to have been fixed.
Judging from the info on the net you either want to switch to grub 2.02 or try an older version of flex.
So I downloaded and installed Microsoft Accelerator v2 to use ParallelArrays. I have referenced it in my project but when I try and execute the code from the module in a script file I get:
"The namespace 'ParallelArrays' is not defined
I have followed the instructions on this post:
Microsoft Accelerator library with Visual Studio F#
I've added a reference to the managed version "Microsoft.Accelerator.dll" to my F# project and then added the native "Accelerator.dll" as an item in my solution and set it's 'Copy To Output Directory' to Copy Always.
Still getting the FSI error and inline error in my script file on the '#load ...' line, however the solution builds fine, and no error in the module file.
Any ideas on what I'm missing? I'm sure it's something stupid.
Thanks,
Justin
UPDATE
I tried mydogisbox's advice, which got rid of the error above, but now when I run the code in the .fsx file I get this error instead:
--> Referenced 'F:\Work\GitHub\qf-sharp\qf-sharp\bin\Debug\Microsoft.Accelerator.dll' (file may be locked by F# Interactive process)
[Loading F:\Work\GitHub\qf-sharp\qf-sharp\MonteCarloGPU.fs]
error FS0192: internal error: F:\Work\GitHub\qf-sharp\qf-sharp\Accelerator.dll: bad cli header, rva 0
UPDATE 2
So the bad header error has dissapeared, but now I get this instead:
Microsoft.ParallelArrays.AcceleratorException: Failure to create a DirectX 9 device.
at Microsoft.ParallelArrays.ParallelArrays.ThrowNativeAcceleratorException()
at Microsoft.ParallelArrays.DX9Target..ctor()
at <StartupCode$FSI_0002>.$FSI_0002_MonteCarloGPU.main#() in F:\Work\GitHub\qf- sharp\qf-sharp\MonteCarloGPU.fs:line 14
Stopped due to error
I found this thread on MSDN however the answers proposed as fixes on that thread barely even relate to the question.
http://social.msdn.microsoft.com/Forums/vstudio/en-US/98600646-0345-4f62-a6c5-f03ac9c77179/ms-accelerator?forum=csharpgeneral
My Direct X version is 11, and I imagine that will suffice, however I tried installing DX9 however, it tells me that a newer version is detected therefore cant install.
There are special directives for referencing dlls from fsi. The #load directive loads the .fs file only. You need to use the #r directive to reference the file. You can either use the full path of the file or you can use #I to include the path to the file. More details here. Keep in mind that fsi is completely independent of your project, so all references in your project must be duplicated in fsi for it to access the same types.