Real-time changes on IDE/Assembler - ide

I'm new on this, sorry for bad usage of terms or overextending an explanation. I'm learning code languages and way i found to bring it to my world so i can learn it better, was coding for/with games i play.
When a window close on the game a function needs to be called, when the character move or you pick an item, everything has a command, function, process or some value of an address change and etc... What i wanted to know is if there something that shows me on real time every call, every value change, address value change, etc...
Nowdays i have to reach some value address by CheatEngine, changing the value till i find the correct address. With this kind of thing i would have a list off things that is happening right now, and a "log" of the past things, then i go to the exact time that i did something, so i would have to look on that peace of the list and discover what did my "something"
Click on a button;
Check on the real-time thing what happened at the time of the "Click
on a button" process;
Discover what call was responsible for that and what it did;
Now i can code something that do what "Click on a button" do, without needing to actually click on that button;
I have seen it somewhere, thats why i'm asking here, if i'm totally wrong and this doesn't exist, i'm sorry, i will delete this post.

I believe a Debugger is what your looking for.
The Debugger in Visual Studio does exactly what your describing, you can see the real time values of your variables and objects at any stage in your program.
You can set 'Break Points' that will halt your code wherever you put them, allowing you to inspect your variables.
You can also 'Step' through your code, which will go line by line through your code, stopping at each line to allow you to inspect.
Here is a good page for an overview of debugging in Visual Studio 2017:
https://msdn.microsoft.com/en-us/library/y740d9d3.aspx

Related

JProfiler: Help wanted for memory profiling - where do I find line numbers for where objects are being allocated

newby alert:
I have started my 10 day trial and I am having issues figuring out how to get it to find what I'm looking for. I have a fairly complex single threaded Java app that I'm trying to get to never GC. I pool all my objects. However I must have missed a few things. I'd like to find out where I'm releasing the last reference of the objects that are going back to the heap. If I cant find that, it would suffice to at least know where the memory is being created that is later being GC'd.
This is what I'm doing so far:
1. click on Live memory / Recorded Objects
2. Click record and select "Garbage collected objects, All allocations"
3. Click on "Run GC"
so now a bunch of stuff appears. I was hoping I could simply double click and it would give me line numbers and fun stuff like that. Similar to what I got when I would run HPROF.
I right click on one of the items and select "show allocation tree for selection"
Still no line numbers... it does give me the method name though. If the method is large it's kinda complicated to figure out where the memory is being created.
Also when I stop recording, is there a way to clear everything in the recorded objects view so I can start over with a new recording?
In the profiling settings you can switch on line number resolution.
Also when I stop recording, is there a way to clear everything in the recorded objects view so I can start over with a new recording?
When you start recording again, all previous data is cleared.
You can try this:
Click "Live memory - Recorded Objects"
Choose the Objects you want to watch then right click "Show Selection In Heaper Walker" and choose "Show in current heap dump"
Choose the Objects you want to watch in the new Heap Walker window and right click and choose "Use Selected Objects" and choose "Allocations". Then you can see the allocation tree of the Objects, by read the method code you can locate the line number you want.

Can micro:bit read while in another while?

so i have got a problem programming micro:bit. I code it in internet page, then download the hex file and transfer it into the micro:bit. On the internet simulator everything works. Apparently when i transfer it to micro:bit code is not working. The code is really simple, it looks something like this.
animation repeats while variable is 0 (this part works perfectly)
A button makes the variable 1, B makes it 2 (this part works)
when variable is not 0, it breaks first animation loop. (this part also works)
then goes to second loop which repeats while variable is NOT 0 (it will never be a 0 because there is no button which makes variable 0) so it repeats for ever (this works)
in second loop, there are 2 more loops. First repeats when the variable is 1, second when the variable is 2. That makes me able to switch between these 2 loops any time i want. (Problem appears here: i am in loop 2 for example, i cant switch to first loop and otherwise.)
All these errors occurs in micro:bit robot, when code is transferred. In internet simulator code works perfectly. Is it possible to do that code in micro:bit, have i reached limit? Or is robot defective? Thanks for answers and inform me if something is not clear.
This is of course very hard to debug without seeing any blocks/code as I don't know how you are detecting the buttons being pressed when in the second loop.
However, this may be a scheduling issue due to the way you are changing the variable upon a button being pressed. Perhaps consider restructuring your blocks such that they are more event driven, utilising blocks such as on button A Pressed a bit better, infinite while loops are always best to avoid. Also, maybe consider putting a pause(100) in the while loops.
Hope this helps ;)
Edit:
OP confirmed that the pause(100) worked (see comments of this answer), demonstrating that it was a scheduling problem!
For those who are interested ;)...this is because the CPU is busy executing the while loop and doesn't have time to think about the buttons being pressed. The pause(100) allows the CPU to rest for a bit and not think about the while loop, giving it the time needed to deal with the button press. This is known as Cooperative Scheduling!
You can find out more about Cooperative Scheduling at:
https://www.microbit.co.uk/device/reactive
If your code looks like this, you will never be able to change your state variable. You'll get stuck in one of the inner loops, with no option to change the control variable.:
while (unset):
Animate
Check for button
While (set): // Intend to be stuck in this loop forever
While (one):
Do first
While (two):
Do Second
What you need is to be able to update your state:
...
While (one):
Do First
if (button_b.was_pressed()):
state = two
...
This still isn't perfect, you might want to think about what happens if the buttons are pressed in 'unusual' sequences. The simulator should be identical, but there might be something unusual about the way that button presses are handled and your code that have broken the simulator. If the simulator really is broken, you'll need to share a testcase with the micro:bit team.

