How I follow a function with inline asm step by step on Xcode 6? - xcode6

A have a constructor that uses some inline ASM.
In the middle of that ASM, a destructor of a variable of the object is called, and the constructor that has the ASM gets called again with invalid inputs and the code crashes.
When I am trying to debug, even using step into, everything go fine, until it reaches the inline asm line, then as soon as I press "step into" the program adds the destructor and erroneous constructor call to the stack and crashes.
How I step into the inline ASM (including the setup part, where the input variables are copied into registers) to see what is going on?

Related

IntelliJ: breakpoint everytime an object appears in breakpoint

I've noticed an unexpected behavior in an object used in this really complicate framework.
What I want is that the debugger stops (like with breakpoints) every time that the object appears in an instruction, without manually add breakpoints in all the instruction where it is used/appears.
Can I do something like this in IntelliJ?
Field Breakpoint is what you are looking for.
Read breakpoint type overview to get an overview of the different breakpoint types.
Furthermore, it is possible to put a condition on a breakpoint - read configure breakpoints.

How to enter in the body of a destructor in MS VS 2010?

When I try to debug a C++/CLI program in MS VS 2010 and use key F11 to enter the body of a destructor of some class the debugger skips this step.
How to force the debugger to enter the body of a destructor?
This is another leaky abstraction issue, you can tell what's going on when you look in the Output window after you tried to step:
Step into: Stepping over method without symbols 'Foo.Dispose'
Luckily the debugger still allows you to set a breakpoint on the destructor. Which is the workaround.

Can I set a breakpoint condition over entire form?

When running a program I need to see every time a certain button is disabled and step through the code at that point.
If I set a breakpoint with a condition
(ex: only hit when button1.enabled=false) it will only hit in that specific place.
Is it possible to set a breakpoint on the entire program so that i can see when a condition changes across many forms and locations?
You can't set one breakpoint and have it apply to every line of the file, but you can set a breakpoint on the setter of Enabled and then filter it to a specific filter condition. That would give you the desired result. (Note, you might need to turn off "Just my code", see this question for more info)
Set a breakpoint using the "New Breakpoint At Function" as described here, though in Visual Studio 2013, I seem to need to use a slightly different notation:
Then set the breakpoint to funtion:
System.Windows.Forms.Control.Enabled
in C# or for VB.NET:
System.Windows.Forms.Control.set_Enabled(bool)
(You seem to need to use the class that actually defines the property, which in case of the Button class' Enabled property, is the Control class the Button inherits from.
Ignore the warning about it not being able to find the function (it does that for properties somehow), or uncheck the Intellisense lookup.
Now look up the breakpoint in the Breakpoints list and customize the condition so it breaks on the right button
Use the Name property (or any other filter that makes the breakpoint unique) to trigger when you need it to:
When it breaks, it will break in the sources of Control (if you have Framework Source Stepping enabled), which may be confusing. Use the Stack Trace window to find the location where the method was invoked exactly.
Another way of setting the breakpoint is through the Stacktrace window. Set a breakpoint on any line that has your property of interest on it. Launch the debugger and make it break on that line, now use "Step into Specific" to step into the property that you want to break on.
Use the "Stack" window to generate the breakpoint for you:
Since in your case you're looking to break on a function from the Microsoft .NET framework, there is another way. Enabled Framework Source Stepping.
Open the Visual Studio Debugger options and enable "Framework Source Stepping" and disable "Just My Code".
Then enable the Microsoft Symbol Servers in as instructed. Now load up your application under the debugger and wait for the symbol files to be downloaded.
set a break point anywhere in your code that is somehow related to System.Windows.Forms (The constructor of your MainForm for example) and rightclick any function from the "System.Windows.Forms" assembly to load the symbols for that assembly. This will allow you to step into the "Enabled" property and set a break point there.
A full tutorial can be found here:
http://blogs.msdn.com/b/sburke/archive/2008/01/16/configuring-visual-studio-to-debug-net-framework-source-code.aspx

IntelliJ - show all compilation errors automatically in the project when code is changed

In Eclipse, when I make any code changes it automatically shows all compilation errors in the workspace in a console. It seems like in IntelliJ I have to make/build the project in order to see any compilation errors. Is there a window/tab to show all compilation errors?
Nowadays you have the same option as in eclipse to have automatic builds when you save.
Edit
Any changes in the editor will now trigger a compilation either when Ctrl+s is pressed or after a short interval.
This first image will show a main method and a class with a simple print method. No compilation errors.
In the next image I have removed the parameter message in the print method. That's the only thing I did, I did not even save I just waited a couple of seconds. And then suddenly the compilation error is shown below because the caller of the method has now supplied too many arguments.

View variable data while debugging in Objective-C

I come from a .Net world so I'm used to just hovering over a variable while debugging and seeing what its value is.
In Objective-C I am incredibly confused on how to do that.
If I hover over it, I get a small popup with lots of information...that doesn't help me at all.
For example, I have an object called "myServer" and it is an instance of a "Server" that I have created through CoreData. One of its properties is "root" which is a simple NSString.
I cannot for the LIFE of me figure out how to view what the value of [myServer root] is.
Can some please give me some advice on this?
In the gdb console, type
po [myServer root]
I like to use GDB from the command line. Open a terminal and type
gdb
attach <your process name>
(be sure your program was built with debugging symbols). Then, when your variable name is in scope (e.g. when you break somewhere relevant) type
po variableName
to view its contents.
Another nice way to deal with this is to log directly from a breakpoint.
To do this, create a breakpoint after the value you want to see has been set, then edit it. Add a breakpoint action of 'log', and put the expression you want logged within a pair of # symbols. Check the box to the right, ensuring that the breakpoint doesn't actually cause a stop. The value will be output to the debugger console on doing a run & debug.
Doing it this way you (a) don't clutter your source, (b) can dis/enable the breakpoint at will according to your immediate needs, and (c) don't need to stop execution.
This and other very handy xcode tips can be culled from Joar Wingfors' 'Debugging with Xcode' talk.