Can’t trigger breakpoints on macosx maverick

Sysprogs forums Forums VisualGDB Can’t trigger breakpoints on macosx maverick

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #750
    Tristan Rybak
    Participant

    Hello,
    Just purchased the ultimate edition. I am really impressed how it flawlessly integrates with visual studio :).
    I am trying to compile a c++ hello world project on mac mini with maverick 10.9.2.
    I updated to the latest xcode, installed command line tools (by trying to execute gcc from the terminal).
    the latest tools use lldb instead of gdb so I had to compile and install gdb 7.7 from sources using this link:
    http://panks.me/blog/2013/11/install-gdb-on-os-x-mavericks-from-source/
    I am able to compile the hello world project using remote llvm and I am able to run it from
    visual studio remotely on macosx. I had to check “run debugger as root with sudo” to make it work,
    The only problem is breakpoints set in visual studio don’t work, program just executes to the end. (I tried using gdb from the terminal on mac and the breakpoints work there).
    When app starts I get this warning:
    &”warning: GDB: Failed to set controlling terminal: Operation not permittedn”
    then the output from the app
    Hello, World!
    and it quits (I tried to press F11 or set breakpoint manually).

    The log from gdb sesson below.
    Please help.
    Tristan

    /usr/local/bin/gdb –interpreter mi –args “/tmp/VisualGDB/d/Worek/LinuxProject1/TestOSX/Debug/TestOSX”
    =thread-group-added,id=”i1″
    -list-features
    -list-features
    ~”GNU gdb (GDB) 7.7n”
    ~”Copyright (C) 2014 Free Software Foundation, Inc.n”
    ~”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”
    ~”This GDB was configured as “x86_64-apple-darwin13.1.0”.nType “show configuration” for configuration details.”
    ~”nFor bug reporting instructions, please see:n”
    ~”<http://www.gnu.org/software/gdb/bugs/>.n”
    ~”Find the GDB manual and other documentation resources online at:n<http://www.gnu.org/software/gdb/documentation/>.n”
    ~”For help, type “help”.n”
    ~”Type “apropos word” to search for commands related to “word”…n”
    ~”Reading symbols from /tmp/VisualGDB/d/Worek/LinuxProject1/TestOSX/Debug/TestOSX…”
    ~”done.n”
    ^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”]
    -gdb-set stop-on-solib-events 1
    ^done
    -data-list-register-names
    ^done,register-names=[“rax”,”rbx”,”rcx”,”rdx”,”rsi”,”rdi”,”rbp”,”rsp”,”r8″,”r9″,”r10″,”r11″,”r12″,”r13″,”r14″,”r15″,”rip”,”eflags”,”cs”,”ss”,”ds”,”es”,”fs”,”gs”,”st0″,”st1″,”st2″,”st3″,”st4″,”st5″,”st6″,”st7″,”fctrl”,”fstat”,”ftag”,”fiseg”,”fioff”,”foseg”,”fooff”,”fop”,”xmm0″,”xmm1″,”xmm2″,”xmm3″,”xmm4″,”xmm5″,”xmm6″,”xmm7″,”xmm8″,”xmm9″,”xmm10″,”xmm11″,”xmm12″,”xmm13″,”xmm14″,”xmm15″,”mxcsr”,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,”al”,”bl”,”cl”,”dl”,”sil”,”dil”,”bpl”,”spl”,”r8l”,”r9l”,”r10l”,”r11l”,”r12l”,”r13l”,”r14l”,”r15l”,”ah”,”bh”,”ch”,”dh”,”ax”,”bx”,”cx”,”dx”,”si”,”di”,”bp”,””,”r8w”,”r9w”,”r10w”,”r11w”,”r12w”,”r13w”,”r14w”,”r15w”,”eax”,”ebx”,”ecx”,”edx”,”esi”,”edi”,”ebp”,”esp”,”r8d”,”r9d”,”r10d”,”r11d”,”r12d”,”r13d”,”r14d”,”r15d”]
    -gdb-set disassembly-flavor intel
    ^done
    -gdb-set print demangle off
    ^done
    -gdb-version
    ~”GNU gdb (GDB) 7.7n”
    ~”Copyright (C) 2014 Free Software Foundation, Inc.n”
    ~”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”
    ~”This GDB was configured as “x86_64-apple-darwin13.1.0”.nType “show configuration” for configuration details.”
    ~”nFor bug reporting instructions, please see:n”
    ~”<http://www.gnu.org/software/gdb/bugs/>.n”
    ~”Find the GDB manual and other documentation resources online at:n<http://www.gnu.org/software/gdb/documentation/>.n”
    ~”For help, type “help”.n”
    ~”Type “apropos word” to search for commands related to “word”.n”
    ^done
    -break-insert -f main
    ^done,bkpt={number=”1″,type=”breakpoint”,disp=”keep”,enabled=”y”,addr=”0x0000000100000fdf”,func=”main(int, char**)”,file=”TestOSX.cpp”,fullname=”/private/tmp/VisualGDB/d/Worek/LinuxProject1/TestOSX/TestOSX.cpp”,line=”7″,thread-groups=[“i1″],times=”0″,original-location=”main”}
    -inferior-tty-set /dev/ttys003
    ^done
    info target
    &”info targetn”
    ~”Symbols from “/private/tmp/VisualGDB/d/Worek/LinuxProject1/TestOSX/Debug/TestOSX”.n”
    ~”Local exec file:n”
    ~”t`/private/tmp/VisualGDB/d/Worek/LinuxProject1/TestOSX/Debug/TestOSX’, file type mach-o-x86-64.n”
    ~”tEntry point: 0x100000fb0n”
    ~”t0x0000000100000fb0 – 0x0000000100001cde is .textn”
    ~”t0x0000000100001cde – 0x0000000100001d4a is __TEXT.__stubsn”
    ~”t0x0000000100001d4c – 0x0000000100001e06 is __TEXT.__stub_helpern”
    ~”t0x0000000100001e08 – 0x0000000100001f38 is __TEXT.__gcc_except_tabn”
    ~”t0x0000000100001f38 – 0x0000000100001f47 is .cstringn”
    ~”t0x0000000100001f47 – 0x0000000100001fbf is __TEXT.__unwind_infon”
    ~”t0x0000000100001fc0 – 0x0000000100001ff8 is .eh_framen”
    ~”t0x0000000100002000 – 0x0000000100002010 is __DATA.__nl_symbol_ptrn”
    ~”t0x0000000100002010 – 0x0000000100002030 is __DATA.__gotn”
    ~”t0x0000000100002030 – 0x00000001000020c0 is __DATA.__la_symbol_ptrn”
    ^done
    -break-insert -f /tmp/VisualGDB/d/Worek/LinuxProject1/TestOSX/TestOSX.cpp:7
    ^done,bkpt={number=”2″,type=”breakpoint”,disp=”keep”,enabled=”y”,addr=”0x0000000100000fdf”,func=”main(int, char**)”,file=”TestOSX.cpp”,fullname=”/private/tmp/VisualGDB/d/Worek/LinuxProject1/TestOSX/TestOSX.cpp”,line=”7″,thread-groups=[“i1″],times=”0″,original-location=”/tmp/VisualGDB/d/Worek/LinuxProject1/TestOSX/TestOSX.cpp:7”}
    -break-info 2
    ^done,BreakpointTable={nr_rows=”1″,nr_cols=”6″,hdr=[{width=”7″,alignment=”-1″,col_name=”number”,colhdr=”Num”},{width=”14″,alignment=”-1″,col_name=”type”,colhdr=”Type”},{width=”4″,alignment=”-1″,col_name=”disp”,colhdr=”Disp”},{width=”3″,alignment=”-1″,col_name=”enabled”,colhdr=”Enb”},{width=”18″,alignment=”-1″,col_name=”addr”,colhdr=”Address”},{width=”40″,alignment=”2″,col_name=”what”,colhdr=”What”}],body=[bkpt={number=”2″,type=”breakpoint”,disp=”keep”,enabled=”y”,addr=”0x0000000100000fdf”,func=”main(int, char**)”,file=”TestOSX.cpp”,fullname=”/private/tmp/VisualGDB/d/Worek/LinuxProject1/TestOSX/TestOSX.cpp”,line=”7″,thread-groups=[“i1″],times=”0″,original-location=”/tmp/VisualGDB/d/Worek/LinuxProject1/TestOSX/TestOSX.cpp:7”}]}
    -break-after 2 0
    ^done
    info symbol 0x100000fdf
    &”info symbol 0x100000fdfn”
    ~”main + 47 in section .text of /private/tmp/VisualGDB/d/Worek/LinuxProject1/TestOSX/Debug/TestOSXn”
    ^done
    info line *0x100000fdf
    &”info line *0x100000fdfn”
    ~”Line 7 of “TestOSX.cpp” starts at address 0x100000fdf and ends at 0x10000100b .n”
    ^done
    -file-list-exec-source-files
    ^done,files=[{file=”TestOSX.cpp”,fullname=”/private/tmp/VisualGDB/d/Worek/LinuxProject1/TestOSX/TestOSX.cpp”},{file=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/cstddef”,fullname=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/cstddef”},{file=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__functional_base”,fullname=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/__functional_base”},{file=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/locale”,fullname=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/locale”},{file=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/iterator”,fullname=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/iterator”},{file=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/ostream”,fullname=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/ostream”},{file=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/streambuf”,fullname=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/streambuf”},{file=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/mutex”,fullname=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/mutex”},{file=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits”,fullname=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/type_traits”},{file=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory”,fullname=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/memory”},{file=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__locale”,fullname=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/__locale”},{file=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/string”,fullname=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/string”},{file=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/ios”,fullname=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/ios”},{file=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__config”,fullname=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/__config”},{file=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/cstddef”,fullname=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/cstddef”},{file=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__functional_base”,fullname=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/__functional_base”},{file=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/locale”,fullname=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/locale”},{file=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/iterator”,fullname=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/iterator”},{file=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/ostream”,fullname=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/ostream”},{file=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/streambuf”,fullname=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/streambuf”},{file=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory”,fullname=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/memory”},{file=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__locale”,fullname=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/__locale”},{file=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/string”,fullname=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/string”},{file=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/ios”,fullname=”/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/ios”}]
    -exec-run
    =thread-group-started,id=”i1″,pid=”32848″
    =thread-created,id=”1″,group-id=”i1″
    ^running
    *running,thread-id=”all”
    =breakpoint-modified,bkpt={number=”1″,type=”breakpoint”,disp=”keep”,enabled=”y”,addr=”0x0000000100000fdf”,func=”main(int, char**)”,file=”TestOSX.cpp”,fullname=”/private/tmp/VisualGDB/d/Worek/LinuxProject1/TestOSX/TestOSX.cpp”,line=”7″,thread-groups=[“i1″],times=”1″,original-location=”main”}
    =breakpoint-modified,bkpt={number=”2″,type=”breakpoint”,disp=”keep”,enabled=”y”,addr=”0x0000000100000fdf”,func=”main(int, char**)”,file=”TestOSX.cpp”,fullname=”/private/tmp/VisualGDB/d/Worek/LinuxProject1/TestOSX/TestOSX.cpp”,line=”7″,thread-groups=[“i1″],times=”1″,original-location=”/tmp/VisualGDB/d/Worek/LinuxProject1/TestOSX/TestOSX.cpp:7”}
    *stopped,reason=”breakpoint-hit”,disp=”keep”,bkptno=”1″,frame={addr=”0x0000000100000fdf”,func=”main”,args=[{name=”argc”,value=”1″},{name=”argv”,value=”0x7fff5fbffc08″}],file=”TestOSX.cpp”,fullname=”/private/tmp/VisualGDB/d/Worek/LinuxProject1/TestOSX/TestOSX.cpp”,line=”7″},thread-id=”1″,stopped-threads=”all”
    -exec-continue
    ^running
    *running,thread-id=”1″
    =thread-exited,id=”1″,group-id=”i1″
    =thread-group-exited,id=”i1″,exit-code=”0″
    *stopped,reason=”exited-normally”
    kill
    &”killn”
    &”The program is not being run.n”
    ^error,msg=”The program is not being run.”
    ^error,msg=”The program is not being run.”
    -gdb-exit
    ^exit

    #2981
    support
    Keymaster

    Hi,

    This looks very strange. Could you please start GDB manually and run the following commands:

    b main
    run

    Will the breakpoint be hit? If yes, please run GDB in MI mode (gdb –interpreter mi ) and run the following commands:

    -break-insert main
    -exec-run

    Will this break in main()? In either case please provide us with the relevant GDB logs so that we could diagnose the problem further.

    BTW, are you building a 32-bit version of the app or a 64-bit version? You may need to specify ‘-arch xxx’ in GDB command-line arguments to select the bitness manually.

    #2980
    Tristan Rybak
    Participant

    Hi,
    Just tried again and breakpoints in VS started to work… I have no idea why. Maybe macmini reboot helped.
    I did the tests you requested, so posting them here in case breakpoints stop working :).
    Thanks for the great tool!
    Regards,
    Tristan

    
    macmini:Debug rybak$ file TestOSX
    TestOSX: Mach-O 64-bit executable x86_64
    
    macmini:Debug rybak$ sudo gdb TestOSX
    GNU gdb (GDB) 7.7
    Copyright (C) 2014 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later 
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law. Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "x86_64-apple-darwin13.1.0".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    .
    Find the GDB manual and other documentation resources online at:
    .
    For help, type "help".
    Type "apropos word" to search for commands related to "word"...
    Reading symbols from TestOSX...done.
    (gdb) b main
    Breakpoint 1 at 0x100000fdf: file TestOSX.cpp, line 7.
    (gdb) r
    Starting program: /private/tmp/VisualGDB/d/Worek/LinuxProject1/TestOSX/Debug/TestOSX

    Breakpoint 1, main (argc=1, argv=0x7fff5fbffcd8) at TestOSX.cpp:7
    7 char sz[] = "Hello, World!n"; //Hover mouse over "sz" while debugging to see its contents
    (gdb) c
    Continuing.
    Hello, World!

    [Inferior 1 (process 329) exited normally]
    (gdb) q
    
    macmini:Debug rybak$ sudo gdb --interpreter mi TestOSX
    =thread-group-added,id="i1"
    ~"GNU gdb (GDB) 7.7n"
    ~"Copyright (C) 2014 Free Software Foundation, Inc.n"
    ~"License GPLv3+: GNU GPL version 3 or later 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"
    ~"This GDB was configured as "x86_64-apple-darwin13.1.0".nType "show configuration" for configuration details."
    ~"nFor bug reporting instructions, please see:n"
    ~".n"
    ~"Find the GDB manual and other documentation resources online at:n.n"
    ~"For help, type "help".n"
    ~"Type "apropos word" to search for commands related to "word"...n"
    ~"Reading symbols from TestOSX..."
    ~"done.n"
    (gdb)
    -break-insert main
    ^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000100000fdf",func="main(int, char**)",file="TestOSX.cpp",fullname="/private/tmp/VisualGDB/d/Worek/LinuxProject1/TestOSX/TestOSX.cpp",line="7",thread-groups=["i1"],times="0",original-location="main"}
    (gdb)
    -exec-run
    =thread-group-started,id="i1",pid="332"
    =thread-created,id="1",group-id="i1"
    ^running
    *running,thread-id="all"
    (gdb)
    =breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000100000fdf",func="main(int, char**)",file="TestOSX.cpp",fullname="/private/tmp/VisualGDB/d/Worek/LinuxProject1/TestOSX/TestOSX.cpp",line="7",thread-groups=["i1"],times="1",original-location="main"}
    *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={addr="0x0000000100000fdf",func="main",args=[{name="argc",value="1"},{name="argv",value="0x7fff5fbffcc8"}],file="TestOSX.cpp",fullname="/private/tmp/VisualGDB/d/Worek/LinuxProject1/TestOSX/TestOSX.cpp",line="7"},thread-id="1",stopped-threads="all"
    (gdb)
    q
    &"qn"
    =thread-exited,id="1",group-id="i1"
    =thread-group-exited,id="i1"
    macmini:Debug rybak$
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.