IntelliJ v14, how to bring up a method parameters information via keyboard or mouse input?

I really like how IntelliJ displays the information of the type of parameters that you are required to fill in as you are writing the code. The problem is that this info sometimes disappears if u click somewhere to check something etc. I never quite know how to get it to display that information again in same fashion. So I always spend some time to fiddle around until it displays that info again in the same fashion. I know you can hold down on ctrl and hover over the method name to bring up parameters information but its not quite the same and it then does not highlight on what parameter you are currently on. IntelliJ also brings up required parameters type of information when you are starting to go wrong. It brings up this big separate box and you can get very clear view of what needs to be done. I've taken a screenshot of the type of information that I'm on about. Both of them are on the same pic.
Please check it out.
My question: is there a way to bring this information up via keystrokes or mouse input at will? I've tried to google for an answer but I haven't had any joy. Please advise as I'm sure someone else might like this information too.
Thank you.
PS. I know that a good code does not usually have that many parameters but in my case there is not much that can be done.
Default shortcut for that is CTRL-P when cursor is inside the brackets.

Stop execution in smalltalk

I´d like to know how can I stop execution in smalltalk. I entered an infinite loop and don´t want to loose the code that´s written. I tried using pause button but doesn´t seem to be right.
Normally, even if you are unable to stop execution, you should be able to get the code changes you made back from the .changes file. If you can restart the image, there is a 'recover lost changes' menu entry. Always first make a backup copy of the changes and image files before trying this. (In Pharo/Squeak. Other smalltalk have similar possibilities)
it depends on the dialect and possibly keyboard settings.
try CMD-. or CTRL-., which works in most dialects.

MS Office PowerPoint VBA Programming support or Debug Mode?

I am trying to develop a little macro for PowerPoint using VBA. However, the "Development Environment" is an absolute nightmare!
The worst: there seems to be no real good way to generate debug output! I read that the Debug.Print output is supposed to go to the Immediate Window, but nothing appears there! So I am currently using MsgBox to generate debug messages. :-(
What's also really bad is, that errors in a macro always crash PPT. So one has to wait, until it is gone and then one has to restart it again and get rid of all the Recovery attempts. This always takes ages!
If I set On Error Resume Next it doesn't crash - at least not as often - but then things just silently don't work and I can't see what and why things go wrong (unless I plaster the code with MsgBox calls, but that requires 100'000 clicks during each execution).
And running the code in the debugger and single stepping trough the code doesn't work, either, since my macro refers to the current "ActivePresentation" and that doesn't seem to exist unless one starts the slideshow mode. So this debugging is driving me nuts!
Is this really the only possibility or environment to develop VBA code in? At least some idea re. debug output, anyone?
M.
The worst: there seems to be no real good way to generate debug output! I read that the Debug.Print output is supposed to go to the Immediate Window, but nothing appears there!
At the risk of sounding insulting (which I don't intend!) do you have the Immediate window open? While in the IDE, press Ctrl+G to see if anything new appears. If so, that's the Immediate window.
What's also really bad is, that errors in a macro always crash PPT.
Not ordinarily, no. It can happen that way, of course; your code might be triggering a bug in PPT. Heaven knows, I ran into enough of that in PPT 2002 and 2007. If you're using reasonable error handling and still running into errors that crash PPT, stepping through the code as it runs should allow you at least to narrow it down to the line or two that cause the crash.
And running the code in the debugger and single stepping trough the code doesn't work, either, since my macro refers to the current "ActivePresentation" and that doesn't seem to exist unless one starts the slideshow mode.
Again, no. The ActivePresentation refers to whatever presentation has focus in the app, whether it's in slide show or any other view. If your code's in one presentation and its' supposed to be acting on another, that can cause some confusion, but you simply need to switch to normal view, make sure the presentation you want to access is visible (I'd make sure not to have several in view) then Alt+F11 to return to the IDE and run your code.
All of these suggestions apply to any Windows version of PPT, going back to Office 97 (Mac? Thinks different. If you're using a Mac, mention that. There are a few differences but for the most part, everything above applies except for the Alt+F11).
If none of this seems to help on your setup, it may be time to do a repair of Office.