Skip to content

Instantly share code, notes, and snippets.

@polachok
Created May 19, 2017 12:21
Show Gist options
  • Save polachok/e8d042509954b67f678c701139e8e77b to your computer and use it in GitHub Desktop.
Save polachok/e8d042509954b67f678c701139e8e77b to your computer and use it in GitHub Desktop.
Go doesn't use libc
$ cat test.go
package main
import "os/user"
func main() {
_, _ = user.Current()
}
$ go build test.go
$ gdb ./test
GNU gdb (GDB) Fedora 7.12.1-48.fc25
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
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-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./test...done.
warning: File "/home/plhk/go/src/runtime/runtime-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
add-auto-load-safe-path /home/plhk/go/src/runtime/runtime-gdb.py
line to your configuration file "/home/plhk/.gdbinit".
To completely disable this security protection add
set auto-load safe-path /
line to your configuration file "/home/plhk/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual. E.g., run from the shell:
info "(gdb)Auto-loading safe path"
(gdb) b getpwuid_r
Breakpoint 1 at 0x487bb0
(gdb) run
Starting program: /home/plhk/test
Missing separate debuginfos, use: dnf debuginfo-install glibc-2.24-4.fc25.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7ffff77f2700 (LWP 17672)]
[New Thread 0x7ffff6ff1700 (LWP 17673)]
[New Thread 0x7ffff67f0700 (LWP 17674)]
[New Thread 0x7ffff5fef700 (LWP 17675)]
Thread 1 "test" hit Breakpoint 1, 0x00007ffff78beb40 in getpwuid_r@@GLIBC_2.2.5 () from /lib64/libc.so.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment