debug spyder using breakpoints in editor and code calling from console - spyder

My impression is that in Spyder breakpoints are triggered when calling execution with debugging. My normal workflow is to write some code and then type a line or two to test that code in the console. Doing so fails to trigger the breakpoint. Instead to debug I am constantly typing import pdb; pdb.set_trace() in the editor where I want the breakpoint to be triggered. Is there a way of getting the console to respect breakpoints (ideally by default) so that I can just type a line or two to run my code and then get the editor breakpoints to be respected? I guess the alternative is to create a temporary file for placing my temporary code, although that is not ideal. Often I have the code in the library I am writing as an example in the comments, and I'm simply selecting that code snippet and asking the selection to be executed.
I'm using Spyder 4.2 on Windows for reference.

Related

notepad++ macro that uses ctrl+alt+shift+enter (within macro; not as shortcut) changes random line of text up above or, worse, causes segfault; why?

Love macros in notepad++. They save time. However, I recorded a macro to wrap a given line with the good ol' try...except, ran it, and it works. However, it ALSO randomly modifies something way up above in the code (dozens of lines above). Not great. On a new .txt file (ctrl+n), using the macro straight crashes notepad++ (assuming a segfault, as it's trying to access memory it doesn't own). Why oh why? Also, is there any fix? (I'm currently avoiding recording ANY ctrl+alt+shift+enters as a workaround in my macros, but that's just plain annoying.)
Steps for reproducing:
Click Macro.
Click Start Recording.
Record keystrokes, mimicking writing the below:
try:
<original line>
except Exception as e:
print(e)
Click Macro.
Click Stop Recording.
Click Macro.
Click Playback.
Notepad++ crashes.
Version for reproducing:
Notepad++v8.4.7 (64-bit) Windows

Delphi XE7 Debugger Always Stops on CPU Window

In one of my projects, I can't get breakpoints to work as expected.
The problem is that the CPU window opens when the breakpoint is reached. The Event Log correctly indicates the source line number with the breakpoint and the name of the file with the breakpoint indicated in the Event log matches the name and path of the source file open in the editor (the one where I placed the breakpoint).
However, when I try to inspect variables or view watches, I am told that the variable is undeclared. After the first breakpoint is reached, I can't set any additional breakpoints (the breakpoint is displayed as invalid -- a red dot with an X), even if it is the next line after the breakpoint (with a green arrow displayed). The Event Log indicates that the module has debug info.
I have tried the following:
deleting the DPROJ file and letting Delphi recreate it
"Cleaning the project"
verifying that the debugging settings for the project are consistent with those for other projects that do debug correctly
deleted all the dcus for the project and verified that Building the project put them in the expected location (which is the same folder as the EXE).
I tried the solutions here: Delphi2010-IDE keeps stoping on CPU debug window
I have verified that Debug Information and Local Symbols are enabled.
I tried the suggestions here: Delphi: why breakpoints from time to time are not usable (green highlighted line on IDE)?
Please offer suggestions regarding how to get the standard debugging functionality.
Try add source files to the debugger source path in project options under debugger.
Try disable runtime packages and add sources from runtime packages to project.

Breakpoint not working on specific classes on Xcode

[![enter image description here][1]][1]I Tried all possible setting manipulation of xcode, even i cleaned xcode app from my mac and then reinstalled too, but still no luck, But Breakpoints works on almost all calsses except some , later on breakpoint navigator i noticed classes on which breakpoint not working are marked RED. I am wondering what is the actual cause ?
Update : After i removed ad added that specific file the red mark are gone, but result is not improved !
I see red text color labels so probably you have deleted files.
If your files exist and you dont see any breakpoint stopped in your class simply it's because your project probably crash before arriving in this class or by-pass it. Check who call DriveCreateAccountVC in your code and put some breakpoints before this class is called in the code, Im pretty sure you find your mistake.
It's a good attitude use the debug console by printing your flow in your code like this line for example: (you can put in viewDidAppear or viewDidLoad)
print("∙ \(NSStringFromClass(self.dynamicType))")
it's a little help but print the class name where are your flow in this moment. You can go also on the debug console and writing for example:
po myStringArray.description
po myStringArray.count
Another useful thing is to add these two options in your editing settings (it's not in defaults settings) : (line numbers and code folding ribbon)
A class becomes Red, when it has lost its path(Xcode can't locate the class)
This may happen because you maybe you copied flies from one project to another or something like that:
There are 2 solutions:
Before anything, locate the files in your Finder
Solution 1) Find the files and put them in your project directory.
Solution 2) Click the file in red in your Project Navigator
Then click on the button (showed in the image link above, to the right of tweetCell.swift)
Once you click it, you will get a chance to locate the file, do it.

