Missing project properties (FreeBSD, VS2015)

Sysprogs forums Forums VisualGDB Missing project properties (FreeBSD, VS2015)

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #11078
    rasmusneckelmann
    Participant

    Hello,

    I have a couple of problems that I hope someone can help me with.

    First to describe my setup: Running a remote FreeBSD server (11.0-RELEASE-p2) and my development platform is VS 2015 with VisualGDB 5.2. My project is configured to use GNU make, GCC, and a custom GDB executable (gdb7121). Everything else is “Linux Project” defaults.

    My original problem was that GDB always hung after stopping debugging. That is, I click the “Stop Debugging” button and it seems to work from VS’s point of view, but looking at the server I can see that the GDB process (and the debugged application) are still running. Next time I tell VS to “Run”, it will start another GDB process with the old one still running. This breaks because only one instance of my application can run at a time.

    My workaround for this was adding a “Custom debug step” that instructed VisualGDB to execute a “kill -9 ´pgrep gdb7121´” when debugging was stopped. It wasn’t pretty, but it worked.

    Now, the problem is that the “Custom debug step” project properties have disappeared from the project, along with a bunch of other properties. I no longer have the ability to kill GDB when debugging is stopped.

    Any ideas what could be happening?

    #11079
    support
    Keymaster

    Hi,

    The custom post-debug steps are only supported on the Custom edition of VisualGDB and higher (see the feature matrix). If you have purchased a lower edition, this feature would not be available.

    You can always upgrade your edition at https://sysprogs.com/splm/mykey.

    Another alternative would be to try understanding why gdb is not terminated properly. Please try enabling GDB logging via VisualGDB Project Properties and check the last gdb command that gets executed before GDB hangs.

    #11083
    rasmusneckelmann
    Participant

    Thanks for the explanation, I must have missed that when figuring out which type of licenses we should get.

    Below is my GDB log from when I stopped debugging. I don’t see anything that could be a problem (but sure, I don’t know much about GDB).

    Anyway, I’ve found that the problem is related to threads (using pthread). If I don’t create any threads, then everything work just fine. If I write a minimal program that creates a thread, then GDB is going to hang when I try to stop it. I can also reproduce this problem when I’m using GDB directly from the command line, so I’m not gonna blame VisualGDB.

    gdb7121 --interpreter mi --args "/tmp/VisualGDB/d/blue/code/servers/file_server_head/Debug/file_server_head" -worker_threads 1 -storage_path ~/data -unit_tests
    [ 0 ms] -gdb-version
    [ 0 ms] -gdb-version
    [ 0 ms] =thread-group-added,id="i1"
    [ 0 ms] ~"GNU gdb (GDB) 7.12.1 [GDB v7.12.1 for FreeBSD]\n"
    [ 0 ms] ~"Copyright (C) 2017 Free Software Foundation, Inc.\n"
    [ 0 ms] ~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law. Type \"show copying\"\nand \"show warranty\" for details.\n"
    [ 0 ms] ~"This GDB was configured as \"x86_64-portbld-freebsd11.0\".\nType \"show configuration\" for configuration details."
    [ 0 ms] ~"\nFor bug reporting instructions, please see:\n"
    [ 0 ms] ~"<http://www.gnu.org/software/gdb/bugs/>.\n"
    [ 0 ms] ~"Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/software/gdb/documentation/>.\n"
    [ 0 ms] ~"For help, type \"help\".\n"
    [ 0 ms] ~"Type \"apropos word\" to search for commands related to \"word\"...\n"
    [ 2 ms] ~"Reading symbols from /tmp/VisualGDB/d/blue/code/servers/file_server_head/Debug/file_server_head..."
    [ 9 ms] ~"done.\n"
    [ 10 ms] ~"GNU gdb (GDB) 7.12.1 [GDB v7.12.1 for FreeBSD]\n"
    [ 10 ms] ~"Copyright (C) 2017 Free Software Foundation, Inc.\n"
    [ 11 ms] ~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law. Type \"show copying\"\nand \"show warranty\" for details.\n"
    [ 11 ms] ~"This GDB was configured as \"x86_64-portbld-freebsd11.0\".\nType \"show configuration\" for configuration details."
    [ 11 ms] ~"\nFor bug reporting instructions, please see:\n"
    [ 11 ms] ~"<http://www.gnu.org/software/gdb/bugs/>.\n"
    [ 11 ms] ~"Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/software/gdb/documentation/>.\n"
    [ 11 ms] ~"For help, type \"help\".\n"
    [ 11 ms] ~"Type \"apropos word\" to search for commands related to \"word\".\n"
    [ 11 ms] ^done
    [ 11 ms] -list-features
    [ 11 ms] ^done,features=["frozen-varobjs","pending-breakpoints","thread-info","data-read-memory-bytes","breakpoint-notifications","ada-task-info","language-option","info-gdb-mi-command","undefined-command-error-code","exec-run-start-option","python"]
    [ 11 ms] -gdb-set disassembly-flavor intel
    [ 11 ms] ^done
    [ 11 ms] -gdb-set print demangle off
    [ 11 ms] ^done
    [ 11 ms] -break-insert -f main
    [ 12 ms] ^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000406c03",func="main(int, char**)",file="main.cpp",fullname="/tmp/VisualGDB/d/blue/code/servers/file_server_head/main.cpp",line="123",thread-groups=["i1"],times="0",original-location="main"}
    [ 884 ms] -inferior-tty-set /dev/pts/3
    [ 884 ms] ^done
    [ 892 ms] info target
    [ 893 ms] &"info target\n"
    [ 893 ms] ~"Symbols from \"/tmp/VisualGDB/d/blue/code/servers/file_server_head/Debug/file_server_head\".\n"
    [ 893 ms] ~"Local exec file:\n"
    [ 893 ms] ~"\t`/tmp/VisualGDB/d/blue/code/servers/file_server_head/Debug/file_server_head', file type elf64-x86-64-freebsd.\n"
    [ 893 ms] ~"\tEntry point: 0x401c40\n"
    [ 893 ms] ~"\t0x0000000000400200 - 0x0000000000400215 is .interp\n"
    [ 893 ms] ~"\t0x0000000000400218 - 0x0000000000400248 is .note.tag\n"
    [ 893 ms] ~"\t0x0000000000400248 - 0x0000000000400494 is .hash\n"
    [ 893 ms] ~"\t0x0000000000400498 - 0x0000000000400be8 is .dynsym\n"
    [ 893 ms] ~"\t0x0000000000400be8 - 0x0000000000400f65 is .dynstr\n"
    [ 893 ms] ~"\t0x0000000000400f66 - 0x0000000000401002 is .gnu.version\n"
    [ 893 ms] ~"\t0x0000000000401008 - 0x00000000004010c8 is .gnu.version_r\n"
    [ 893 ms] ~"\t0x00000000004010c8 - 0x0000000000401128 is .rela.dyn\n"
    [ 893 ms] ~"\t0x0000000000401128 - 0x00000000004017b8 is .rela.plt\n"
    [ 893 ms] ~"\t0x00000000004017b8 - 0x00000000004017cb is .init\n"
    [ 893 ms] ~"\t0x00000000004017d0 - 0x0000000000401c40 is .plt\n"
    [ 893 ms] ~"\t0x0000000000401c40 - 0x000000000040cec6 is .text\n"
    [ 893 ms] ~"\t0x000000000040cec8 - 0x000000000040ced6 is .fini\n"
    [ 893 ms] ~"\t0x000000000040cee0 - 0x000000000040e492 is .rodata\n"
    [ 893 ms] ~"\t0x000000000040e494 - 0x000000000040ec20 is .eh_frame_hdr\n"
    [ 893 ms] ~"\t0x000000000040ec20 - 0x0000000000410bc4 is .eh_frame\n"
    [ 893 ms] ~"\t0x0000000000410bc4 - 0x0000000000410dfd is .gcc_except_table\n"
    [ 893 ms] ~"\t0x0000000000611000 - 0x0000000000611010 is .ctors\n"
    [ 893 ms] ~"\t0x0000000000611010 - 0x0000000000611020 is .dtors\n"
    [ 893 ms] ~"\t0x0000000000611020 - 0x0000000000611028 is .jcr\n"
    [ 893 ms] ~"\t0x0000000000611040 - 0x0000000000611118 is .data.rel.ro\n"
    [ 893 ms] ~"\t0x0000000000611118 - 0x00000000006112f8 is .dynamic\n"
    [ 893 ms] ~"\t0x00000000006112f8 - 0x0000000000611540 is .got.plt\n"
    [ 893 ms] ~"\t0x0000000000611540 - 0x0000000000611548 is .data\n"
    [ 893 ms] ~"\t0x0000000000611550 - 0x0000000000611580 is .bss\n"
    [ 893 ms] ^done
    [ 900 ms] -exec-run
    [ 909 ms] =thread-group-started,id="i1",pid="83801"
    [ 909 ms] =thread-created,id="1",group-id="i1"
    [ 919 ms] =library-loaded,id="/libexec/ld-elf.so.1",target-name="/libexec/ld-elf.so.1",host-name="/libexec/ld-elf.so.1",symbols-loaded="0",thread-group="i1"
    [ 920 ms] ^running
    [ 920 ms] *running,thread-id="all"
    [ 923 ms] =library-loaded,id="/usr/local/lib/gcc49/libstdc++.so.6",target-name="/usr/local/lib/gcc49/libstdc++.so.6",host-name="/usr/local/lib/gcc49/libstdc++.so.6",symbols-loaded="0",thread-group="i1"
    [ 924 ms] =library-loaded,id="/lib/libm.so.5",target-name="/lib/libm.so.5",host-name="/lib/libm.so.5",symbols-loaded="0",thread-group="i1"
    [ 924 ms] =library-loaded,id="/lib/libgcc_s.so.1",target-name="/lib/libgcc_s.so.1",host-name="/lib/libgcc_s.so.1",symbols-loaded="0",thread-group="i1"
    [ 924 ms] =library-loaded,id="/lib/libthr.so.3",target-name="/lib/libthr.so.3",host-name="/lib/libthr.so.3",symbols-loaded="0",thread-group="i1"
    [ 924 ms] =library-loaded,id="/lib/libc.so.7",target-name="/lib/libc.so.7",host-name="/lib/libc.so.7",symbols-loaded="0",thread-group="i1"
    [ 1075 ms] =breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000406c03",func="main(int, char**)",file="main.cpp",fullname="/tmp/VisualGDB/d/blue/code/servers/file_server_head/main.cpp",line="123",thread-groups=["i1"],times="1",original-location="main"}
    [ 1075 ms] ~"\n"
    [ 1075 ms] ~"Breakpoint 1, main (argc=6, argv=0x7fffffffe958) at main.cpp:123\n"
    [ 1075 ms] ~"123\t\tcommand_line::get_instance()->init(argc, argv);\n"
    [ 1075 ms] *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={addr="0x0000000000406c03",func="main",args=[{name="argc",value="6"},{name="argv",value="0x7fffffffe958"}],file="main.cpp",fullname="/tmp/VisualGDB/d/blue/code/servers/file_server_head/main.cpp",line="123"},thread-id="1",stopped-threads="all"
    [ 1076 ms] info shared
    [ 1076 ms] &"info shared\n"
    [ 1077 ms] ~"From To Syms Read Shared Object Library\n"
    [ 1077 ms] ~"0x00000008006135b0 0x0000000800629a19 Yes /libexec/ld-elf.so.1\n"
    [ 1077 ms] ~"0x000000080088c1a0 0x00000008008fc846 Yes /usr/local/lib/gcc49/libstdc++.so.6\n"
    [ 1077 ms] ~"0x0000000800b49d70 0x0000000800b63538 Yes /lib/libm.so.5\n"
    [ 1077 ms] ~"0x0000000800d721d0 0x0000000800d7b468 Yes /lib/libgcc_s.so.1\n"
    [ 1077 ms] ~"0x0000000800f85780 0x0000000800f949f8 Yes /lib/libthr.so.3\n"
    [ 1077 ms] ~"0x00000008011e0c20 0x00000008012fe868 Yes /lib/libc.so.7\n"
    [ 1077 ms] ^done
    [ 1080 ms] -break-delete 1
    [ 1080 ms] ^done
    [ 1080 ms] -exec-continue
    [ 1080 ms] ^running
    [ 1080 ms] *running,thread-id="all"
    [ 1151 ms] =thread-created,id="2",group-id="i1"
    [ 1152 ms] ~"[New LWP 100689 of process 83801]\n"
    [ 1152 ms] =thread-created,id="3",group-id="i1"
    [ 1152 ms] ~"[New LWP 100690 of process 83801]\n"
    [ 12853 ms] ~"\nThread "
    [ 12853 ms] ~"1 received signal SIGINT, Interrupt.\n"
    [ 12853 ms] ~"0x00000008012e698a in _kevent () from /lib/libc.so.7\n"
    [ 12853 ms] *stopped,reason="signal-received",signal-name="SIGINT",signal-meaning="Interrupt",frame={addr="0x00000008012e698a",func="_kevent",args=[],from="/lib/libc.so.7"},thread-id="1",stopped-threads="all"
    [ 13244 ms] -gdb-exit
    [ 13245 ms] ^exit

     

    #11085
    support
    Keymaster

    Hi,

    Thanks, the session does not look out of the ordinary indeed. One last advice would be to try setting Advanced GDB Settings -> Startup and Exit -> When the debug session is ending -> Explicitly kill the process. This should force gdb to explicitly terminate the target process when exiting.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.