Bug 18332 - internal-error with -var-evaluate-expression
Summary: internal-error with -var-evaluate-expression
Status: RESOLVED DUPLICATE of bug 15166
Alias: None
Product: gdb
Classification: Unclassified
Component: varobj (show other bugs)
Version: 7.9
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-26 12:38 UTC by RedSkotina
Modified: 2024-01-13 18:53 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
patch for fix problem with update childrens of dynamic varobj (454 bytes, patch)
2015-05-02 12:58 UTC, RedSkotina
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description RedSkotina 2015-04-26 12:38:17 UTC
Overview: 

gdb crashed while trying evalue expression from structure.


Steps to Reproduce:
compile:
//pretty_printing_test.cpp

#include <vector>
using namespace std;

class Test{
public:
    int s;
    Test(int i){s = i;};
};
int main(int argc, char **argv)
{
    vector<Test*> vector_of_objptr;
    vector_of_objptr.push_back(new Test(11));
    vector_of_objptr.push_back(new Test(22)); //line 17
}

debug with gdb:
c:/gdb79/bin/gdb --batch --interpreter=mi2 -q -nx  -x mintest.mi 
# mintest.mi

interpreter-exec mi "-gdb-set breakpoint pending on"
interpreter-exec mi "-enable-pretty-printing"

python
import sys
sys.path.insert(0, 'C:\Users\Red\AppData\Roaming\codelite\gdb_printers')
from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers (None)
end


interpreter-exec mi "-file-exec-and-symbols --thread-group i1 pretty_printing_test.exe"
interpreter-exec mi "-break-insert -f \"main.cpp:17\""

commands 1
interpreter-exec mi "-var-create - @ \"vector_of_objptr\""
interpreter-exec mi "-var-evaluate-expression \"var1\""
interpreter-exec mi "-var-update \"var1\""
interpreter-exec mi "-var-list-children \"var1\""
interpreter-exec mi "-var-evaluate-expression \"var1.[0]\""
interpreter-exec mi "-var-update \"var1.[0]\""
interpreter-exec mi "-var-list-children \"var1.[0]\""
interpreter-exec mi "-var-evaluate-expression \"var1.[0]\""
end

interpreter-exec mi "-exec-run"

Actual Results:
C:\gdb79\bin\gdb-children-bug>c:/gdb79/bin/gdb --batch --interpreter=mi2 -q -nx
 -x mintest.mi
