添加debug,每个线程都维护一个jump帧
This commit is contained in:
@@ -8,12 +8,15 @@
|
||||
#include "stdarg.h"
|
||||
#include "exception.h"
|
||||
#include "mystdlib.h"
|
||||
#include "debug.h"
|
||||
#include "mythread.h"
|
||||
|
||||
|
||||
|
||||
exception_def *exception(){
|
||||
static exception_def frame={0};
|
||||
return &frame;
|
||||
exception_def *frame;
|
||||
frame=&myth_self()->except;
|
||||
return frame;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,31 +57,30 @@ void func_two();
|
||||
|
||||
int test_add(int a, int b)
|
||||
{
|
||||
printf("setjmp test.\n");
|
||||
DBG_INFO("setjmp test.\n");
|
||||
try_{
|
||||
printf("first enter setjmp.\n");
|
||||
DBG_INFO("first enter setjmp.\n");
|
||||
|
||||
try_{
|
||||
printf("try in try.\n");
|
||||
DBG_INFO("try in try.\n");
|
||||
func_two();
|
||||
// throw_("throw two err.");
|
||||
}catch_{
|
||||
printf("file=%s,line=%d,err=%s.\n",file_(),line_(),err_());
|
||||
DBG_WARN("file=%s,line=%d,err=%s.\n",file_(),line_(),err_());
|
||||
}
|
||||
throw_("throw a err.");
|
||||
|
||||
}catch_{
|
||||
printf("sssss\n");
|
||||
printf("file=%s,line=%d,err=%s.\n",file_(),line_(),err_());
|
||||
DBG_WARN("file=%s,line=%d,err=%s.\n",file_(),line_(),err_());
|
||||
try_{
|
||||
printf("try in catch.\n");
|
||||
DBG_INFO("try in catch.\n");
|
||||
func_two();
|
||||
// throw_("throw two err.");
|
||||
}catch_{
|
||||
printf("file=%s,line=%d,err=%s.\n",file_(),line_(),err_());
|
||||
DBG_WARN("file=%s,line=%d,err=%s.\n",file_(),line_(),err_());
|
||||
}
|
||||
}
|
||||
printf("setjmp end.\n");
|
||||
DBG_INFO("setjmp end.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -87,7 +89,7 @@ int test_add(int a, int b)
|
||||
|
||||
|
||||
void func_two(){
|
||||
printf("in func:%s\n",__func__);
|
||||
DBG_INFO("in func:%s\n",__func__);
|
||||
void *p=mem_malloc(512);
|
||||
throw_("throw in func_two. in func:%s",__func__);
|
||||
mem_free(p);
|
||||
|
Reference in New Issue
Block a user