Bug 180975 - Cannot explore value of "string" C++ variable - variable view clears up
Summary: Cannot explore value of "string" C++ variable - variable view clears up
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug (show other bugs)
Version: 3.1.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1.3   Edit
Assignee: Alain Magloire CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-04-04 11:29 EDT by Elena Laskavaia CLA
Modified: 2008-06-19 23:49 EDT (History)
2 users (show)

See Also:


Attachments
Debug Perspective after View resets (80.46 KB, image/png)
2007-04-04 11:30 EDT, Elena Laskavaia CLA
no flags Details
Patch for MI for cdt_3_1 branch (7.89 KB, patch)
2007-04-04 12:43 EDT, Elena Laskavaia CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Elena Laskavaia CLA 2007-04-04 11:29:56 EDT
Description: 

Variable view of the debugger resets and don't show any vars when
exploring structure of string type variable in C++

How to Reproduce:

#include <string>
using namespace std;
int main(int argc, char *argv[]) {
        string aa("foo");
        return EXIT_SUCCESS; // breakpoint
}


* Run debugger (This is QNX Project)
* Set breakpoint on return
* when hit expore aa varaible
** expand protected
** expand _Bx
** expand public
** expnad _Buf

View would become grey - no vars, error message displayed on console
There is no member or method named _Buf.
Type _Container_base has no component named _Buf.

Mi Protocol looks like:
[1,175,633,138,039] 1011-data-evaluate-expression aa
[1,175,633,138,039] 1011^done,value="{<_String_val<char,std::allocator<char> >>
= {<_String_base> = \
{<_Container_base> = {<No data fields>}, <No data fields>}, _Alval =
{<_Allocator_base<char>> = {<No\
 data fields>}, <No data fields>}}, static npos = 4294967295, _Bx = {_Buf =
\"foo\\0\\001\\0\\0\\0\\\
314z\\004\\b\\377\\377\\377\\377\", _Ptr = 0x6f6f66 <Error reading address
0x6f6f66: error 312>}, _M\
ysize = 3, _Myres = 15}"
[1,175,633,138,039] (gdb) 
[1,175,633,150,498] 1012-var-create - * *(((aa)._Buf)+0)@16
[1,175,633,150,498] &"There is no member or method named _Buf.\n"
[1,175,633,150,498] &"Type _Container_base has no component named _Buf.\n"
[1,175,633,150,498] 1012^error,msg="."
[1,175,633,150,498] (gdb)


CDT 4.0 Still has this problem.

I run same app as Local C++ App on Windows. Variable view does not
crash but still shows wrong values:
When exploring var and clicking on _M_p var it shows shole structure
not single _M_p value, When clicking on *_M_p it gives an error:
Target request failed: Structure has no component named operator*..

The reason is the same - MI incorrectly process situations when type is
IncompleteType - which is Structure or Class from system headers usually
("string" in this case).
Comment 1 Elena Laskavaia CLA 2007-04-04 11:30:52 EDT
Created attachment 62943 [details]
Debug Perspective after View resets
Comment 2 Elena Laskavaia CLA 2007-04-04 12:43:28 EDT
Created attachment 62956 [details]
Patch for MI for cdt_3_1 branch

Here is the patch. Probably there is some bugs in actual Variable view
but I think it is better to fix data queries in this case.
Comment 3 Alain Magloire CLA 2007-04-09 16:42:49 EDT
Ok
Comment 4 Alain Magloire CLA 2007-04-09 16:44:14 EDT
Thank Elena, Patch apply to head and 3_1 branch.

Dave you should put a tester to verify this for the 3_1 branh
Comment 5 Elena Laskavaia CLA 2007-04-13 09:52:37 EDT
Can you apply it on HEAD too, or it is going to merged later?
Comment 6 Alain Magloire CLA 2007-04-13 10:12:16 EDT
(In reply to comment #5)
> Can you apply it on HEAD too, or it is going to merged later?

it is apply to the head and cdt_3_1