#include #include #include "hotcameramodule.h" #ifndef WIN32 #include #include #include #include static void print_memory_base(void) { char strbuf[512]; pid_t pid = getpid(); FILE *pf; sprintf(strbuf, "/proc/%d/maps", pid); pf = fopen(strbuf, "r"); if(NULL == pf) return; while(fgets(strbuf, sizeof(strbuf), pf) != NULL) { printf("%s", strbuf); } fclose(pf); } static void print_stack_trace(void) { char strbuf[256], *pstr; void *array[64]; size_t size, i; char **strings; size = backtrace(array, 64); strings = backtrace_symbols(array, size); //printf ("Obtained %zd stack frames.\n", size); pstr = strbuf; for(i=1; i<=size; i++) { sprintf(pstr, "%08X:", (int)array[i]); pstr += strlen(pstr); if(0 == (i%8)) { printf("%s\n", strbuf); pstr = strbuf; } } if(pstr != strbuf) { printf("%s\n", strbuf); } for(i=0; i