Created
January 24, 2019 11:11
-
-
Save wjt/6a60b49e4852e5053d76271c65829140 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| wjt@tensionsheet-redux:/tmp$ gdb ./foo | |
| GNU gdb (Endless 8.2-1bem1) 8.2 | |
| Copyright (C) 2018 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-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 ./foo...(no debugging symbols found)...done. | |
| (gdb) b write | |
| Function "write" not defined. | |
| Make breakpoint pending on future shared library load? (y or [n]) y | |
| Breakpoint 1 (write) pending. | |
| (gdb) run | |
| Starting program: /tmp/foo | |
| [Thread debugging using libthread_db enabled] | |
| Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". | |
| [New Thread 0x7ffff783e700 (LWP 18175)] | |
| Thread 1 "foo" hit Breakpoint 1, __GI___libc_write (fd=2, buf=0x555555556021, nbytes=24) at ../sysdeps/unix/sysv/linux/write.c:26 | |
| 26 ../sysdeps/unix/sysv/linux/write.c: No such file or directory. | |
| (gdb) bt | |
| #0 __GI___libc_write (fd=2, buf=0x555555556021, nbytes=24) at ../sysdeps/unix/sysv/linux/write.c:26 | |
| #1 0x00007ffff7b5060d in _IO_new_file_write (f=0x7ffff7c91680 <_IO_2_1_stderr_>, data=0x555555556021, n=24) at fileops.c:1183 | |
| #2 0x00007ffff7b4f9af in new_do_write (fp=fp@entry=0x7ffff7c91680 <_IO_2_1_stderr_>, data=data@entry=0x555555556021 "hello world from parent\n", to_do=to_do@entry=24) at libioP.h:839 | |
| #3 0x00007ffff7b50d3e in _IO_new_file_xsputn (n=24, data=<optimized out>, f=0x7ffff7c91680 <_IO_2_1_stderr_>) at fileops.c:1262 | |
| #4 _IO_new_file_xsputn (f=0x7ffff7c91680 <_IO_2_1_stderr_>, data=<optimized out>, n=24) at fileops.c:1204 | |
| #5 0x00007ffff7b45cd8 in __GI__IO_fwrite (buf=0x555555556021, size=1, count=24, fp=0x7ffff7c91680 <_IO_2_1_stderr_>) at libioP.h:839 | |
| #6 0x00005555555551cc in main () | |
| (gdb) cont | |
| Continuing. | |
| hello world from parent | |
| [Switching to Thread 0x7ffff783e700 (LWP 18175)] | |
| Thread 2 "foo" hit Breakpoint 1, __GI___libc_write (fd=2, buf=0x555555556004, nbytes=24) at ../sysdeps/unix/sysv/linux/write.c:26 | |
| 26 in ../sysdeps/unix/sysv/linux/write.c | |
| (gdb) bt | |
| #0 __GI___libc_write (fd=2, buf=0x555555556004, nbytes=24) at ../sysdeps/unix/sysv/linux/write.c:26 | |
| #1 0x00007ffff7b5060d in _IO_new_file_write (f=0x7ffff7c91680 <_IO_2_1_stderr_>, data=0x555555556004, n=24) at fileops.c:1183 | |
| #2 0x00007ffff7b4f9af in new_do_write (fp=fp@entry=0x7ffff7c91680 <_IO_2_1_stderr_>, data=data@entry=0x555555556004 "hello world from thread\n", to_do=to_do@entry=24) at libioP.h:839 | |
| #3 0x00007ffff7b50d3e in _IO_new_file_xsputn (n=24, data=<optimized out>, f=0x7ffff7c91680 <_IO_2_1_stderr_>) at fileops.c:1262 | |
| #4 _IO_new_file_xsputn (f=0x7ffff7c91680 <_IO_2_1_stderr_>, data=<optimized out>, n=24) at fileops.c:1204 | |
| #5 0x00007ffff7b45cd8 in __GI__IO_fwrite (buf=0x555555556004, size=1, count=24, fp=0x7ffff7c91680 <_IO_2_1_stderr_>) at libioP.h:839 | |
| #6 0x0000555555555181 in thread_func () | |
| #7 0x00007ffff7d09d75 in g_thread_proxy (data=0x55555555f400) at ../../../../glib/gthread.c:784 | |
| #8 0x00007ffff7848fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486 | |
| #9 0x00007ffff7bce88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 | |
| (gdb) quit | |
| A debugging session is active. | |
| Inferior 1 [process 18171] will be killed. | |
| Quit anyway? (y or n) y | |
| wjt@tensionsheet-redux:/tmp$ cat foo.c | |
| #include <glib.h> | |
| #include <stdio.h> | |
| static gpointer | |
| thread_func (gpointer data) | |
| { | |
| fprintf (stderr, "hello world from thread\n"); | |
| return NULL; | |
| } | |
| int main(void) | |
| { | |
| GThread *thread = g_thread_new ("foo", thread_func, NULL); | |
| fprintf (stderr, "hello world from parent\n"); | |
| g_thread_join (thread); | |
| return 0; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment