scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 732eb16b32d33bfaa8af24557a7316dd46621ee7
parent a5de9125f6dd591b8800c771755ae71a418330f4
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date:   Tue, 17 Mar 2026 09:57:14 +0100

doc: Add man page for scc-addr2line

Diffstat:
Adoc/man1/scc-addr2line.1 | 82+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msrc/cmd/scc-addr2line.c | 4++--
2 files changed, 84 insertions(+), 2 deletions(-)

diff --git a/doc/man1/scc-addr2line.1 b/doc/man1/scc-addr2line.1 @@ -0,0 +1,82 @@ +.TH ADDR2LINE 1 scc\-VERSION +.SH NAME +scc-addr2line \- translate addresses into file names and line numbers +.SH SYNOPSIS +.B scc-addr2line +.RB [ \-e +.IR file ] +.RI [ addr ...] +.SH DESCRIPTION +.B scc-addr2line +translates program addresses into file names and line numbers. +Given an address in an executable, it uses the debug information in +the object file to determine which source file and line number +correspond to that address. +.PP +Addresses are specified in hexadecimal. For each address, +.B scc-addr2line +prints the corresponding source file name and line number to standard +output, in the form: +.PP +.in +4n +.EX +filename:linenumber +.EE +.in +.PP +If no addresses are given as arguments, +.B scc-addr2line +reads addresses from standard input, one per line, and translates each +one. This mode continues until an error is encountered or end-of-file +is reached. +.SH OPTIONS +.TP +.BI \-e " file" +Use +.I file +as the executable to translate addresses from. +If this option is not specified, +.B scc-addr2line +uses +.B a.out +as the default executable. +.SH OPERANDS +.TP +.I addr +A hexadecimal address to translate. Multiple addresses may be specified +as separate arguments and will be translated in order. +.SH EXIT STATUS +.TP +.B 0 +Successful completion. +.TP +.B >0 +An error occurred, such as an unrecognized file format, an invalid +address, or no matching debug information found. +.SH EXAMPLES +Translate a single address in the default executable: +.IP +.EX +scc-addr2line 0x4005a0 +.EE +.PP +Translate multiple addresses in a specific executable: +.IP +.EX +scc-addr2line \-e myprog 0x4005a0 0x400620 +.EE +.PP +Read addresses from standard input: +.IP +.EX +echo 0x4005a0 | scc-addr2line \-e myprog +.EE +.SH AUTHORS +See the LICENSE file for the authors. +.SH LICENSE +See the LICENSE file for the terms of redistribution. +.SH SEE ALSO +.BR scc-nm (1), +.BR scc-objdump (1), +.BR scc-strip (1), +.BR scc-cc (1) diff --git a/src/cmd/scc-addr2line.c b/src/cmd/scc-addr2line.c @@ -18,7 +18,7 @@ error(char *fmt, ...) va_list va; va_start(va, fmt); - fprintf(stderr, "strip: %s: ", filename); + fprintf(stderr, "scc-addr2line: %s: ", filename); vfprintf(stderr, fmt, va); putc('\n', stderr); va_end(va); @@ -104,7 +104,7 @@ loadexe(char *fname) static void usage(void) { - fputs("usage: addr2line [-e file] [addr ...]\n", stderr); + fputs("usage: scc-addr2line [-e file] [addr ...]\n", stderr); exit(EXIT_FAILURE); }