[Bug mi/12531] New: Crash when -var-set-visualizer <something> gdb.default_visualizer

dodji at seketeli dot org sourceware-bugzilla@sourceware.org
Wed Mar 2 10:53:00 GMT 2011


http://sourceware.org/bugzilla/show_bug.cgi?id=12531

           Summary: Crash when -var-set-visualizer <something>
                    gdb.default_visualizer
           Product: gdb
           Version: archer
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mi
        AssignedTo: unassigned@sourceware.org
        ReportedBy: dodji@seketeli.org


[dodji@adjoa test]$ cat test.cc
    #include <string>

    using std::string;

    class person
    {
    string m_name;

    public:
    person (const string& name = ""):
        m_name (name)
    {
    }
    };

    int
    main()
    {
    person p ("Toto");
    return 0;
    }

Then I comiled this with g++ -g test test.cc

Then after this gdb/mi session, I get a segmentation fault:

    [dodji@adjoa test]$ gdb --interpreter=mi2 ./test
    ~"GNU gdb (GDB) Fedora (7.1-34.fc13)\n"
    ~"Copyright (C) 2010 Free Software Foundation, Inc.\n"
    ~"License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>\n"
    ~"This is free software: you are free to change and redistribute it.\n"
    ~"There is NO WARRANTY, to the extent permitted by law.  Type \"show
copying\"\n"
    ~"and \"show warranty\" for details.\n"
    ~"This GDB was configured as \"x86_64-redhat-linux-gnu\".\n"
    ~"For bug reporting instructions, please see:\n"
    ~"<http://www.gnu.org/software/gdb/bugs/>...\n"
    ~"\nwarning: "
    ~"Current output protocol does not support redirection\n"
    ~"Reading symbols from /home/dodji/test/test..."
    ~"done.\n"
    (gdb) 
    b main
    ~"b main\n"
    ~"Breakpoint 1 at 0x4007af: file test.cc, line 19.\n"
    ^done
    (gdb) 
    run
    ~"run\n"
    ~"Starting program: /home/dodji/test/test \n"
    =thread-group-created,id="18627"
    =thread-created,id="1",group-id="18627"
    ^running
    *running,thread-id="all"
    (gdb) 
   
=library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0"
   
=library-loaded,id="/usr/lib64/libstdc++.so.6",target-name="/usr/lib64/libstdc++.so.6",host-name="/usr/lib64/libstdc++.so.6",symbols-loaded="0"
   
=library-loaded,id="/lib64/libm.so.6",target-name="/lib64/libm.so.6",host-name="/lib64/libm.so.6",symbols-loaded="0"
   
=library-loaded,id="/lib64/libgcc_s.so.1",target-name="/lib64/libgcc_s.so.1",host-name="/lib64/libgcc_s.so.1",symbols-loaded="0"
   
=library-loaded,id="/lib64/libc.so.6",target-name="/lib64/libc.so.6",host-name="/lib64/libc.so.6",symbols-loaded="0"
    ~"\n"
    ~"Breakpoint 1, main () at test.cc:19\n"
    ~"19\t    person p (\"Toto\");\n"
   
*stopped,frame={addr="0x00000000004007af",func="main",args=[],file="test.cc",fullname="/home/dodji/test/test.cc",line="19"},thread-id="1",stopped-threads="all",core="2"
    (gdb) 
    -enable-pretty-printing
    ^done
    (gdb) 
    n
    ~"n\n"
    ^running
    *running,thread-id="1"
    (gdb) 
    ~"20\t    return 0;\n"
   
*stopped,frame={addr="0x0000000000400850",func="main",args=[],file="test.cc",fullname="/home/dodji/test/test.cc",line="20"},thread-id="1",stopped-threads="all",core="2"
    (gdb) 
    -var-create - * p
   
^done,name="var1",numchild="1",value="{...}",type="person",thread-id="1",has_more="0"
    (gdb) 
    -var-list-children --all-values var1
   
^done,numchild="1",children=[child={name="var1.private",exp="private",numchild="1",value="",thread-id="1"}],has_more="0"
    (gdb) 
    -var-list-children --all-values var1.private
   
^done,numchild="1",children=[child={name="var1.private.m_name",exp="m_name",numchild="0",value="\"Toto\"",type="std::string",thread-id="1",displayhint="string",dynamic="1"}],has_more="0"
    (gdb) 
    -var-list-children --all-values var1.private.m_name
    ^done,numchild="0",displayhint="string",has_more="0"
    (gdb) 
    -var-set-visualizer var1 None
    ^done
    (gdb) 
    -var-set-visualizer var1.private None
    ^error,msg="Variable object not found"
    (gdb) 
    -var-list-children --all-values var1
   
^done,numchild="1",children=[child={name="var1.private",exp="private",numchild="1",value="",thread-id="1"}],has_more="0"
    (gdb) 
    -var-set-visualizer var1.private None
    ^done
    (gdb) 
    -var-list-children --all-values var1.private
   
^done,numchild="1",children=[child={name="var1.private.m_name",exp="m_name",numchild="0",value="\"Toto\"",type="std::string",thread-id="1",displayhint="string",dynamic="1"}],has_more="0"
    (gdb) 
    -var-set-visualizer var1.private.m_name None
    ^done
    (gdb) 
    -var-list-children --all-values var1.private.m_name
   
^done,numchild="2",children=[child={name="var1.private.m_name.public",exp="public",numchild="1",value="",thread-id="1"},child={name="var1.private.m_name.private",exp="private",numchild="1",value="",thread-id="1"}],has_more="0"
    (gdb) 
    -var-list-children --all-values var1.private.m_name.public
   
^done,numchild="1",children=[child={name="var1.private.m_name.public.npos",exp="npos",numchild="0",value="",type="const
size_t",thread-id="1"}],has_more="0"
    (gdb) 
    -var-set-visualizer var1.private gdb.default_visualizer

    ^
    |
     --- segmentation fault when I hit enter after this command.


[dodji@adjoa test]$ gdb --version
GNU gdb (GDB) Fedora (7.1-34.fc13)
[...]
This GDB was configured as "x86_64-redhat-linux-gnu"

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the Gdb-prs mailing list