Recent

Author Topic: CPU-View  (Read 3053 times)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10451
  • Debugger - SynEdit - and more
    • wiki
Re: CPU-View
« Reply #30 on: October 22, 2024, 12:20:16 pm »
And then there may be a frontend specific interface.

Currently you register your CPU view via the normal IDE interface. It just lives in parallel to the existing windows. And general Window handling is probably to remain a task for IdeIntf, even for debugger specific windows.

What may however be of interest is

* If an existing debug window should be replaced => unregister the existing window.
Matter of user preference in many cases. A user may not mind to have both windows (old and new). But for less experts it is probably better to just have one.
(The new one would still register its menu and keys via the IdeIntf)

* Hook signals to windows
E.g. if the frontend decides it needs to display an asm window, because you stopped at a location outside the sources.
Then you want to intercept that call, and show your CPU view.

* Extend an existing window
That would depend on what ideas for modification come up in future.



Alexander (Rouse_) Bagel

  • New Member
  • *
  • Posts: 24
Re: CPU-View
« Reply #31 on: October 22, 2024, 03:43:05 pm »


Uff, thanks for the detailed response. I need to think this through. Some of the things you described are not fully clear to me, so I need to dive deeper into the current debugger mechanism. The frontend and backend mechanism itself is clear, all the interfaces I mentioned above are related to the frontend.

Now about registers.
In AsmView I calculate only [RIP + 123] to get a symbol at the calculated address in x64 code.
In memHint displays more detailed information on registers and there can already be considered [RAX*4+123] (instead of registers are substituted current values + the math itself)
The mov RAX, [foo] expressions are not processed yet because I don't know how to get variable values by name yet.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10451
  • Debugger - SynEdit - and more
    • wiki
Re: CPU-View
« Reply #32 on: October 22, 2024, 04:09:34 pm »
The mov RAX, [foo] expressions are not processed yet because I don't know how to get variable values by name yet.

foo was meant to be an address, the debugger doesn't return var names in asm.

To clarify my question
Code: Text  [Select][+][-]
  1.   mov RAX, [0xF789]  // RIP at this line
  2.   mov RBX, [RAX + 123]  

And at the first line (or current pause line) the actual values from CPU and mem:
RAX = 0
mem F789 = AABB

What happens on the 2nd line (without stepping, just disassembling for being paused at the first line / or even at some earlier point)
On the 2nd line for the [RAX + 123]  it will show:
- no comment
- 0 + 123  = 123
- AABB + 123 = ABDE
?

What happens if there is a conditional jump, and there is more than one path to that line?

Sorry, I could just try... But then I need to write some code that ends up like that.

Alexander (Rouse_) Bagel

  • New Member
  • *
  • Posts: 24
Re: CPU-View
« Reply #33 on: October 22, 2024, 06:54:33 pm »
Sorry, I could just try... But then I need to write some code that ends up like that.

In AsmVindow, nothing will be displayed for both cases because there is no RIP marker in the address
In memHint for the string "mov RAX, [0xF789]" will be displayed:
Code: Pascal  [Select][+][-]
  1. RAX = 0 (No access)
  2. [0XF789] = [F789 (R...)] -> AABB (No access)

for the string "mov RBX, [RAX + 123]" will be displayed:
Code: Pascal  [Select][+][-]
  1. RBX = 0 (No access)
  2. [RAX+0X7B] = [7B (No access)] -> 0 (No access)

i.e. the current values of registers are taken, the address is calculated, access is checked and if there is a pointer (i.e. instruction [xxxxx]) the same is done for this address as well. (see attachments)

But if the string is like this: “MOV RAX,[RIP+0xF789]”, the calculated value with RIP marker will be displayed in brackets, and if debugging characters are detected at this address, they will be displayed as well.
« Last Edit: October 22, 2024, 07:04:33 pm by Alexander (Rouse_) Bagel »

Alexander (Rouse_) Bagel

  • New Member
  • *
  • Posts: 24
Re: CPU-View
« Reply #34 on: October 23, 2024, 03:21:15 pm »
It would be really nice if your packages could use FPC v3.2.2.  I believe that would make it possible for them to be adopted more quickly which would benefit most everyone (at least those like myself who enjoy looking at the assembly code and debugging in assembler.)

I've looked at the CPU-View screenshots and would love to use it :)

I have finished translating FWHexView and CPUView to support the stable version of the compiler (3.2.2). You can check them out.
Important - there have been significant changes in the source code during these days, including rearrangement of folders for storing source code, so if you still have old versions of the packages, it is better to delete them and replace them with new ones again with obligatory cleaning of the lib folder.
There's also a small problem with the installation, I'm still sorting it out, here's a description of it: https://github.com/AlexanderBagel/CPUView?tab=readme-ov-file#known-issues

440bx

  • Hero Member
  • *****
  • Posts: 4647
Re: CPU-View
« Reply #35 on: October 23, 2024, 04:32:02 pm »
I have finished translating FWHexView and CPUView to support the stable version of the compiler (3.2.2). You can check them out.
That's great. 

Thank you Alexander.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

440bx

  • Hero Member
  • *****
  • Posts: 4647
Re: CPU-View
« Reply #36 on: October 23, 2024, 05:46:12 pm »
@Alexander,

Just FYI,

In FMHexView, building the ZipViewer demo fails because of the dependency to FWZip.  This isn't mentioned anywhere.  Also, all the documentation for FWZip is in Russian, which is a bit "inconvenient" for those who don't speak Russian (like myself.)

The Hex Editor demo does not compile.  The compiler emits an error (see attachment.) 

The "simple" and "virtual pages" demo, both compile and run without problems.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Alexander (Rouse_) Bagel

  • New Member
  • *
  • Posts: 24
Re: CPU-View
« Reply #37 on: October 23, 2024, 06:05:10 pm »
@Alexander,

Just FYI,

In FMHexView, building the ZipViewer demo fails because of the dependency to FWZip.  This isn't mentioned anywhere.  Also, all the documentation for FWZip is in Russian, which is a bit "inconvenient" for those who don't speak Russian (like myself.)

The Hex Editor demo does not compile.  The compiler emits an error (see attachment.) 

The "simple" and "virtual pages" demo, both compile and run without problems.

Yes, indeed, I completely forgot about the need to translate FWZip. I'll get to that (and all the demos) a bit later. Thanks.

440bx

  • Hero Member
  • *****
  • Posts: 4647
Re: CPU-View
« Reply #38 on: October 23, 2024, 07:09:49 pm »
Yes, indeed, I completely forgot about the need to translate FWZip. I'll get to that (and all the demos) a bit later. Thanks.
My pleasure and thank you for making your work available to others.  Good stuff. :)
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Alexander (Rouse_) Bagel

  • New Member
  • *
  • Posts: 24
Re: CPU-View
« Reply #39 on: October 24, 2024, 07:24:29 am »
My pleasure and thank you for making your work available to others.  Good stuff. :)

You're welcome, I myself need new debugger functionality and someone to look at and test :)
Demo examples are fixed.

Alexander (Rouse_) Bagel

  • New Member
  • *
  • Posts: 24
Re: CPU-View
« Reply #40 on: October 31, 2024, 07:01:11 am »
During my short playtime with it, it crashed twice and froze once
I added a debug log in the settings.
If a hang or error occurs in the future, please open the issue and attach Debug.log

Thank you.

https://github.com/AlexanderBagel/CPUView?tab=readme-ov-file#debug-log-and-crash-dump

Fibonacci

  • Hero Member
  • *****
  • Posts: 561
  • Internal Error Hunter
Re: CPU-View
« Reply #41 on: October 31, 2024, 03:15:55 pm »
I just want to say, I have been using this tool almost daily since the error I mentioned in my first post (on the first page) got fixed.

This tool is superb! Helped me a lot with current development, where I need debugging all the time (digging around in the RTL).

Keep stuffing new features to this tool! Me likey. Thanks.



I see you added option to configure it in the IDE options. Defaults suits me, worth updating? I use commit "Thu, 24 Oct, 2024, 6:26".

Is there a way to "walk back" if I click the calls/jumps? Left arrow, minus or backspace could do it. I know I can return to EIP.

Add an option to add a button to the toolbar. Options -> Editor ToolBar. I'll update if you add the button :D

Alexander (Rouse_) Bagel

  • New Member
  • *
  • Posts: 24
Re: CPU-View
« Reply #42 on: October 31, 2024, 04:38:40 pm »
I see you added option to configure it in the IDE options. Defaults suits me, worth updating? I use commit "Thu, 24 Oct, 2024, 6:26".

Is there a way to "walk back" if I click the calls/jumps? Left arrow, minus or backspace could do it. I know I can return to EIP.

Add an option to add a button to the toolbar. Options -> Editor ToolBar. I'll update if you add the button :D

If you are happy with the default values, you don't need to update in principle.
Jumping forward/backward is supported by the mouse buttons (MK_XBUTTON1/MK_XBUTTON2) or Esc (step backward).
As for the toolbar button - I don't know how to do that yet, need to look into it.
I'll add it to the development plan.
« Last Edit: October 31, 2024, 04:41:29 pm by Alexander (Rouse_) Bagel »

Alexander (Rouse_) Bagel

  • New Member
  • *
  • Posts: 24
Re: CPU-View
« Reply #43 on: November 02, 2024, 06:06:01 am »
Add an option to add a button to the toolbar. Options -> Editor ToolBar. I'll update if you add the button :D

A button has been added to the toolbar editor.
UPD: If you upgrade, it is advisable to update the FWHexView package as well, as there were bug fixes there too.
« Last Edit: November 02, 2024, 06:09:21 am by Alexander (Rouse_) Bagel »

Fibonacci

  • Hero Member
  • *****
  • Posts: 561
  • Internal Error Hunter
Re: CPU-View
« Reply #44 on: November 02, 2024, 03:59:37 pm »
A button has been added to the toolbar editor.

Great news ;) I'll check it out soon. Thanks for adding it.

 

TinyPortal © 2005-2018