epasveer / seer

Seer - a gui frontend to gdb
GNU General Public License v3.0
2.11k stars 67 forks source link

Debuggee bitmap image viewer suggestion #110

Closed bit69tream closed 1 year ago

bit69tream commented 1 year ago

Before seer i've been using gf and tbh there is only one feature i really miss - an ability to view images from the memory of a debuggee.

You can see it in action here: feature

Would really appreciate if this feature was to be implemented in seer :)

epasveer commented 1 year ago

That's an interesting feature.

Obviously, you need to know the start address of the memory buffer. Do you need to know the size of the memory buffer? Or does GF figure that out somehow?

Also, the image could be: png, bmp, etc.... ?

bit69tream commented 1 year ago

21-10-22--21-05-38 Here you can see a pop-up which you can use to add bitmaps. You are required to provide image dimensions because the image itself is assumed to be a flat array of RGBA pixels.

I personally think that this format is enough for most use cases.

It would also be really handy having an option to choose pixel format (RGBA, RGB, BGR, etc), which GF doesn't have at the moment.

epasveer commented 1 year ago

Okay. Thanks for the screenshot. I'll play around with it.

epasveer commented 1 year ago

I use Qt as the gui toolkit. It has a number of formats it support. Could you look at this page and see which ones you want supported for the first cut?

https://doc.qt.io/qt-5/qimage.html#Format-enum

epasveer commented 1 year ago

I'll start with these.

image

bit69tream commented 1 year ago

RGBA8888 and RGB888 is honestly enough for me. I almost always use stb_image.h header-only lib for loading images and those are formats in which this library usually gives data.

epasveer commented 1 year ago

Got it. I'll start with those two.

epasveer commented 1 year ago

BTW, how big are the images you typically view? (width x height)

bit69tream commented 1 year ago

I think it's usually around 2k pixels on each size. Why do you ask?

epasveer commented 1 year ago

I'm encountering a speed issue in my code. Just wondering how fast GF is when you attempt to view an image. Is it instant?

bit69tream commented 1 year ago

Yes, it is.

epasveer commented 1 year ago

I have some speed issues to work out, but the image viewer is coming along.

image

bit69tream commented 1 year ago

Looks nice!

epasveer commented 1 year ago

Good and bad news. :)

I've added the Image viewer to the MemoryVisualizer. Works well.

I've identified the slowness.The other 2 tabs in the MemoryVisualizer are the culprits (Hex and Assembly tabs).

I use Qt's QPlainTextEdit widget. It's EXTREMELY slow for large number of lines. With images (800K bytes), this results in a lot of text lines. Bogs down the QPlainTextEdit.

While I have updated the code to git, it's basically not usable yet. I need to find a replacement for QPlainTextEdit. Will let you know.

bit69tream commented 1 year ago

Oh yeah it's really slow. Excited to see it working fast!

And I also thing there is more room for QoL improvement!

  1. Can you make it that user is able to put variable names inside width and height fields?
  2. The fact that I need to manually put value into the bytes field is a bit annoying. I end up trying to display image first and putting in the number from the message at the bottom anyways.

Tbh I don't really see a purpose for the bytes field while viewing images anyway ¯\(ツ)/¯.

I cougld help implementing these btw. Would love to help the project with more that just feature suggestions! :D

epasveer commented 1 year ago

I'll remove what I added to the "MemoryVisualizer" and I think I'll make a separate "ImageVisualizer".

The width and height fields can be made to accept a variable name, function name, or a literal. A bytes field isn't necessary.

Thanks for the suggestions!

epasveer commented 1 year ago

I've made a new "ImageVisualizer" and reverted the "MemoryVisualizer" back to the way it was before.

image image

Select one of these two methods to launch it.

Enter the variable name and hit ENTER. It should fill in the variable's address.

image

For now, you need to enter the width and height (in pixels) and select which format. Hit REFRESH or ENTER will show the image. I'll work on allowing the width and height fields to take a variable.

image

You can interact with the image to zoom in or out.

    '+' zoom in
    '-' zoom out
    <ESC> reset to default zoom level.
    ^P  print image.
epasveer commented 1 year ago

Doh! Didn't mean to close this task yet.

bit69tream commented 1 year ago

Wow! An ability to zoom in/out is awesome!

epasveer commented 1 year ago

I fixed the "SAVE" and "PRINT" icons. And I felt I needed to remove the "^P" for printing.

epasveer commented 1 year ago

I'm going to close this task. I've created another task to allow a variable expression to be entered for the width/height size. As this can be added to other visualizers.

115