Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancements for Assembly Debugging. #127

Open
epasveer opened this issue Feb 24, 2023 · 8 comments
Open

Enhancements for Assembly Debugging. #127

epasveer opened this issue Feb 24, 2023 · 8 comments

Comments

@epasveer
Copy link
Owner

epasveer commented Feb 24, 2023

This is related to discussions from task #100

Thanks @kevinferrare for your great suggestions. I've close task #100 and opened this new task to continue the discussions and I'll update here with Seer fixes and features.

Here's the list of problems and suggestions.

  • As you said, would be nice to be able to request more bytes to expand the assembly view when scrolling down. May not give good results all the times as data can be mixed with ASM.

  • Making the PC field editable to jump directly to an address would be good, this is what I tried intuitively. Or maybe have a go to address button like in text editors where you can specify which line you want to go? (FIXED)

  • Would be nice if connectivity settings were saved after restarting seer, currently I have to go to the connect tab, input my connection string, and input the before and after commands each time I restart it. (FIXED)

  • Would be nice if assembly view was shown by default when there is no source code.

  • There are buttons that don't work (run, start, next, step, finish) in assembly mode, for a good reason, but it would be nice if they were hidden because this could be confusing. (FIXED)

  • Double clicking on an address creates a breakpoint but double clicking on the breakpoint disables it instead of deleting it, which is not how IDEs like eclipse, intellij, rider behave. Not sure if it's better this way or not but it surprised me a bit. (FIXED)

  • Would be nice to have some colors on the disassembly, gray on white is a bit hard for the eyes. (FIXED)

  • Was going to say that command "set disassembly-flavor intel" does not work, but there is an option in the settings so this is all good :) (FIXED :)

  • In a similar fashion, would be nice to be able to set the architecture maybe? Personally I have a "set architecture i8086" in my gdbinit, but if this was in a setting accessible via the UI, it would be more accessible to people.

  • There are too many registers in the register view, depending on the target some regs are not present. (FIXED)

  • Didn't find a way to visualize the stack. You can see it with the memory view of course, but it is not very convenient. Would be nice to have an array view where you could choose the top of the array via an expression (SS*16+SP in my case) and display it in whatever order is needed. For x86 stack, this would be in reverse order as each new push decrements ESP by 2, 4 or 8.

  • One thing that would be nice to have for tools debugging purposes would be to record the conversation between gdb and the stub for each command seer is outputting with timestamps. I am saying this because:

    • For reasons I didn't investigate, connection between seer and spice86 is very slow (I measured ~16 seconds) whereas it is instantaneous with the gdb command line.

    • As a gdbserver dev, I know this would have helped me a lot when investigating which command was not providing results gdb was expecting, or investigating timeouts and locks.

@epasveer
Copy link
Owner Author

Hi,

Would be nice to have some colors on the disassembly, gray on white is a bit hard for the eyes.

Under Settings->Configuration->Editor you can change the foreground and background text for the Assembly Tab. Just double-click on the color to bring up a color dialog. Make sure to save the configuration.

image

@epasveer
Copy link
Owner Author

Hi,

Would be nice if connectivity settings were saved after restarting seer, currently I have to go to the connect tab, input my connection string, and input the before and after commands each time I restart it.

Would this help? Seer has a notion of a project file. While in the Debug dialog, you can create a project file.

image

This will save all settings (name of program, debug mode, pre and post commands, etc....) in the Debug dialog to a file.

Then the next time you run Seer, you can do:

$ seergdb --project project.seer 

Or use the "Load Project" icon in the Debug dialog to load the project. The file is a simple Json file that can be manually edited/created.

@epasveer
Copy link
Owner Author

epasveer commented Feb 26, 2023

There are buttons that don't work (run, start, next, step, finish) in assembly mode, for a good reason, but it would be nice if they were hidden because this could be confusing.

This should be fixed now. For Run/Start, this only applies to the Run mode. Now, if they choose Attach, Connect, or Corefile, those buttons are hidden.

If the Assembly Tab is shown, and on top, The Next, Step, and Finish buttons are hidden. The Nexti and Stepi are shown.

@epasveer
Copy link
Owner Author

Double clicking on an address creates a breakpoint but double clicking on the breakpoint disables it instead of deleting it.

I've changed the behavior to match other debuggers. Double clicking on a breakpoint (in the Source or Assembly tabs) will now deleted the breakpoint instead of disabling it. It can still be disabled via the RMB action.

@epasveer
Copy link
Owner Author

Didn't find a way to visualize the stack. You can see it with the memory view of course, but it is not very convenient. Would be nice to have an array view where you could choose the top of the array via an expression (SS*16+SP in my case) and display it in whatever order is needed. For x86 stack, this would be in reverse order as each new push decrements ESP by 2, 4 or 8.

@kevinferrare A couple questions about this one.

(SS*16+SP in my case)

SP is stack pointer. What is SS?

There's lots I can do to visualize the stack. The first question is how to format it? Do you want a simple hexdump?

0xffeac63c: 0xf7d39cba  0xf7d3c0d8  0xf7d3c21b  0x00000001
0xffeac64c: 0xf78d133f  0xffeac6f4  0xf7a14450  0xffeac678
0xffeac65c: 0x00000000  0xf7d3790e

Or do you want to be able to toggle between format types (hex, integer, octal, etc.)

Also, how much of the stack to visualize? I suspect some easy entry field to quickly change how much to show.

And, of course, where to show the stack info. Perhaps in the "Stack Info" area as a new tab called "Stack".
image

Each time the program is stopped (after a Nexti, Stopi, etc...), this view would get updated.

@kevinferrare
Copy link

Hello, thank you for the updates!

I didn't know about the --project option or the save and it made life easier indeed! Maybe reloading previous project by default would be a good option for most users?

Regarding the stack:

  • Address:
    SS is the stack segment.
    In x86 real mode which is the legacy mode in which all PCs boot, memory is accessed using a pair of registers, and for stack it is SS:SP.
    Effective physical address computation is SS*16+SP. More info here: https://en.wikipedia.org/wiki/Real_mode

  • Content:
    x86 stack can contain 16, 32 or 64 bits values (yay!). There is no good way of representing that.
    What would be useful would maybe to have a table that would display a column for each 2 bytes address in rows and with various visualizations in columns so that different representations could be seen for each address.
    Also, as a side note, real mode addresses are pushed on the stack when doing function calls: only IP for near calls, (CS, IP) for far calls and (flags, CS, IP) for interrupt calls.

Since you are supporting various architectures, I guess that being able to specify an expression for the stack top, a direction, and the columns you want to display would already be very good :)
I think stack info should be visible along with registers.
This makes me think (but this would probably a big change) that having the UI elements relocatable in the main window would allow a better customization for each workflow.

@epasveer
Copy link
Owner Author

epasveer commented Jan 6, 2024

There are too many registers in the register view, depending on the target some regs are not present.

I've made improvements for this. There are now register profiles. You can create profiles to show registers that are meaning full. And not show others.

See task #198

@epasveer
Copy link
Owner Author

epasveer commented Jan 6, 2024

Making the PC field editable to jump directly to an address would be good, this is what I tried intuitively. Or maybe have a go to address button like in text editors where you can specify which line you want to go?

This is fixed. Use ^F in the Assembly tab.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants