Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ TheIDE » U++ TheIDE: Compiling, Linking, Debugging of your packages » How to inspect memory at pointer-address while debugging
How to inspect memory at pointer-address while debugging [message #51980] Sat, 29 June 2019 10:29 Go to next message
slashupp is currently offline  slashupp
Messages: 193
Registered: July 2009
Experienced Member
Am trying to resolve a segfault.
Debugging, I get a pointer-value that I need to look at the data it
points to so I can try locate it in my code.
How can I display the block of memory it points to?

[Updated on: Sat, 29 June 2019 12:19]

Report message to a moderator

Re: How to inspect memory at pointer-address while debugging [message #51981 is a reply to message #51980] Sun, 30 June 2019 00:26 Go to previous messageGo to next message
mirek is currently online  mirek
Messages: 12105
Registered: November 2005
Ultimate Member
slashupp wrote on Sat, 29 June 2019 10:29
Am trying to resolve a segfault.
Debugging, I get a pointer-value that I need to look at the data it
points to so I can try locate it in my code.
How can I display the block of memory it points to?


Right-click the watch/auto line with ptr value, "Memory at...":
Re: How to inspect memory at pointer-address while debugging [message #51982 is a reply to message #51981] Sun, 30 June 2019 10:12 Go to previous messageGo to next message
slashupp is currently offline  slashupp
Messages: 193
Registered: July 2009
Experienced Member
hi mirek

I use Linux (Devuan/Debian)

Quote:
Right-click the watch/auto line with ptr value, "Memory at...":


R-click shows only "Insert / Edit / Delete"-options in Watches-tab,
no effect when I R-click in Auto/Locals-tabs

Is there some setting I need to change, add something somewhere, an option I need to tick?

PS: I see this "Memory at" is in Pdb.h which depends on PLATFORM_WIN32 (in Debuggers.h line 115)
Is it not available for Linux?

[Updated on: Sun, 30 June 2019 10:17]

Report message to a moderator

Re: How to inspect memory at pointer-address while debugging [message #51983 is a reply to message #51982] Sun, 30 June 2019 10:26 Go to previous messageGo to next message
mirek is currently online  mirek
Messages: 12105
Registered: November 2005
Ultimate Member
slashupp wrote on Sun, 30 June 2019 10:12
hi mirek

I use Linux (Devuan/Debian)

Quote:
Right-click the watch/auto line with ptr value, "Memory at...":


R-click shows only "Insert / Edit / Delete"-options in Watches-tab,
no effect when I R-click in Auto/Locals-tabs

Is there some setting I need to change, add something somewhere, an option I need to tick?

PS: I see this "Memory at" is in Pdb.h which depends on PLATFORM_WIN32 (in Debuggers.h line 115)
Is it not available for Linux?


I see, sorry, you have not mentioned what system you use. That is for MSVC...

Mirek
Re: How to inspect memory at pointer-address while debugging [message #51984 is a reply to message #51983] Sun, 30 June 2019 11:16 Go to previous messageGo to next message
slashupp is currently offline  slashupp
Messages: 193
Registered: July 2009
Experienced Member

Any chance of getting this for Linux as well?
Or possible workaround so I can display the memory-content for the pointer?
Re: How to inspect memory at pointer-address while debugging [message #51986 is a reply to message #51984] Sun, 30 June 2019 17:44 Go to previous messageGo to next message
mirek is currently online  mirek
Messages: 12105
Registered: November 2005
Ultimate Member
slashupp wrote on Sun, 30 June 2019 11:16

Any chance of getting this for Linux as well?


Definitely.

Quote:

Or possible workaround so I can display the memory-content for the pointer?


Well, you can always run gdb commandline...

Mirek
Re: How to inspect memory at pointer-address while debugging [message #52021 is a reply to message #51980] Fri, 05 July 2019 16:11 Go to previous messageGo to next message
slashupp is currently offline  slashupp
Messages: 193
Registered: July 2009
Experienced Member
Eventually found the cause for my segfault..
I used three global string-vars that got set by some classes and used elsewhere
for context-data.
For some reason the system tried to free their memory twice (found by single-stepping with gdb)
I moved them to their own class and used getter/setters for access and passed a pointer to this
class around, and the segfault went away.
Took days to find & fix...
Lesson learned: try to avoid global variables!
Hope this will help someone with similar symptoms
Re: How to inspect memory at pointer-address while debugging [message #52022 is a reply to message #52021] Sat, 06 July 2019 08:38 Go to previous messageGo to next message
mirek is currently online  mirek
Messages: 12105
Registered: November 2005
Ultimate Member
slashupp wrote on Fri, 05 July 2019 16:11
Eventually found the cause for my segfault..
I used three global string-vars that got set by some classes and used elsewhere
for context-data.
For some reason the system tried to free their memory twice (found by single-stepping with gdb)
I moved them to their own class and used getter/setters for access and passed a pointer to this
class around, and the segfault went away.
Took days to find & fix...
Lesson learned: try to avoid global variables!
Hope this will help someone with similar symptoms


Interesting. Usually it works fine and it would be good to know exact circumstances....

Mirek
Re: How to inspect memory at pointer-address while debugging [message #52100 is a reply to message #51984] Fri, 19 July 2019 14:17 Go to previous messageGo to next message
mirek is currently online  mirek
Messages: 12105
Registered: November 2005
Ultimate Member
slashupp wrote on Sun, 30 June 2019 11:16

Any chance of getting this for Linux as well?
Or possible workaround so I can display the memory-content for the pointer?


It is now implemented for GDB (and that way linux) too.

Mirek
Re: How to inspect memory at pointer-address while debugging [message #52112 is a reply to message #52100] Sat, 20 July 2019 10:20 Go to previous messageGo to next message
slashupp is currently offline  slashupp
Messages: 193
Registered: July 2009
Experienced Member
great stuff! going to download latest svn from nightly builds & test
thx mirek

[Updated on: Sat, 20 July 2019 10:20]

Report message to a moderator

Re: How to inspect memory at pointer-address while debugging [message #52114 is a reply to message #52112] Sat, 20 July 2019 12:25 Go to previous messageGo to next message
slashupp is currently offline  slashupp
Messages: 193
Registered: July 2009
Experienced Member
crashes theide with segfault : something..??can't see (behind xmessage: "Invalid memory access") "too big"


I suggest a smaller buffer to be used, with size default say about 128 bytes, and
configurable in 'Settings'. It's rare to want to see entire buffer at pointer.

Also maybe make the buffer scrollable say 16 bytes at a time both forward and backward
of the pointer's address

[Updated on: Sat, 20 July 2019 19:28]

Report message to a moderator

Re: How to inspect memory at pointer-address while debugging [message #52119 is a reply to message #52114] Sun, 21 July 2019 11:20 Go to previous messageGo to next message
mirek is currently online  mirek
Messages: 12105
Registered: November 2005
Ultimate Member
Found and fixed (hopefully...)
Re: How to inspect memory at pointer-address while debugging [message #52121 is a reply to message #52119] Mon, 22 July 2019 07:39 Go to previous messageGo to next message
slashupp is currently offline  slashupp
Messages: 193
Registered: July 2009
Experienced Member

nope, still same crash

I've checked-out using subversion & copied the relevant directories to my $HOME/upp
since the tar-ball is still at 13502 which I already use
Re: How to inspect memory at pointer-address while debugging [message #52125 is a reply to message #52121] Mon, 22 July 2019 14:00 Go to previous messageGo to next message
mirek is currently online  mirek
Messages: 12105
Registered: November 2005
Ultimate Member
slashupp wrote on Mon, 22 July 2019 07:39

nope, still same crash


It works for me (checked linux and mingw)....

Quote:

I've checked-out using subversion & copied the relevant directories to my $HOME/upp
since the tar-ball is still at 13502 which I already use


There is handy function to checkout and configure the trunk - right click Assembly list...

Well, if this does not work with recompiled theide, I will need more details...

Mirek
Re: How to inspect memory at pointer-address while debugging [message #52127 is a reply to message #52125] Mon, 22 July 2019 17:25 Go to previous messageGo to next message
slashupp is currently offline  slashupp
Messages: 193
Registered: July 2009
Experienced Member
Quote:
There is handy function to checkout and configure the trunk - right click Assembly list...


Where is this 'Assembly list...' that I need to right-click?
(I did "svn checkout svn://www.ultimatepp.org/upp/trunk/" to get the (current?) version I used)

I'd rather use the to-be-updated tarball in the Nightly builds - it is much less of a hassle to use than svn directly.

[Updated on: Mon, 22 July 2019 17:44]

Report message to a moderator

Re: How to inspect memory at pointer-address while debugging [message #52128 is a reply to message #52127] Mon, 22 July 2019 18:37 Go to previous messageGo to next message
mirek is currently online  mirek
Messages: 12105
Registered: November 2005
Ultimate Member
slashupp wrote on Mon, 22 July 2019 17:25
Quote:
There is handy function to checkout and configure the trunk - right click Assembly list...


Where is this 'Assembly list...' that I need to right-click?
(I did "svn checkout svn://www.ultimatepp.org/upp/trunk/" to get the (current?) version I used)

I'd rather use the to-be-updated tarball in the Nightly builds - it is much less of a hassle to use than svn directly.


When you start TheIDE, there is "Assembly" list in the left of package selection dialog.
Re: How to inspect memory at pointer-address while debugging [message #52133 is a reply to message #52128] Tue, 23 July 2019 11:21 Go to previous messageGo to next message
slashupp is currently offline  slashupp
Messages: 193
Registered: July 2009
Experienced Member

Quote:
When you start TheIDE, there is "Assembly" list in the left of package selection dialog.


Ah. It's in Setup-menu of ide as well.. will experiment

SHIT!!! My main monitor just now went red for a couple of seconds and then blank, and does
that now continuously when I turn it on: show all in red for a few sec's then dies
it's a Samsung P2450, using the second monitor (21" Dell)
Can the monitor be fixed? or is it trash now?
Anyone know of sites with info on repairing this kind of thing?
Re: How to inspect memory at pointer-address while debugging [message #52134 is a reply to message #51980] Tue, 23 July 2019 14:26 Go to previous message
slashupp is currently offline  slashupp
Messages: 193
Registered: July 2009
Experienced Member
got 13505, tested and all is working
thx
Previous Topic: log-file is empty
Next Topic: Compiling Fortran sources in TheIde
Goto Forum:
  


Current Time: Wed Nov 20 08:11:04 CET 2019

Total time taken to generate the page: 0.01733 seconds