I have been writing some C codes lately and found that both lldb and gdb are not working as expected. Perhaps I am doing something wrong? In the following, I am running a freshly installed FreeBSD 11.0-RELEASE on bhyve, but I have the same problem on my host machine as well.
Code:
%freebsd-version; uname -a
11.0-RELEASE-p7
FreeBSD fake.hostname.local 11.0-RELEASE-p2 FreeBSD 11.0-RELEASE-p2 #0: Mon Oct 24 06:55:27 UTC 2016 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
%cat hello.c
#include <stdio.h>
int main(){
printf("Hello, world!\n");
}
%cc -g hello.c
%lldb a.out
(lldb) target create "a.out"
Current executable set to 'a.out' (x86_64).
(lldb) breakpoint set --name main
Breakpoint 1: where = a.out`main + 18 at hello.c:4, address = 0x0000000000400752
(lldb) r
error: process launch failed: Child ptrace failed.
(lldb) quit
Quitting LLDB will kill one or more processes. Do you really want to proceed: [Y/n] y
%gdb a.out
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
(gdb) break main
Breakpoint 1 at 0x400752: file hello.c, line 4.
(gdb) run
Starting program: /usr/home/hongj37/a.out
Hello, world!
Program exited normally.
You can't do that without a process to debug.
(gdb) quit
Last edited by a moderator: