User forums > Help

Attempt to take address of value not located in memory during debugging - solved

(1/3) > >>

rickkky:
Hi,
Since I have upgrade my ubuntu (10.10 -> codeblocks 10.05), I can not watch any of the contents of variable in debug mode. However, my "cbp" files have not changed!...

Example:
QString tmp = "test";

Watches:
tmp.toStdString() = "Attempt to take address of value not located in memory..."
or:
tmp.toStdString().c_str() = "Attempt to take address of value not located in memory..."

This becomes totally impossible to debug anything (C++/Qt for me) in these conditions ... :-(
Please, does anyone have an idea (except: "boot 10.04") to help me resolve this issue?

Regard.
<http://homepage.gna.org/ldapcppei/Frontends/Howto.html>

MortenMacFly:

--- Quote from: rickkky on November 26, 2011, 12:16:05 am ---tmp.toStdString() = "Attempt to take address of value not located in memory..."
[...]
tmp.toStdString().c_str() = "Attempt to take address of value not located in memory..."

--- End quote ---
Are you aware that a debugger cannot understand this C++ code which needs to be compiled? I guess you should understand what a debugger is able to do and what not. The debugger cannot simply evaluate "tmp.toStdString()" - that's why you see the error. (At least not without special instrumentation.)

rickkky:

--- Quote ---Are you aware that a debugger cannot understand this C++ code which needs to be compiled?
--- End quote ---
I confess that I do not know all that can do a debugger or not, but I am aware at least of what it was doing before and what it is no longer able to do. ;-)  And because I am an optimist guy, my motto is: "larger version, more features"...

Worse than the described issue, here is what I can do when I boot on my old partition of my mechanic hard drive designed in the last century (ubuntu 10.04):
Code:
...
entry *zone = ...;     // here (1) , "entry" is a ldapcppei::class based on a "std::set" (cf. <http://homepage.gna.org/ldapcppei/>)
<breakpoint>
...
Watches give:
(*zone)["zoneName"]->getStrValue() = (display the actual str content of the attribute "zoneName") !...
(where "operator[](char*)" is a search method -and "attribute" positionning- of the class "entry" in libldapcppei ...)

Here I have to admit, like you, I become quite contemplative ...  :shock: but: yes this works!... :shock: :shock:

(1): line 176 in <http://homepage.gna.org/ldapcppei/archives/ldapEasyAdminFrontends/sources/bind9domain.so/bind9domain.cpp>.

Complement: "tmp.toStdString()" (compiled) does not shock me. When "tmp" exists, its method "QString::toStdString()" simply points to the memory address of the "std::string" of the object. And, after all, the role of a debugger is to show the contents of memory addresses. (However, for the example above, I have no explanation for the fact that it works... I just see it works - with Lucid Lynx, not with my Oneric Ocelot and C::B 10.05...).

MortenMacFly:

--- Quote from: rickkky on November 26, 2011, 11:01:44 pm ---not with my Oneric Ocelot and C::B 10.05...).

--- End quote ---
What about if you try a recent debugger nightly? Debugging has improved a lot!

Note that changing the OS might also mean to change the compiler, the debugger and the framework (versions). So there can be many reasons.

rickkky:

--- Quote ---What about if you try a recent debugger nightly? Debugging has improved a lot!
--- End quote ---
This seems the same, but I live in GMT-10... ;-)


--- Quote ---Note that changing the OS might also mean to change the compiler, the debugger and the framework...
--- End quote ---
This is not wrong, but my companion, Friday, suggests to me that I should not be the only one in the world to debug with older distributions and want to continue with the new one... So I wonder if I should return to the previous version.  :?

Navigation

[0] Message Index

[#] Next page

Go to full version