首页 > 代码库 > GDB调试
GDB调试
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
typedef struct buf{
char* datas[5];
int n;
}buf_t;
buf_t buffer;
void* thr_func(void* arg){
int j= 1;
int index;
printf("index=%d\n", index);
printf("pdata=http://www.mamicode.com/%p/n", buffer.datas[index], index);
return (void*)0;
}
int main()
{
pthread_t pid;
pthread_create(&pid, NULL, thr_func, NULL);
if(pid !=0) {
pthread_join(pid,NULL);
}
return 0;
}
1 .SUFFIXES: .c .o
2
3 CC=g++
6 CBSJ1=test.cpp
7
8 OBJS1=$(CBSJ1:.c=.o)
11
12
13 EXXX1=forwardTest
14
15
16
17 start:$(OBJS)
18 $(CC) -o $(EXXX1) $(CBSJ1) -O0 -g -gdwarf-2 -pg -std=c++11 -lpthread
19 .c.o:
20 $(CC) -Wall -g -o $@ -c $<
21 clean:
22 rm -f $(EXXX)
gdb forwardTest core.52424
f 0
i locals
GDB调试