see call stack without adding breakpoint - google-chrome-devtools

Can you print a call stack without adding a breakpoint at any time?
Something like console.trace in firefox?
A use case could be that you want to see the calls to a certain js file which you have no idea in what way they are called

Add console.trace() into your code and you will see it in the Console. It's not just a FireFox feature.

Related

How to exclude package: results from stack

Is it possible to only see lines from my own classes in the stack, when running flutter in terminal?
Not sure if I got your right, if you're talking about printing lines from print() method, you can use
flutter logs
And if you want to see all the class, you will have to use Logcat, and filter your class there.

Is there a way to see the order in which functions are called when we execute a program in Xcode?

Is there a way to see the order in which functions are called when we execute a program in Xcode? For instance, at runtime, if we press a button corresponding to a certain IBAction, can we see the order of method calls thereafter? I know the debugger is available, but it seems to be particularly useful when you know exactly what method calls you are looking for.
Any help would be much appreciated!
Swift flows top to bottom. This is a good post on that. As well you can run a breakpoint, also added an explanation of a breakpoint. You can use them to stop and manually advance Xcode to the next thing to execute helps a lot with debugging.
You could also do print("Function x")
in each of the functions you have. This would then print them in order of execution time.
Swift Flow
Breakpoint Article

GWT open.window on top window

I am using GWT in my projects, when I use the open.window the window opens in the back not in the front. I can find nothing to fix this. I've tried something called the z-index, but there is next to no documentation about this. And it didn't work.
Set focus on a new window. Probably via some kind of JSNI method which will contain something like this $wnd.focus().

See what methods are being called in Xcode

I have a view controller that keeps reloading over and over again. I would like to be able to see which methods are being called so that I can see the one that keeps firing the reload. I know I can see what was called if an error occurs and the app crashes. However, in this case there is no crash. Is there a way to monitor all of the methods being called throughout the app?
If you are new to XCode and Objective C and looking for something lightweight and you do not have a large code/ many methods, I would put:
NSLog(#"%s",__PRETTY_FUNCTION__);
in every method.
Use Instruments. Start your code in a profiling mode and select the CPU time instrument. As the app runs, Instruments will gather information about every call stack at regular intervals, which will allow you to see what calls what. (Use the "Invert Call Tree" option to see callers of a given function.)
I use this macro:
#define DEBUG 1
#if DEBUG
# define NLog(fmt, ...) printf("%s\n", [[NSString stringWithFormat:#"%s:%d %#", __PRETTY_FUNCTION__, __LINE__, [NSString stringWithFormat:fmt, ##__VA_ARGS__]] UTF8String])
#else
# define NLog(...)
#endif
Then I include my Macros.h in my Application_Prefix.pch file, so that it's available everywhere. Before I ship, I set DEBUG to 0 so that all NLogs disappear.
So now, instead of using NSLog, I use NLog. The output looks something like this:
-[ApplicationDelegate applicationDidBecomeActive:]:86 applicationDidBecomeActive called!
This solution was based on these earlier posts:
How to print out the method name and line number and conditionally disable NSLog?
Do I need to disable NSLog before release Application?
You can just place the NLog calls in several places, to see which functions are called right before your view controller reloads. If you need to know the exact function that triggered the reload, your best bet would be to place a breakpoint and examine the call stack, as others have mentioned.

Dynamically Change HTA Window Properties

In my HTA, I hold it it open if an error occurred, and close it if everything was successful. At the start, I have the sysmenu property set to no because I do not want the user to close the HTA until it's finished. At the end, I want them to be able to click on the close button. Here's what I typed up to try to achieve this, but it doesn't seem to work? I suspect there is something I need to do to get the HTA to refresh it's windows properties?
Please note that any solution that completely reloads the window and/or makes the script execute again is not acceptable
If Not bHoldOpen Then
Call window.close
Else
Dim tagHTA
Set tagHTA = document.getElementsByTagName("hta:application").item(0)
Call tagHTA.setAttribute("sysmenu","yes")
End If
You cannot change it at runtime, its only available in the HTA: block as its value is used to determine how the physical window is to be initially created.
I thought you could produce a warning using the onBeforeUnload event & call cancelBubble to abort the close, but I tried it in IE8 and it still seems bugged; http://support.microsoft.com/kb/946214.
It would probably be simpler and easier for the user to comprehend if you were yo just unhide a "Close" button when the process completed.