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 58... | Line 58... | ||
| 58 | return dethrace_dl_data.start; |
58 | return dethrace_dl_data.start; |
| 59 | } |
59 | } |
| 60 | 60 | ||
| 61 | // Resolve symbol name and source location given the path to the executable and an address |
61 | // Resolve symbol name and source location given the path to the executable and an address |
| 62 | int addr2line(char const* const program_name, void const* const addr) { |
62 | int addr2line(char const* const program_name, void const* const addr) { |
| 63 | char addr2line_cmd[ |
63 | static char addr2line_cmd[MAXPATHLEN]; // Pierre-Marie Baty -- use the heap instead |
| 64 | 64 | ||
| 65 | /* have addr2line map the address to the related line in the code */ |
65 | /* have addr2line map the address to the related line in the code */ |
| 66 | sprintf(addr2line_cmd, "addr2line -f -p -e \"%s\" %p", program_name, addr - get_dethrace_offset()); // Pierre-Marie Baty -- support pathnames |
66 | sprintf(addr2line_cmd, "addr2line -f -p -e \"%s\" %p", program_name, addr - get_dethrace_offset()); // Pierre-Marie Baty -- enclosed program_name within quotes to support pathnames with spaces |
| 67 | 67 | ||
| 68 | fprintf(stderr, "%d: ", stack_nbr++); |
68 | fprintf(stderr, "%d: ", stack_nbr++); |
| 69 | return system(addr2line_cmd); |
69 | return system(addr2line_cmd); |
| 70 | } |
70 | } |
| 71 | 71 | ||