Rev 1 | Rev 14 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1 | Rev 11 | ||
---|---|---|---|
Line 34... | Line 34... | ||
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 | char addr2line_cmd[512] = { 0 }; |
36 | char addr2line_cmd[512] = { 0 }; |
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 |
39 | sprintf(addr2line_cmd, "atos -s %" PRIxPTR " -o \"%s\" %p", slide, program_name, addr); |
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); |
Line 220... | Line 220... | ||
220 | } |
220 | } |
221 | } |
221 | } |
222 | } |
222 | } |
223 | 223 | ||
224 | FILE* OS_fopen(const char* pathname, const char* mode) { |
224 | FILE* OS_fopen(const char* pathname, const char* mode) { |
- | 225 | FILE* f; |
|
- | 226 | ||
225 |
|
227 | f = fopen(pathname, mode); |
- | 228 | if (f == NULL) { |
|
- | 229 | fprintf(stderr, "Failed to open \"%s\" (%s)\n", pathname, strerror(errno)); |
|
- | 230 | } |
|
- | 231 | ||
- | 232 | return f; |
|
226 | } |
233 | } |
227 | 234 | ||
228 | size_t OS_ConsoleReadPassword(char* pBuffer, size_t pBufferLen) { |
235 | size_t OS_ConsoleReadPassword(char* pBuffer, size_t pBufferLen) { |
229 | // FIXME: unsafe implementation (echos the password) |
236 | // FIXME: unsafe implementation (echos the password) |
230 | pBuffer[0] = '\0'; |
237 | pBuffer[0] = '\0'; |