scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit d90e6fd689d42cd8b519650687db9cea5c0c3d0c
parent eeaadb0d2ecae79301362f94813ece460eb9c06b
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 27 Nov 2017 19:54:27 +0100

[objdump] Add printstrings()

This function prints the string table

Diffstat:
Mobjdump/main.c | 20++++++++++++++++++++
1 file changed, 20 insertions(+), 0 deletions(-)

diff --git a/objdump/main.c b/objdump/main.c @@ -49,6 +49,25 @@ printhdr(struct myrohdr *hdr) hdr->relsize); } +static void +printstrings(struct myrohdr *hdr) +{ + size_t off, begin;; + char *s = NULL; + + puts("strings:"); + for (off = 0; off < strsiz; off++) { + if (s == NULL) { + s = &strings[off]; + begin = off; + } + if (strings[off] == '\0') { + printf("\t[%zd] \"%s\"\n", begin, s); + s = NULL; + } + } +} + int main(int argc, char *argv[]) { @@ -77,6 +96,7 @@ main(int argc, char *argv[]) } printhdr(&hdr); + printstrings(&hdr); goto close_file;