我用
编译了两个gcc -Wall -gdwarf-2 -g3 -g ws.c socklib.c web-time.c varlib.c -o ws
和
gcc -Wall -gdwarf-2 -g3 ws.c socklib.c web-time.c varlib.c -o ws
并且程序不会在我设置的断点处停止。
./ws
gdb>b splitline
gdb>b 1019
gdb>b 1020
断点已成功安装。第1019行是while语句。下面的打印消息确实执行。
char ** splitline(char *line, int*has_query)
{
//char *newstr();
logg("In splitline\n");
char **args;
int spots = 0; /* spots in table */
int bufspace = 0; /* bytes in table */
int argnum = 0; /* slots used */
char *cp = line; /* pos in string */
char *start;
int len;
if (line == NULL) /* handle special case */
return NULL;
args = emalloc(BUFSIZ); /* initialize array */
bufspace = BUFSIZ;
spots = BUFSIZ / sizeof(char *);
int query_reached = 0; //Flag to specify that the first '?' was reached
while (*cp != '\0') {
logg("*cp=");
fprintf(stderr,"%c",*cp);
...