How to return to the current debugging position in Chrome Dev Tools? - debugging

I keep finding a scenario where my code stops on a breakpoint in Chrome's debugger, then when I use another tab like "Console", and go back to "Sources", I have lost the place where the code stopped, and I have to click singles-step to get "back on track", but this skips past the sought after breakpoint. Is there some way to get to where the debugger has stopped?

You can use the call stack portion to go to the current location the debugger is stopped at by clicking the top item in the call stack.
As the original writer couldn't submit an image due to his low reputation and the ongoing rules of the site, i will glady provide one for all of us!

You can click on the breakpoint in the list of breakpoints in the breakpoint panel in Sources and it will take you back there.

You can see a line number below. (eg:Line 152, Column 1).
So give Ctrl+G+line number. eg: Ctrl+G+152. You can see the breakpoint.

Related

Why is my debugger "breaking" on a line where I have not set a breakpoint?

I apologize in advance, this will be a very basic & general beginner's question:
Why is my debugger "breaking" on a line where I have not set a breakpoint?
Some more detail:
I'm working on a large buggy C++ project in XCode 12.4.
I've set a single breakpoint on function A. The debugger refuses to break on function A. Instead, it breaks consistently on function B. Function A and B exist on the same cpp file. I believe function B is supposed to be called AFTER function A, but they definitely do not call each other and are not called simultaneously.
I've definitely experienced the debugger stopping on various errors, but with a RED highlight, not a GREEN one - as I understand it the GREEN highlight only happens on a breakpoint I set myself.
Is this expected behavior? Am I missing something obvious?
(First post, please tell me if I'm doing anything wrong!)
EDIT: I solved & answered my own question below!
The most common cause of the debugger pausing at a place where you didn't set a breakpoint is the throwing of an exception. Some exceptions crash the program, which is where you get the red highlight in the debugger. Some exceptions don't crash the program. In those cases the debugger highlights the exception breakpoint in green.
If the debugger pauses your program with a green highlight, click the Continue Execution button (it's the second button from the left in the group of debugging buttons right below the source code editor) or choose Debug > Continue in Xcode to continue running the program.
These are all great responses and I learned a lot from them all - but it turns out the answer was much dumber.
For whatever reason, when I compiled, XCode did not delete the previously compiled binary. As for my breakpoint issue, I'm still not 100% sure what was happening, but it is solved now.
Here's how I noticed: Function A did not exist when I compiled it last time. I had created a String in function A. This string assignment returned a bad access error - so I assume it was assigned outside the program I was debugging!
Thank you to responders!

is it possible to scroll to specific position in browsing?

I am no programmar nor tech savvy person myself.
I just wanna know if it's possible to achieve this goal:
The default behavior of the browser(e.g. chrome) is it sends one page up or page down depending on where I click(above or below scroll thumb).
But when clicking somewhere on the scroll track, I wish it navigates right through the target position in the web page.
for better understanding, here's the screenshot of cnn.com main page for reference:
(In first screnshot, I highlighted where I will click.
Second screenshot is the default behavior of the browser as a result.
Third screenshot is what I want realize for my own convenience. it's useful when navigating through long articles.)
I think it is almost impossible to do this on my part because maybe it's hardcoded in browser's engine level or something, but I wanted to make sure it really is.
or any workaround like making autohotkey script or something?
thank you so much!
There seems to exist a trick with Shift, but it doesn't work in browsers.
However, you are manipulating a browser, and browsers have a built-in scripting language — JavaScript. Here's the setup you need to do:
Go to the place on the page you want to scroll to.
Open the developer console (Ctrl+Shift+I and then click on the "Console" tab). This shouldn't interfere with the scroll position.
Type window.scrollY and press Enter.
After that, the console will output the amount of vertical scrolling. In the following AutoHotkey code I'll use 12345 as an example; replace it with the value you have. Note that it also scrolls to the left margin.
Send {F6}javascript:window.scrollTo(0,12345)`%3Bvoid`%200{Enter}
It appears that, due to a bug, this doesn't work in Firefox.
I know your problem, I think chrome must have this config, you can type in the address bar "chrome://chrome-urls" for searching

How to diagnose Xcode errors

I have been using Xcode recently a lot, however, every so often I'll inexplicably receive error messages about perfectly innocuous components of my code. I'd like to know how one diagnose these because as you can see in the buttom right of the screenshot, there's no log entry to go off of. Thanks.
Here's my screen shot:
It looks as if you have accidentally set a "breakpoint" in your code. You set a breakpoint by clicking on the left margin. A breakpoint stops your code automatically when it reaches that point.
Since you commented out the inside of the goBack() function, it stops at the first line of uncommented code.
The breakpoint you set is the little blue line to the left of the line self.scoreLabel.removeFromSuperview(). To get rid of it, click it and drag it into the main area of your code.

How to break code on a click event?

I have this application that I need to disassemble. I don't have a clue on how to stop the running code on the desired location, so I decided my best guess would be breaking upon a button click. But how do I capture button clicks? I know it has probably something to do with the Windows functions such as CallNextHookEx. I'm using IDA PRO to disassembly.
IDA PRO is used mostly as disassembler, for static analysis purposes. I'd suggest you to use Ollydbg (or some other debugger, if you want to) because it will suit better to debugging purposes.
I don't know if you can set a breakpoint on an API like that.
But you can do this:
Load the application in olly, or attach to it.
Generate the event by clicking on anything.
Stop the application from ollydbg(F12)
Use C(k)all stack(ALT+K)
You will see a few calls to functions, one of them is doing what you need. But you may need to go to upper calls to see the whole loop. So you will just try which one it is. There will be a loop in one of them.That loop will have conditional jumps and generate events, load forms, fill the app etc. And when you place a breakpoint on the right jump there, it will stop at each mouse click.
When I'm debugging apps, most of the times I find myself on a breakpoint like this, and I see from the beginning how the application is filling an empty form(it takes so long.)

Click event is not firing in PowerBuilder on single line edit control

In child window of my application, I have placed one single line edit control named as sle_name. Its tab order is 1.
Below that control I have placed DataWindow having formatted as free form style.
When I run the app, if my focus is in sle_name, and I click on sle_name then rbuttondown event is triggered. Then I move my focus to DataWindow(dw_account). Once I got focus on dw_account and then if I try to click on sle_name, my focus is not moving on sle_name and neither I can run rbuttondown event on sle_name.
What is the reason for this problem?
One more thing: when I start this window my focus in set in sle_name, from that control if I press tab key then my focuse moves to dw_account and if I press again shift+tab then my focus is moved back to sle_account.
But if I try to set focus from dw_account to sle_account using mouse pointer it is not moving focus.
What is the reason behind this behaviour?
I had the same behavior in a child window.
It was fixed when disabled the 'ControlMenu' and 'TitleBar' properties in the window. (It's so strange).
Hope it helps
Juanma
This isn't natural behaviour, so the cause is likely something you've scripted. Depending on your architecture, the culprit code could be a number of places (e.g. framework objects). If this were my problem, I'd run with the PBDEBUG trace turned on (a System Option in the IDE, or /PBDEBUG on the command line after the deployed EXE name), and see what is firing when you try to move back to the SLE.
I'd also be using PBL Peeper to see the trace and the code side-by-side, so it's easier to see what code is being executed (the trace only shows you script name and line number).
Good luck,
Terry.
you must have to create the event ID pbm_lbuttonup, with the same parameter as rbuttondown event. Then in the code you write this.setfocus()

Resources