Web lists-archives.com

Help! How to debug glib source code via gdb




Hi everyone:
   I am curious about how glib works, so I want to debug its source code with gdb.
   I followd these steps:

1) ./configure --enable-debug=yes
2) make
3) sudo make install

4)I created test.c in which I called glib API g_hash_table_new function
#include <glib.h>
int main(int argc, char** argv) {
 GHashTable* hash = g_hash_table_new(g_str_hash, g_str_equal);
 g_hash_table_insert(hash, "Virginia", "Richmond");
 g_hash_table_insert(hash, "Texas", "Austin");
 g_hash_table_insert(hash, "Ohio", "Columbus");
 g_printf("There are %d keys in the hash\n", g_hash_table_size(hash));
 g_printf("The capital of Texas is %s\n", g_hash_table_lookup(hash, "Texas"));
 gboolean found = g_hash_table_remove(hash, "Virginia");
 g_printf("The value 'Virginia' was %sfound and removed\n", found ? "" : "not ");
 g_hash_table_destroy(hash);
 return 0;
}
5)gcc test.c `pkg-config --cflags --libs glib-2.0` -g -o test

6) I used gdb to debug the output test program
gdb test

7)use gdb's directiory command to specify the source code location
directory ~/Downloads/glib-2.46.2

But when I use gdb to debug test step by step

I found that when I use gdb's step command, gdb cannot go inside the source code files which include glib APIs, such as g_hash_table_new and g_hash_table_insert

What should I do? Where am I wrong






_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list