fix(os): add print trace func.
This commit is contained in:
parent
32e6557353
commit
42204611ba
|
@ -103,8 +103,10 @@ Dwarf_Debug tDbg;
|
||||||
static TdThreadOnce traceThreadInit = PTHREAD_ONCE_INIT;
|
static TdThreadOnce traceThreadInit = PTHREAD_ONCE_INIT;
|
||||||
|
|
||||||
void endTrace() {
|
void endTrace() {
|
||||||
|
if (traceThreadInit != PTHREAD_ONCE_INIT) {
|
||||||
delete_lookup_table(&lookup_table);
|
delete_lookup_table(&lookup_table);
|
||||||
dwarf_finish(tDbg);
|
dwarf_finish(tDbg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void startTrace() {
|
void startTrace() {
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -128,15 +130,15 @@ void startTrace() {
|
||||||
atexit(endTrace);
|
atexit(endTrace);
|
||||||
}
|
}
|
||||||
static void print_line(Dwarf_Debug dbg, Dwarf_Line line, Dwarf_Addr pc) {
|
static void print_line(Dwarf_Debug dbg, Dwarf_Line line, Dwarf_Addr pc) {
|
||||||
char *linesrc = "??";
|
char *linesrc = "??";
|
||||||
Dwarf_Unsigned lineno = 0;
|
Dwarf_Unsigned lineno = 0;
|
||||||
|
|
||||||
if (line) {
|
if (line) {
|
||||||
dwarf_linesrc(line, &linesrc, NULL);
|
dwarf_linesrc(line, &linesrc, NULL);
|
||||||
dwarf_lineno(line, &lineno, NULL);
|
dwarf_lineno(line, &lineno, NULL);
|
||||||
}
|
}
|
||||||
printf("%s:%" DW_PR_DUu "\n", linesrc, lineno);
|
printf("%s:%" DW_PR_DUu "\n", linesrc, lineno);
|
||||||
if (line) dwarf_dealloc(dbg, linesrc, DW_DLA_STRING);
|
if (line) dwarf_dealloc(dbg, linesrc, DW_DLA_STRING);
|
||||||
}
|
}
|
||||||
void taosPrintBackTrace() {
|
void taosPrintBackTrace() {
|
||||||
int size = 20;
|
int size = 20;
|
||||||
|
|
Loading…
Reference in New Issue