In the playground, how to turn off debug mode? - xcode6

I wanted to disable debug mode in Xcode 6 playground, but can't find how to do it. Is it possible at all?

Well, I wasn't able to find any official sources for what I'm writing now; but how should playground be able to work without debugging?
Playground doesn't simply execute your application and then shows your results nor does it execute your application step by step.
Xcode uses JIT compiling (just-in-time; Swift needs to be compiled) for your code (and every change you do) and then executes your binary and shows some information about your code which it considers useful.
So what it does is debugging your code but without the necessity for you to set breakpoints and check the state of your vars or return values on your own.
So you could consider it as some kind of real-time-debugging.
At least this is how I understood how things are going.

Related

Is there a way to view Dart pub serve output in WebStorm in a more 'build-error-list' way?

I'm experimenting with Dart/Angular/WebStorm for the first time. One thing which I've found a little jarring has been the build->error cycle. In Visual Studio, I am used to this work flow:
Write some code
Running a build
Having a fresh list of errors being created
Fixing a subset of them (some or all)
Go to 1.
I'm wondering what is the workflow with Dart?
I have the following issues:
I can't figure out a way to just run pub/transformer/whatever-it-is-that-roughly-equates-to-a-build. The only way I can do this is by attempting to run a configuration
When the transformer is run, it just dumps a gigantic error output to the Pub Serve window. It does not clear the existing output, so I end up with duplicate error or errors I've already fixed. So I'm left manually scrolling through the list but taking care not to So I must manually right-click and clear the output window and rerun it.
The transformer only runs when it detects a file change. This makes sense, but when coupled with 1 and 2, I've often cleared the output and I am running the transformer just to see a fresh list of errors. Which I don't get.
So my workflow becomes:
Write some code.
Run
Close dartium browser window (I'm not actually interested in running it, just seeing my errors)
See a bunch of errors. Realise that I didn't clear the errors from the previous run.
Right click and clear the pub serve output window.
Run again
Close dartium browser window again
Realise that the transformer has not run because it already ran in steps 1-3 and I haven't changed a file.
Change a file
Run again
Close dartium browser window again
Scroll through error list to find errors to fix
I find this a little cumbersome. Perhaps there is a philosophical point here on relying too much on my tooling to identify and fix errors (although I thought that was the entire point) but I'm just wondering what other people do to simplify this - I'm faintly surprised I appear to be alone in this.
You may run 'Pub Build' (available in the right-click menu of pubspec.yaml file and also right in the editor when pubspec is open). It is not incremental, so it runs longer (i.e. runs from scratch each time) but it gives you the list of errors just as if you've cleared Pub Serve output, edited each file in the project, started run configuration and closed a browser.
Sometimes errors are only shown when pub serve generates output the first time. For reloads some errors aren't shown anymore.
I'm not sure if this is a limitation of pub serve or a bug in the transformers.
pub serve is going to be replaced a new build system that builds to disk instead of in-memory only.
DDC isn't perfect yet either, but it's the future and I'd suggest to try this instead. There are known performance problems with Angular, but they are working on it.
See also
- https://webdev.dartlang.org/tools/dartdevc
- https://github.com/dart-lang/build

Add warning messages to ILineBreakpoint in Eclipse

I wrote custom remote debugger for a specific environment. However, the remote environment performs several optimizations that move or delete pieces of original code and therefore it can't accept all breakpoints. Before debugger session starts and connects to the remote runtime, we can't predict which of the breakpoints can't be set. I would like to keep these breakpoints as they are set in editor, but when the debugger starts, it must somehow tell the user that certain breakpoints are invalid. I think that these breakpoints should look different way, but I haven't found API methods for this purpose. I tried to set IMarker attributes such as IMarker.PROBLEM and IMarker.SEVERITY, but it didn't help. What is the best way to do this?
This code snippet from the Eclipse Debugger guide is probably what you are looking for:
public PDALineBreakpoint(IResource resource, int lineNumber) throws CoreException {
IMarker marker = resource.createMarker(
"org.eclipse.debug.examples.core.pda.lineBreakpoint.marker");
setMarker(marker);
setEnabled(true);
ensureMarker().setAttribute(IMarker.LINE_NUMBER, lineNumber);
ensureMarker().setAttribute(IBreakpoint.ID, IPDAConstants.ID_PDA_DEBUG_MODEL);
}
https://www.eclipse.org/articles/Article-Debugger/how-to.html
I've found solution by myself, but it looks like a dirty hack. It works only with IJavaLineBreakpoint, for another languages another solution required, but for now Java support is enough. IJavaLineBreakpoint had the isInstalled method that indicates whether the breakpoint is installed into some JVM. Unfortunately, you have no direct way to modity this flag. Internal implementation just exposes value of the org.eclipse.jdt.debug.core.installCount attribute. So, to set installed property of a breakpoint, you should do the following:
breakpoint.getMarker().setAttribute("org.eclipse.jdt.debug.core.installCount", 1);
Also, you can just increase/decrease this attribute the same way. However, I am not sure that this approach is compatible across versions of JDT.

Xcode Debugging not showing values

I'm completely stumped. I've been debugging for over a year and have only had this problem when the Build Configuration was set to Release. I have the Build Configuration set to Debug and I have checked to be sure I am attaching to the correct process and yet I still cannot see the values while stepping through the code. Has anybody else ran into this issue?
Here is a screen shot:
The value is returning, but I am unable to see the values of ANYTHING in this method or any of the other methods and I cannot figure out why.
Thank you for any hints you can give me.
============================== UPDATE ==================================
I've tried to print out the valued and this is the output I receive:
Notice though, that the value in the Variables view is correct for the result, even though I can't print it out. But the other values, like filePath should not be nil.
This is so weird.
============================== UPDATE ==================================
I put the breakpoint on the return statement and still no luck:
This time I see no value for result:
I was facing the same issue, On mouse hover and watch section for every variable it was showing nil value but while NSLog for those variables it was printing correct value.
now it's fixed. Try this
Go to Product menu > Scheme > Edit scheme or ⌘+<
In Run go to Info tab, change the build configuration to "debug".
Hope it will work.
#Lucy, ideally you shouldn't have to run in Release profile when debugging, Release is meant as an App Distribution profile with a small package size and little / no debug symbols.
But if you must debug on Release (e.g. due to Environment, data reasons), make sure you have the Optimization Level set to 'None' for Release.
You can reach the config above through:
1) Project wide settings - affects all Targets
2) Target specific setting - affects a single Target only
Don't forget to switch this back before App Store distribution. Lower Optimization will generate a larger ipk increasing your users' download time - also the potential dSYM generated.
Background
For context, Debug, Adhoc or Release profiles are purely to id different build configurations that XCode ships with. XCode starts projects with a Debug profile with no Optimization (and various other predefined config related to development & debugging), so symbol loading by the interpreter is possible - you're free to tweak this however you wish.
Theoretically able to establish a Release build profile that's identical to Debug.
I do see part of your problem. notice how self is nil?
That means you are in a method call for a de-allocated object. Turn on NSZombies to debug.
see this SO answer for how to enable NSZombie
Given that it is legal to send messages to nil in objective-C, I would suspect that the object is being deallocated as a side effect of calling doesLicenseFileExist, or by another thread.
You may find it helpful to put a breakpoint in IDLicenseCommands -dealloc method.
I had this problem, and turned "Link-Time Optimization" from "Incremental" to "No" and it resolved the debugging issue.

grunt lesslint how to prevent output from being written to console

We are trying to use grunt-lesslint in our project, as our UI developer is comfortable fix errors in less file. grunt-recess seems more powerful but not sure if it can point errors in less file itself. I am unable to comprehend enough from lesslint page, and there do not seem to be many examples. Does anyone know the following:
How to prevent lesslint from displaying on the console. I use formatters and the report file is generated, but it also prints on console, which I do not want to.
How to make lesslint fail only in the case of errors (not warnings). Also csslint seems to report errors also, while lesslint mostly gives warnings only, why is that so? Does lesslint throw errors as well? How to make it fail only in case of errors?
I tried using 'checkstyle-xml' formatter, but it does not seem to use it (I have used in jshint and it gives a properly formatted xml, which it does not give for lesslint).
Is it possible to compile less (many files or directories) in conjunction with lesslint? Any example?
Thanks,
Paddy
I'd say it's more of a common practice to display stdout for this kind of thing; the JSHint plugin does it, as does any other linting plugin that I've used. If you get in another developer that uses Grunt they'll probably expect stdout too. If you really want to override this, use grunt-verbosity: https://npmjs.org/package/grunt-verbosity
Again, this is a convention in Grunt; if a task has any warnings then it fails. The reason being if you lint a file and the linter flags something up it should be dealt with straight away, rather than delay it; six months time you have 500 errors that you haven't fixed and you're less likely to fix them then. Most linting plugins allow you to specify custom options (I've used CSS Lint and that is very customisable), so if you don't like a rule you can always disable it.
This should work. If there's a bug with this feature you should report it on the issue tracker, where it will be noticed by the developers of the plugin. https://github.com/kevinsawicki/grunt-lesslint/issues
Yes. You can set up a custom task that runs both your linter and compile in one step: something like grunt.registerTask('buildless', 'Lint and compile LESS files.', ['lesslint', 'less']); note that you'll have to install https://github.com/gruntjs/grunt-contrib-less to get that to work. Also note that, failing linting will not compile your LESS files; mandate that your code always passes the lint check; you'll help everyone involved in the project.

Xcode debugger in submodule

Working on an iOS App I'm using an static library integrated as a submodule. No problem, but when I want to step into a method of this submodule while debugging the debugger just step over that method call.
I guess it's related to the Build settings but I don't have any idea.
Thanks for your help!
kober
You cannot step into the library code unless you have source code for it.
This is the purpose of libs, if you make your own you may want to prevent others to look how its built. If you want to check library function correctness you have two ways:
Get the source code - which is in most cases impossible unless you get it from the author
Do unit testing. Check if library function's arguments give correct results.
If you do have the source code for the lib you have to set its build to debug mode, so you can provide symbols for Xcode to get through library's methods.