我想用gdb来调试核心转储。它与x86机器(ubuntu 12.04)工作正常但是我使用arm编译器为arm编译了相同的源代码并尝试获取“info thred”。但是在这种情况下x86机器(ubuntu 12.04),它给出了正确的结果但是在arm的情况下它没有给出线程内存地址。我已经按照以下步骤。
gdb>信息主题
其中“thread”是二进制文件名,“core”是核心转储文件名。
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include<sys/types.h>
#include <sys/resource.h>
#include<string.h>
pthread_t thread;
struct rlimit rl;
void* thread3 (void* d)
{
int count3 = 0;
while(count3 < 10){
printf("Thread 3: %d\n", count3++);
printf("Thread3: %ld\n",pthread_self());
}
return NULL;
}
void* thread2 (void* d)
{
int count2 = 0;
char *buff=NULL;
rl.rlim_cur = 10000000;
rl.rlim_max = RLIM_INFINITY;
setrlimit(RLIMIT_CORE, &rl);
while(count2 < 10){
printf("Thread 2: %d\n", count2++);
printf("Thread2: %ld\n",pthread_self());
}
strcpy(buff,"Creating SIGSEGV interrupt for the process");
return NULL;
}
int main (){
pthread_create (&thread, NULL, thread2, NULL);
pthread_create (&thread, NULL, thread3, NULL);
//Thread 1
int count1 = 0;
while(count1 < 10){
printf("Thread 1: %d\n", count1++);
}
pthread_join(thread,NULL);
return 0;
}