=thread-group-added,id="i1"
~"^done\n"
~"^done\n"
~"^done\n"
~"^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=
\"0x00401596\",func=\"main(int, char**)\",file=\"D:/code/testx/testx/pretty_prin
ting_test/main.cpp\",fullname=\"D:\\\\code\\\\testx\\\\testx\\\\pretty_printing_
test\\\\main.cpp\",line=\"17\",thread-groups=[\"i1\"],times=\"0\",original-locat
ion=\"main.cpp:17\"}\n"
=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
addr="0x00401596",func="main(int, char**)",file="D:/code/testx/testx/pretty_prin
ting_test/main.cpp",fullname="D:\\code\\testx\\testx\\pretty_printing_test\\main
.cpp",line="17",thread-groups=["i1"],times="0",script={"interpreter-exec mi \"-v
ar-create - @ \\\"vector_of_objptr\\\"\"","interpreter-exec mi \"-var-evaluate-e
xpression \\\"var1\\\"\"","interpreter-exec mi \"-var-update \\\"var1\\\"\"","in
terpreter-exec mi \"-var-list-children \\\"var1\\\"\"","interpreter-exec mi \"-v
ar-evaluate-expression \\\"var1.[0]\\\"\"","interpreter-exec mi \"-var-update \\
\"var1.[0]\\\"\"","interpreter-exec mi \"-var-list-children \\\"var1.[0]\\\"\"",
"interpreter-exec mi \"-var-evaluate-expression \\\"var1.[0]\\\"\""},original-lo
cation="main.cpp:17"}
=thread-group-started,id="i1",pid="8080"
=thread-created,id="1",group-id="i1"
~"~\"[New Thread 8080.0x1f74]\\n\"\n"
~"^running\n"
~"*running,thread-id=\"all\"\n"
~"(gdb) \n"
=library-loaded,id="C:\\Windows\\SysWOW64\\ntdll.dll",target-name="C:\\Windows\\
SysWOW64\\ntdll.dll",host-name="C:\\Windows\\SysWOW64\\ntdll.dll",symbols-loaded
="0",thread-group="i1"
=library-loaded,id="C:\\Windows\\syswow64\\kernel32.dll",target-name="C:\\Window
s\\syswow64\\kernel32.dll",host-name="C:\\Windows\\syswow64\\kernel32.dll",symbo
ls-loaded="0",thread-group="i1"
=library-loaded,id="C:\\Windows\\syswow64\\KernelBase.dll",target-name="C:\\Wind
ows\\syswow64\\KernelBase.dll",host-name="C:\\Windows\\syswow64\\KernelBase.dll"
,symbols-loaded="0",thread-group="i1"
=library-loaded,id="C:\\Windows\\syswow64\\msvcrt.dll",target-name="C:\\Windows\
\syswow64\\msvcrt.dll",host-name="C:\\Windows\\syswow64\\msvcrt.dll",symbols-loa
ded="0",thread-group="i1"
=library-loaded,id="c:\\gdb79\\opt\\bin\\libgcc_s_sjlj-1.dll",target-name="c:\\g
db79\\opt\\bin\\libgcc_s_sjlj-1.dll",host-name="c:\\gdb79\\opt\\bin\\libgcc_s_sj
lj-1.dll",symbols-loaded="0",thread-group="i1"
=library-loaded,id="c:\\gdb79\\opt\\bin\\libwinpthread-1.dll",target-name="c:\\g
db79\\opt\\bin\\libwinpthread-1.dll",host-name="c:\\gdb79\\opt\\bin\\libwinpthre
ad-1.dll",symbols-loaded="0",thread-group="i1"
=library-loaded,id="C:\\TDM-GCC-64\\bin\\libstdc++-6.dll",target-name="C:\\TDM-G
CC-64\\bin\\libstdc++-6.dll",host-name="C:\\TDM-GCC-64\\bin\\libstdc++-6.dll",sy
mbols-loaded="0",thread-group="i1"
=library-loaded,id="C:\\Windows\\syswow64\\user32.dll",target-name="C:\\Windows\
\syswow64\\user32.dll",host-name="C:\\Windows\\syswow64\\user32.dll",symbols-loa
ded="0",thread-group="i1"
=library-loaded,id="C:\\Windows\\syswow64\\gdi32.dll",target-name="C:\\Windows\\
syswow64\\gdi32.dll",host-name="C:\\Windows\\syswow64\\gdi32.dll",symbols-loaded
="0",thread-group="i1"
=library-loaded,id="C:\\Windows\\syswow64\\lpk.dll",target-name="C:\\Windows\\sy
swow64\\lpk.dll",host-name="C:\\Windows\\syswow64\\lpk.dll",symbols-loaded="0",t
hread-group="i1"
=library-loaded,id="C:\\Windows\\syswow64\\usp10.dll",target-name="C:\\Windows\\
syswow64\\usp10.dll",host-name="C:\\Windows\\syswow64\\usp10.dll",symbols-loaded
="0",thread-group="i1"
=library-loaded,id="C:\\Windows\\syswow64\\advapi32.dll",target-name="C:\\Window
s\\syswow64\\advapi32.dll",host-name="C:\\Windows\\syswow64\\advapi32.dll",symbo
ls-loaded="0",thread-group="i1"
=library-loaded,id="C:\\Windows\\SysWOW64\\sechost.dll",target-name="C:\\Windows
\\SysWOW64\\sechost.dll",host-name="C:\\Windows\\SysWOW64\\sechost.dll",symbols-
loaded="0",thread-group="i1"
=library-loaded,id="C:\\Windows\\syswow64\\rpcrt4.dll",target-name="C:\\Windows\
\syswow64\\rpcrt4.dll",host-name="C:\\Windows\\syswow64\\rpcrt4.dll",symbols-loa
ded="0",thread-group="i1"
=library-loaded,id="C:\\Windows\\syswow64\\sspicli.dll",target-name="C:\\Windows
\\syswow64\\sspicli.dll",host-name="C:\\Windows\\syswow64\\sspicli.dll",symbols-
loaded="0",thread-group="i1"
=library-loaded,id="C:\\Windows\\syswow64\\cryptbase.dll",target-name="C:\\Windo
ws\\syswow64\\cryptbase.dll",host-name="C:\\Windows\\syswow64\\cryptbase.dll",sy
mbols-loaded="0",thread-group="i1"
=library-loaded,id="C:\\Windows\\SysWOW64\\imm32.dll",target-name="C:\\Windows\\
SysWOW64\\imm32.dll",host-name="C:\\Windows\\SysWOW64\\imm32.dll",symbols-loaded
="0",thread-group="i1"
=library-loaded,id="C:\\Windows\\syswow64\\msctf.dll",target-name="C:\\Windows\\
syswow64\\msctf.dll",host-name="C:\\Windows\\syswow64\\msctf.dll",symbols-loaded
="0",thread-group="i1"
=library-loaded,id="c:\\ansicon\\ANSI32.dll",target-name="c:\\ansicon\\ANSI32.dl
l",host-name="c:\\ansicon\\ANSI32.dll",symbols-loaded="0",thread-group="i1"
=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
addr="0x00401596",func="main(int, char**)",file="D:/code/testx/testx/pretty_prin
ting_test/main.cpp",fullname="D:\\code\\testx\\testx\\pretty_printing_test\\main
.cpp",line="17",thread-groups=["i1"],times="1",script={"interpreter-exec mi \"-v
ar-create - @ \\\"vector_of_objptr\\\"\"","interpreter-exec mi \"-var-evaluate-e
xpression \\\"var1\\\"\"","interpreter-exec mi \"-var-update \\\"var1\\\"\"","in
terpreter-exec mi \"-var-list-children \\\"var1\\\"\"","interpreter-exec mi \"-v
ar-evaluate-expression \\\"var1.[0]\\\"\"","interpreter-exec mi \"-var-update \\
\"var1.[0]\\\"\"","interpreter-exec mi \"-var-list-children \\\"var1.[0]\\\"\"",
"interpreter-exec mi \"-var-evaluate-expression \\\"var1.[0]\\\"\""},original-lo
cation="main.cpp:17"}
~"*stopped,reason=\"breakpoint-hit\",disp=\"keep\",bkptno=\"1\",frame={addr=\"0x
00401596\",func=\"main\",args=[{name=\"argc\",value=\"1\"},{name=\"argv\",value=
\"0x9c2ca0\"}],file=\"D:/code/testx/testx/pretty_printing_test/main.cpp\",fullna
me=\"D:\\\\code\\\\testx\\\\testx\\\\pretty_printing_test\\\\main.cpp\",line=\"1
7\"},thread-id=\"1\",stopped-threads=\"all\"\n"
~"^done,name=\"var1\",numchild=\"0\",value=\"{...}\",type=\"std::vector<Test*, s
td::allocator<Test*> >\",thread-id=\"1\",displayhint=\"array\",dynamic=\"1\",has
_more=\"1\"\n"
~"^done,value=\"{...}\"\n"
~"^done,changelist=[]\n"
~"^done,numchild=\"1\",displayhint=\"array\",children=[child={name=\"var1.[0]\",
exp=\"[0]\",numchild=\"1\",type=\"Test *\",thread-id=\"1\"}],has_more=\"0\"\n"
~"^done,value=\"0x9c3198\"\n"
~"^done,changelist=[{name=\"var1.[0]\",in_scope=\"true\",type_changed=\"false\",
has_more=\"0\"}]\n"
~"^done,numchild=\"1\",children=[child={name=\"var1.[0].public\",exp=\"public\",
numchild=\"1\",thread-id=\"1\"}],has_more=\"0\"\n"
~"~\"c-varobj.c:519: internal-error: c_value_of_variable: Assertion `varobj_valu
e_is_changeable_p (var)' failed.\\nA problem internal to GDB has been detected,\
\nfurther debugging may prove unreliable.\\nQuit this debugging session? \"\n"
~"~\"(y or n) [answered Y; input not from terminal]\\n\"\n"
~"&\"\\nThis is a bug, please report it.\"\n"
~"&\"  For instructions, see:\\n<http://www.gnu.org/software/gdb/bugs/>.\"\n"
~"&\"\\n\\n\"\n"
~"~\"c-varobj.c:519: internal-error: c_value_of_variable: Assertion `varobj_valu
e_is_changeable_p (var)' failed.\\nA problem internal to GDB has been detected,\
\nfurther debugging may prove unreliable.\\nCreate a core file of GDB? \"\n"
~"~\"(y or n) [answered Y; input not from terminal]\\n\"\n"

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

Expected Results:
No error

Build Date & Hardware: 
7.9 release Build 2015-22-04 on Windows 7 x64 (i686-mingw-w64)

Additional Information:
None
Comment 1 RedSkotina 2015-04-26 12:43:36 UTC
im just comment out 
c-varobj.c:519: // gdb_assert (varobj_value_is_changeable_p (var));
and it is work. 
i dont know why assert need here. gdb must not crashed even when try evaluate not -changeable value.
Comment 2 RedSkotina 2015-04-29 20:18:27 UTC
comment out not is solution. gdb just going mad.
seems root of problem lay in function -var-update ,  which return invalid(?) base type and likely not utilize python pretty printer. still investigate.
Comment 3 RedSkotina 2015-05-02 12:58:37 UTC
Created attachment 8298 [details]
patch for fix problem with update childrens of dynamic varobj

experienced gdb developers must test this patch
(warning: nonfullverified, brutforce method)
Comment 4 Hannes Domani 2024-01-13 18:53:49 UTC
Dup.

*** This bug has been marked as a duplicate of bug 15166 ***