Xcode: Breakpoints and Weird Screens

When I am having a problem in Xcode, I am told to debug my code with a breakpoint. Stepping through the code, you press that little arrow above the console section to go to the next line. This works fine, like when I place a breakpoint on line 150 in my code, I can then "po" a variable and find it's values.
But when I am trying to step through my code, and go from method to method, a lot of times I will be transported to this weird screen of numbers and letters and things don't make even remote sense in there. See below
Wtf does this mean, and what if anything am I supposed to do with this Klingon transition my Xcode project apparently has intercepted?
Code you write in a language such as Objective-C or Swift is compiled into machine code for execution on a given processor - x86 for the simulator or ARM for an iOS device - In this case I would guess you are running on the simulator.
Machine code instructions perform quite discreet operations. For example c=a+b would translate into something like
fetch a from memory
fetch b from memory
add a and b
store the result into the memory for c
When you single-step through your code in the debugger, it only stops on each line of your program even though many machine code instructions may have have been executed by that step.
What you are seeing is the assembly code for the framework function that has been invoked because you have "stepped into" a function that Xcode doesn't have the source to, so it has to show each low level operation.
You can use the 'step out' button to return to your code and use the 'step' rather than 'step into' button to avoid seeing this.
The line that is highlighted in your debugger is essentially checking the value of the %al register (a register is a small piece of memory in the CPU chip). The next instruction will jump to a different part of the program if the result is that %al is 0.
Look on the left hand side and click on the command before the currently selected code. That will typically show you the last bit of code you wrote before the breakpoint was encountered
In the example below 0 is where the breakpoint was encountered, while 1 is last bit of code that I wrote.

Can anyone else reproduce this bug in the Dart debugger/editor?

For my sanity, can someone verify a strange bug I'm having with the dart editor?
I'm using the latest dart editor from the main page of the website, I downloaded, extracted, then ran the "DartEditor" executable. (I didn't clear any previous settings that were stored elsewhere, but I don't think that will change the issue.)
Dart Editor version 1.0.0_r30798 (STABLE)
Dart SDK version 1.0.0.10_r30798
Download my repository: https://github.com/Naddiseo/dart-sprintf.git
Switch to the debugger_ide_test branch
On console (not in the editor) run dart test/sprintf_test.dart The output should be:
decimal=1, exp=0, digits=[5, 4, 6, 6]
Next, fire up the editor, and open the folder.
Run the same file, and it should print out the same result.
Now for the weird part. Set a break point in lib/src/formatters/float_formatter.dart:17 which is the first line of the constructor.
Run the test file in the editor again then continue once it gets the break point.
With the breakpoint I'm getting the following output:
decimal=1, exp=0, digits=[0, 0, 5, 4, 6, 6]
I've attributed it to the List<String> constructor, which seems to initialise to not be empty.
Does anyone else get this problem? I've tried to condense this into a testable single file, but have failed to reproduce; I'm only able to reproduce it in the actual project.
Definitely sounds like a bug. As Fox32 suggests, please file a bug on http://dartbug.com/new.
Generally these kind of bugs happen for two reasons:
The debugger has a side-effect: if the debugger (here the Dart-editor) invokes the actual toString method on visible variables, it could have a side-effect. Most commonly this happens to Iterables that have a side-effect.
The VM has a bug when debugging. The VM has to compile code differently (for example disable some optimizations) to stop at any arbitrary location. It could be that your breakpoint triggers a bug there.

Resources