changeset 155:15743b40e03a

tiobjd ctypes: print more useful hex byte offsets for struct fields
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Fri, 02 May 2014 23:41:44 +0000
parents 1cd11badf287
children 275d0f71a014
files leo-obj/frame_na7_db_fl/Makefile leo-obj/tool/richsym.c
diffstat 2 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/leo-obj/frame_na7_db_fl/Makefile	Fri May 02 06:20:26 2014 +0000
+++ b/leo-obj/frame_na7_db_fl/Makefile	Fri May 02 23:41:44 2014 +0000
@@ -13,7 +13,7 @@
 	${TOOL} $*.obj disasm -gl > $@
 
 %.ctypes:	%.obj
-	${TOOL} $*.obj ctypes > $@
+	${TOOL} $*.obj ctypes -o > $@
 
 ${TARGETS}:	${TOOL} Makefile
 
--- a/leo-obj/tool/richsym.c	Fri May 02 06:20:26 2014 +0000
+++ b/leo-obj/tool/richsym.c	Fri May 02 23:41:44 2014 +0000
@@ -323,12 +323,16 @@
 	int c;
 	unsigned n;
 	struct internal_syment *sym;
+	int print_offsets = 0;
 
-	while ((c = getopt(argc, argv, "b")) != EOF)
+	while ((c = getopt(argc, argv, "bo")) != EOF)
 		switch (c) {
 		case 'b':
 			richsym_print_bitsize++;
 			continue;
+		case 'o':
+			print_offsets++;
+			continue;
 		default:
 			/* error msg already printed */
 			exit(1);
@@ -386,7 +390,10 @@
 		case C_MOU:
 			if (sym->scnum != -1)
 				printf("\t/* MOS/MOU section != ABS! */\n");
-			else if (richsym_print_bitsize >= 2)
+			else if (print_offsets && !(sym->value & 7))
+				printf("\t/* offset: 0x%x */\n",
+					sym->value >> 3);
+			else if (print_offsets || richsym_print_bitsize >= 2)
 				printf("\t/* offset: %u bits */\n", sym->value);
 			richsym_print_in_c("\t", sym, 0);
 			continue;