aboutsummaryrefslogtreecommitdiff
path: root/binutils/dwarf.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-05-15 15:09:20 +0930
committerAlan Modra <amodra@gmail.com>2021-05-15 15:10:29 +0930
commitb0d461ec373e35fd380a060e6027d781f8a3f752 (patch)
treefbf0f60e6978a47eca883c621b84dce51e5e0960 /binutils/dwarf.c
parent46d1214d887cdd2979fec2344cda1720abbbd33f (diff)
downloadgdb-b0d461ec373e35fd380a060e6027d781f8a3f752.zip
gdb-b0d461ec373e35fd380a060e6027d781f8a3f752.tar.gz
gdb-b0d461ec373e35fd380a060e6027d781f8a3f752.tar.bz2
display_debug_macro
* dwarf.c (display_debug_macro): Print strings that might not be zero terminated with %*s. Don't bump curr if unterminated.
Diffstat (limited to 'binutils/dwarf.c')
-rw-r--r--binutils/dwarf.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 9d78291..68732cf 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -6042,17 +6042,21 @@ display_debug_macro (struct dwarf_section *section,
case DW_MACRO_define:
READ_ULEB (lineno, curr, end);
string = curr;
- curr += strnlen ((char *) string, end - string) + 1;
- printf (_(" DW_MACRO_define - lineno : %d macro : %s\n"),
- lineno, string);
+ curr += strnlen ((char *) string, end - string);
+ printf (_(" DW_MACRO_define - lineno : %d macro : %*s\n"),
+ lineno, (int) (curr - string), string);
+ if (curr < end)
+ curr++;
break;
case DW_MACRO_undef:
READ_ULEB (lineno, curr, end);
string = curr;
- curr += strnlen ((char *) string, end - string) + 1;
- printf (_(" DW_MACRO_undef - lineno : %d macro : %s\n"),
- lineno, string);
+ curr += strnlen ((char *) string, end - string);
+ printf (_(" DW_MACRO_undef - lineno : %d macro : %*s\n"),
+ lineno, (int) (curr - string), string);
+ if (curr < end)
+ curr++;
break;
case DW_MACRO_start_file: