Results 1 to 2 of 2
I am trying to debug my code with gdb. However, the code seems to jump from one place and come back to where it supposed to be. I recompiled the ...
- 06-23-2010 #1Just Joined!
- Join Date
- Jan 2007
- Posts
- 26
strange behavior debugging with gdb.. need explanation
I am trying to debug my code with gdb. However, the code seems to jump from one place and come back to where it supposed to be. I recompiled the code to ensure that the source code match the exec. Below you can see that the line
is hit twice. The first time it goes into main (which is not what it should have) and other time when the code actually reach that line. It also happens in other part of the code.Code:1945 readConfig(config_file,&config);
Can someone suggest me what to do or what explanation of this behaviour?
Code:(gdb) b main Breakpoint 1 at 0x804a42f: file producer.src/producer.c, line 1907. (gdb) run Starting program: /root/workspace/nano/Release/producer [Thread debugging using libthread_db enabled] Breakpoint 1, main (argc=1, argv=0xbffff1a4) at producer.src/producer.c:1907 1907 { Missing separate debuginfos, use: debuginfo-install glibc-2.12-2.i686 libgcc-4.4.4-2.fc13.i686 (gdb) n 1945 readConfig(config_file,&config); (gdb) n 1909 int Code = 0; (gdb) n 1937 usage(argc,argv); (gdb) n 1940 printf("\nproducer (v %s) \n\n", version_string); (gdb) n producer (v 4.01) 1942 printf("test"); (gdb) n 1945 readConfig(config_file,&config); (gdb)
- 06-26-2010 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
I don't know what specificially is causing this, although a pointer error in your code can mung memory such that this can happen, in my experience. Also, note the error about missing debuginfos and the need to install the debuginfo-install package. You need to do that before you run gdb. It may (or may not) allow you to see better what is happening.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote