How does mock-debugger control which line the debugger steps next? - visual-studio-code

I'm unable to understand how the mock-debugger extension controls where the next step is.
For example what if I'd like to step 2 lines if I find the word "banana" in my text? Also, I'd like to do something, like "Step In", where I can walk word-by-word - is it possible?
I've seen the this._currentLine = ln; assign, which looks like it controls where the line is, but it's just a simple local variable. How could it ever control anything in the debugger? I can't find any other uses of the _currentLine varbiable where it passes to anything useful API (except for stack tracing, but I don't think it has any relation with the debugger line-control).

The stack trace is the only source for the debugger step visualization. When the debugger gets a notification to pause it requests the current stack trace. The TOS determines where the next execution point will be located. Hence the debug adapter is reponsible to determine this position precisely.

Related

provideDebugConfigurations not getting called

I am using the vscode-mock-debug git as the basis for my work.
Activation event is OnDebug, although same result
I implement provideDebugConfigurations in my DebugConfigurationProvider and its not getting called.
provideDebugConfigurations(folder: WorkspaceFolder | undefined, token?: CancellationToken): DebugConfiguration[] {
return [...my data in here];
}
the resolveDebugConfiguration (the original from mock-debug) is called, I can set a breakpoint. However the provideDebugConfigurations is never getting reached. build 1.36 of vsce. am I missing something obvious ?
this is the answer from the vscode team: https://github.com/microsoft/vscode/issues/78362
I have investigated this and it is expected behavior.
Namely, provideDebugConfigurations is only called then the debug configurations are needed to generate a launch.jsonfile. If you click on the configure command the provideDebugConfigurations will get nicely called.
However if you do not have a launch.json and you simply press Debug Start, vscode will try to start debugging without using debug configurations, but using one on the fly provided by the resolveDebugConfiguration call.
More about this can be found in our docs https://code.visualstudio.com/api/extension-guides/debugger-extension
Thus closing this as designed.

Gate vs toggle clip launch in Max4Live patch

I hope someone is able to help me with this.
Ableton Live when you set a clip's launch mode to gate, it only plays when you hold down the key. I'm using a patch that takes an OSC message to launch the clip, but it will not work as a gate - it needs to have the stop all clips message, and this won't help in my situation.
I need to "call fire" when 1 and "call stop all clips" when 0, but I'm not sure how to do this.
Can anyone help me with which object I should use? I've looked at various gates and swtiches, but I'm missing something.
Thanks.
Create a new object and type "togedge" or "select" (or its shorthand "sel"). Both of them will have 2 outputs: One for 0, one for not 0.
"togedge" will only output if the input changes.
"sel" will always output, and you can enter different numbers to match your input directly (like "sel 34 56").
Btw you can also use "call stop" on the clip_slot object directly instead of "stop_all_clips" on the track object.
After fiddling with the sel object, I discovered this: I needed to change the live.text object used to launch the clip from button to toggle.

In Pure Data is there any way to track down a "signal outlet connect to nonsignal inlet (ignored)" error?

I have a Pd patch which calls in a second patch as an abstraction.
The second patch works fine by itself. But when I try to use it from inside the first, I'm seeing this
signal outlet connect to nonsignal inlet (ignored)
error. But I can't see WHERE it's happening.
Doing "Find last error" just gives me.
... sorry, I couldn't find the source of that error.
How can I find out which two objects Pd is referring to with that outlet / inlet?
(The outlets of the subpatches are being wired into [dac~] in the main patch)
These subpatches USED TO work, until I tried to add Open Sound Control to them with udpreceive. And, like I say, they still do work, accepting the OSC if I run them on their own.
actually, Pd (>=0.43) became quite good at locating the source of errors, but unfortunately this is little known (and less documented).
if you get a findable error (usually those in red; and the error you get is one of them!), you can click on the error-line and it will take you to the object that complained (and select it)
the actual click-sequence is OS-dependent:
linux: Ctrl+LeftMouseButton
w32 : Ctrl+LeftMouseButton
OSX : ⌘+LeftMouseButton
alternatively you can get to the error, by clicking on the error-message and then hitting
Return
(Enter should work as well).

Is there any way to clear NSLog Output?

I have been googling from last couple of hours for finding that is there any way to clear NSLog output using code or not?
Like we have clrscr() in c. So if we are trying to print something which we want to focus most and there is lots of log printin there we can put that code there and get keep our desire log on top for easy searching. This can be done by putting breakpoint on my NSLog line and than click on clear console. but question is is there a way to achive this programatically?
I found few question on stack overflow but I din't satisfied with answer like this is saying that I can disable log for release mode etc.
Or I can use DLog, ALog or ULog as requirement but my question is different..
Any one can help me in this?
Thanks in advance :)
You can use a conditional breakpoint to simulate it. Define a function like this in your code:
int clear_console()
{
NSLog(#"\n\n\n\n\n\n\n\n");
}
Then, when you want to clear the console just add a breakpoint before the NSLog with this condition:
Condition: 1 > 0
Action: Debugger Command expr (int) clear_console()
Options: Automatically continue after evaluating Check it to skip the pause.
Tested with Xcode 4.3.2 and lldb.
Previous answer:
AFAIK, no, there isn't.
Just in case you're not doing it yet, you can create custom macros to format the output to highlight what you want.
Define macros like this:
#define CLEAR(...) NSLog(#"\n\n\n\n\n\n") /* enough \n to "clear" the console */
#define WTF(...) CLEAR();NSLog(#"!!!!!!!!!!!!!!");NSLog(__VA_ARGS__)
#define TRACE(__message__) NSLog(#">>>>>>>>>>>>>>> %# <<<<<<<<<<<<<<<<<<<", __message__)
Then:
WTF(#"This should't be here object: %#", theObject);
...
TRACE(#"Start Encoding");
...
It's not what you want but it pretty much solves the problem. You'll end up with your own set of macros with custom prefixes easily scannable in the console output.

Exception when running on simulator 3.2

I'm testing my app on simulator 3.1.3, it runs fine.
When it come to simulator 3.2, it crashes right from the beginning:
2010-06-24 16:35:29.208 MyTestApp[6991:207] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'This coder requires that replaced objects be returned from initWithCoder:'
2010-06-24 16:35:29.213 MyTestApp[6991:207] Stack: (
46195275,
2520474889,
46194715,
46194554,
6387912,
6392266,
5568184,
6388086,
6386450,
6392266,
5564974,
5573454,
3555255,
3560368,
3586056,
3567777,
3599431,
52998524,
45735996,
45731912,
3559044,
3591649,
10824,
10678
)
As far as I know, I do not use the "initWithCoder" method (do not really know what this is though).
How can I know where the exception is thrown so I could have a better understanding of what is causing the problem?
ps: I have added an exception in Breakpoint: objc_exception_throw (with location libobjc.A.dylib, strangely I had to enter the location manually, I expected xcode to find it for me when I added objc_exception_throw). But still the same trace and no more information.
This page should provide some helpful info: Debugging Tips for Objective-C
Of particular interest is the console command info line *. Every one of those numbers listed by the exception log is an address on the stack. Those bottom ones in the 10,000 and below range are usually located in the app's main method, for example. The highest ranged addresses tend to represent the default libraries.
Using the command info line *10678 would likely return some info about a specific line in the main method, which doesn't help very much. Normally the trick is to find the highest address before the default libraries begin. I'm unsure how much this will help your problem in particular, seeing as there's a huge gap between the expected small addresses and the next highest up. In any case, start with the smallest address above the bottom two (3555255 from what I can see in the log you posted) and see if it returns a line from one of your own code files. If it does, check the one above it, and so on until you find the last address from your own code. Hope this helps.
I figured out the reason of this error. I had created an object of type NSDictionnary within IB and it seems it was not the correct way to do this. Instead I have programmatically created this same object in XCode and this works fine. Seems like it was some kind of persistent problem.