Rev 11 | Rev 18 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 11 | Rev 14 | ||
---|---|---|---|
Line 31... | Line 31... | ||
31 | static void* stack_traces[MAX_STACK_FRAMES]; |
31 | static void* stack_traces[MAX_STACK_FRAMES]; |
32 | static char name_buf[4096]; |
32 | static char name_buf[4096]; |
33 | 33 | ||
34 | // Resolve symbol name and source location given the path to the executable and an address |
34 | // Resolve symbol name and source location given the path to the executable and an address |
35 | int addr2line(char const* const program_name, intptr_t slide, void const* const addr) { |
35 | int addr2line(char const* const program_name, intptr_t slide, void const* const addr) { |
36 |
|
36 | static char addr2line_cmd[MAXPATHLEN]; // Pierre-Marie Baty -- use the heap instead |
37 | 37 | ||
38 | /* have addr2line map the address to the related line in the code */ |
38 | /* have addr2line map the address to the related line in the code */ |
39 | sprintf(addr2line_cmd, "atos -s %" PRIxPTR " -o \"%s\" %p", slide, program_name, addr); |
39 | sprintf(addr2line_cmd, "atos -s %" PRIxPTR " -o \"%s\" %p", slide, program_name, addr); // Pierre-Marie Baty -- enclosed program_name within quotes to support pathnames with spaces |
40 | 40 | ||
41 | // printf("addr2line command: %s\n", addr2line_cmd); |
41 | // printf("addr2line command: %s\n", addr2line_cmd); |
42 | 42 | ||
43 | fprintf(stderr, "%d: ", stack_nbr++); |
43 | fprintf(stderr, "%d: ", stack_nbr++); |
44 | return system(addr2line_cmd); |
44 | return system(addr2line_cmd); |