Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: View Contents of a Bitmap during debugging


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 17 - Last Post: Feb 26, 2018 3:25 PM Last Post By: Remy Lebeau (Te... Threads: [ Previous | Next ]
Doulgas Keene

Posts: 44
Registered: 1/17/01
View Contents of a Bitmap during debugging  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 22, 2018 10:34 AM
Hello

Is there a way to view the contents of a bitmap variable while debugging? For example, during a procedure, break point is set and program is stopped (during the breat) to inspect the bitmap? Are there visualizers? It would be helpful to debug programs that manipulate bitmaps for example...

Thanks
Doug
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: View Contents of a Bitmap during debugging  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 22, 2018 11:42 AM   in response to: Doulgas Keene in response to: Doulgas Keene
Doulgas Keene wrote:

Is there a way to view the contents of a bitmap variable while
debugging?

Yes, but it would require you to write an install your own Debug
Visualizer:

http://docwiki.embarcadero.com/RADStudio/en/Debugger_Visualizers

For example, during a procedure, break point is set and program is
stopped (during the breat) to inspect the bitmap? Are there
visualizers?

Not any native ones, no. You need a custom one.

--
Remy Lebeau (TeamB)
Doulgas Keene

Posts: 44
Registered: 1/17/01
Re: View Contents of a Bitmap during debugging  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 22, 2018 12:10 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Thanks, Remy

I can't be the only one who has ever suggested this. Is there any out there already?
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: View Contents of a Bitmap during debugging  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 22, 2018 12:49 PM   in response to: Doulgas Keene in response to: Doulgas Keene
Doulgas Keene wrote:

I can't be the only one who has ever suggested this.

You are not.

Is there any out there already?

Image Visualizer 1.10 for Delphi
https://cc.embarcadero.com/item/27674

TBitmap Debug Visualizer for Delphi and C++ Builder 2010
http://labpacks.blogspot.com/2009/09/tbitmap-debug-visualizer-for-delphi-and.html

They seems to be a bit dated, though, so they probably need to be
tweaked to work with up-to-date versions of Delphi.

--
Remy Lebeau (TeamB)
Doulgas Keene

Posts: 44
Registered: 1/17/01
Re: View Contents of a Bitmap during debugging  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 22, 2018 12:51 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
thanks I will take a look, i hope i don't have to reinvent the wheel.

Remy Lebeau (TeamB) wrote:
Doulgas Keene wrote:

I can't be the only one who has ever suggested this.

You are not.

Is there any out there already?

Image Visualizer 1.10 for Delphi
https://cc.embarcadero.com/item/27674

TBitmap Debug Visualizer for Delphi and C++ Builder 2010
http://labpacks.blogspot.com/2009/09/tbitmap-debug-visualizer-for-delphi-and.html

They seems to be a bit dated, though, so they probably need to be
tweaked to work with up-to-date versions of Delphi.

--
Remy Lebeau (TeamB)
Peter Guth

Posts: 28
Registered: 2/11/05
Re: View Contents of a Bitmap during debugging  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 22, 2018 1:22 PM   in response to: Doulgas Keene in response to: Doulgas Keene
Hi,

A quick and simple solution, which while not elegant, works:

{$Define DebugBitmaps}

............
{$IfDef DebugBitmaps}
Bitmap.SaveToFile('c:\temp\bitmap-step1.bmp');
{$EndIf}

.... more code

{$IfDef DebugBitmaps}
Bitmap.SaveToFile('c:\temp\bitmap-step2.bmp');
{$EndIf}

When it's working, just turn off the conditional define.

Edited by: Peter Guth on Feb 22, 2018 2:14 PM

Doulgas Keene

Posts: 44
Registered: 1/17/01
Re: View Contents of a Bitmap during debugging  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 22, 2018 5:01 PM   in response to: Peter Guth in response to: Peter Guth
thank you Peter

Peter Guth wrote:
Hi,

A quick and simple solution, which while not elegant, works:

{$Define DebugBitmaps}

............
{$IfDef DebugBitmaps}
Bitmap.SaveToFile('c:\temp\bitmap-step1.bmp');
{$EndIf}

.... more code

{$IfDef DebugBitmaps}
Bitmap.SaveToFile('c:\temp\bitmap-step2.bmp');
{$EndIf}

When it's working, just turn off the conditional define.

Edited by: Peter Guth on Feb 22, 2018 2:14 PM

Alex Belo

Posts: 626
Registered: 10/8/06
Re: View Contents of a Bitmap during debugging [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 22, 2018 8:52 PM   in response to: Peter Guth in response to: Peter Guth
Peter Guth wrote:

A quick and simple solution, which while not elegant, works:
...
Bitmap.SaveToFile('c:\temp\bitmap-step1.bmp');

This also works if you put this expression into Watches. ;-)

Don't forget to disable this watch after evaluation; otherwise bmp will
be saved on every debugger step.

--
Alex
Doulgas Keene

Posts: 44
Registered: 1/17/01
Re: View Contents of a Bitmap during debugging [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 24, 2018 3:32 PM   in response to: Alex Belo in response to: Alex Belo
Thanks Alex... nice thought

Alex Belo wrote:
Peter Guth wrote:

A quick and simple solution, which while not elegant, works:
...
Bitmap.SaveToFile('c:\temp\bitmap-step1.bmp');

This also works if you put this expression into Watches. ;-)

Don't forget to disable this watch after evaluation; otherwise bmp will
be saved on every debugger step.

--
Alex
Doulgas Keene

Posts: 44
Registered: 1/17/01
Re: View Contents of a Bitmap during debugging  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 24, 2018 3:35 PM   in response to: Doulgas Keene in response to: Doulgas Keene
Hi, All

Thanks Remy

The only two TBitmap debuggers that I have seen are Boian Mitov's and ImageVisualizer for Delphi. Unfortunately, these were written around 2010 and I can't get them to work correctly in Delphi XE8. Could it be that they just need to be recompiled for 64 bit environment?

Has anyone seen a working TBitmap Debug Visualizer for XE8+? or can anyone get these to work? It's probably a small setting change or something...

Thanks
Doug
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: View Contents of a Bitmap during debugging  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 26, 2018 9:00 AM   in response to: Doulgas Keene in response to: Doulgas Keene
Doulgas Keene wrote:

The only two TBitmap debuggers that I have seen are Boian Mitov's and
ImageVisualizer for Delphi. Unfortunately, these were written around
2010 and I can't get them to work correctly in Delphi XE8.

Why not? What is the actual problem you are having with them?

Could it be that they just need to be recompiled for 64 bit
environment?

No, because the IDE is a 32-bit process.

--
Remy Lebeau (TeamB)
Doulgas Keene

Posts: 44
Registered: 1/17/01
Re: View Contents of a Bitmap during debugging  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 26, 2018 9:10 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
ImageVisualizer as I installed it gives a message like "" is not an integer, i would be happy to debug it if i knew how to debug the program as it's being used as a debugging visualizer...

Mitov's version seems to have been updated to a newer version around 2015, but i can't seem to get the download link for it.

I really need the functionality somehow, and i can debug Image Visualizer if I could step-in to the program, but I don't want to reinvent the wheel if these are easy fixes...

Remy Lebeau (TeamB) wrote:
Doulgas Keene wrote:

The only two TBitmap debuggers that I have seen are Boian Mitov's and
ImageVisualizer for Delphi. Unfortunately, these were written around
2010 and I can't get them to work correctly in Delphi XE8.

Why not? What is the actual problem you are having with them?

Could it be that they just need to be recompiled for 64 bit
environment?

No, because the IDE is a 32-bit process.

--
Remy Lebeau (TeamB)
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: View Contents of a Bitmap during debugging  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 26, 2018 9:37 AM   in response to: Doulgas Keene in response to: Doulgas Keene
Doulgas Keene wrote:

ImageVisualizer as I installed it gives a message like "" is not an
integer, i would be happy to debug it if i knew how to debug the
program as it's being used as a debugging visualizer...

You can debug one instance of the IDE with another instance of the IDE.

--
Remy Lebeau (TeamB)
Doulgas Keene

Posts: 44
Registered: 1/17/01
Re: View Contents of a Bitmap during debugging  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 26, 2018 9:39 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Thanks
So, running a program that uses the debugger visualizer in an IDE, then run another IDE with the Visualizer program and a breakpoint and the program would break (stop) in the second IDE??
Doug

Remy Lebeau (TeamB) wrote:
Doulgas Keene wrote:

ImageVisualizer as I installed it gives a message like "" is not an
integer, i would be happy to debug it if i knew how to debug the
program as it's being used as a debugging visualizer...

You can debug one instance of the IDE with another instance of the IDE.

--
Remy Lebeau (TeamB)
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: View Contents of a Bitmap during debugging  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 26, 2018 9:59 AM   in response to: Doulgas Keene in response to: Doulgas Keene
Doulgas Keene wrote:

So, running a program that uses the debugger visualizer in an IDE,
then run another IDE with the Visualizer program and a breakpoint
and the program would break (stop) in the second IDE??

I don't know if this trick works for debugging code at is run by the
debugger, I haven't tried it. But, in general, this is the technique
to use when debugging code that runs in the IDE process, such as
design-time packages/editors.

Run one instance of the IDE, and load the visualizer package source
into it. Then go into the Run menu and set the Host to be 'bds.exe',
then Run the project. A second instance of the IDE will be started.
Load your main program into the second instance and invoke the
visualizer. The first instance of the IDE should now be able to step
into the visualizer's source code.

--
Remy Lebeau (TeamB)
Doulgas Keene

Posts: 44
Registered: 1/17/01
Re: View Contents of a Bitmap during debugging  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 26, 2018 10:05 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Thanks, Remy

Good suggestion, I will see if I can get this to work!

Doug


Remy Lebeau (TeamB) wrote:
Doulgas Keene wrote:

So, running a program that uses the debugger visualizer in an IDE,
then run another IDE with the Visualizer program and a breakpoint
and the program would break (stop) in the second IDE??

I don't know if this trick works for debugging code at is run by the
debugger, I haven't tried it. But, in general, this is the technique
to use when debugging code that runs in the IDE process, such as
design-time packages/editors.

Run one instance of the IDE, and load the visualizer package source
into it. Then go into the Run menu and set the Host to be 'bds.exe',
then Run the project. A second instance of the IDE will be started.
Load your main program into the second instance and invoke the
visualizer. The first instance of the IDE should now be able to step
into the visualizer's source code.

--
Remy Lebeau (TeamB)
Doulgas Keene

Posts: 44
Registered: 1/17/01
Re: View Contents of a Bitmap during debugging  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 26, 2018 2:02 PM   in response to: Doulgas Keene in response to: Doulgas Keene
Remy:
I got the method that you described to work, Thank you. That is handy. The program breaks down on aSourceMemorySize and assigns '' to aSourceMemorySize. Any thoughts? This might help others trying to do the same thing.

try
Evaluate(DebugSvcs, CurProcess, CurThread,
FExpression + '.SaveToStream(TMemoryStream(' +
aSourceMemoryStream + '))');

=====>Program does not assign a value to aSourceMemorySize
aSourceMemorySize := Evaluate(DebugSvcs, CurProcess, CurThread,
'TMemoryStream(' + aSourceMemoryStream + ').Size');
======>

// if size is 0 then this graphic variable has been created but
// not yet initliazed
if aSourceMemorySize <> '0' then

Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: View Contents of a Bitmap during debugging  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 26, 2018 3:25 PM   in response to: Doulgas Keene in response to: Doulgas Keene
Doulgas Keene wrote:

=====>Program does not assign a value to aSourceMemorySize
aSourceMemorySize := Evaluate(DebugSvcs, CurProcess, CurThread,
'TMemoryStream(' + aSourceMemoryStream + ').Size');
======>

Sorry, can't help you with that. You will have to debug into
Evaluate() to find out why it is returning an empty string.

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02