* [PATCH] Use section name in warnings in display_debug_loc
@ 2021-11-02 16:26 Tom Tromey
2021-11-02 17:06 ` Andreas Schwab
2021-11-03 0:52 ` Alan Modra
0 siblings, 2 replies; 4+ messages in thread
From: Tom Tromey @ 2021-11-02 16:26 UTC (permalink / raw)
To: binutils; +Cc: Tom Tromey
While looking at an apparently malformed executable with
"readelf --debug-dump=loc", I got this warning:
readelf: ./main: Warning: There is a hole [0x89 - 0x95] in .debug_loc section.
However, the executable only has a .debug_loclists section.
This patch fixes the warning messages in display_debug_loc to use the
name of the section that is being processed.
binutils/ChangeLog
2021-11-02 Tom Tromey <tromey@adacore.com>
* dwarf.c (display_debug_loc): Use section name in warnings.
---
binutils/ChangeLog | 4 ++++
binutils/dwarf.c | 20 ++++++++++++--------
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index d42dc64b397..4fbd0607f3f 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -7022,28 +7022,32 @@ display_debug_loc (struct dwarf_section *section, void *file)
else
{
if (start < next)
- warn (_("There is a hole [0x%lx - 0x%lx] in .debug_loc section.\n"),
+ warn (_("There is a hole [0x%lx - 0x%lx] in %s section.\n"),
(unsigned long) (start - section_begin),
- (unsigned long) offset);
+ (unsigned long) offset,
+ section->name);
else if (start > next)
- warn (_("There is an overlap [0x%lx - 0x%lx] in .debug_loc section.\n"),
+ warn (_("There is an overlap [0x%lx - 0x%lx] in %s section.\n"),
(unsigned long) (start - section_begin),
- (unsigned long) offset);
+ (unsigned long) offset,
+ section->name);
}
start = next;
vstart = vnext;
if (offset >= bytes)
{
- warn (_("Offset 0x%lx is bigger than .debug_loc section size.\n"),
- (unsigned long) offset);
+ warn (_("Offset 0x%lx is bigger than %s section size.\n"),
+ (unsigned long) offset,
+ section->name);
continue;
}
if (vnext && voffset >= bytes)
{
- warn (_("View Offset 0x%lx is bigger than .debug_loc section size.\n"),
- (unsigned long) voffset);
+ warn (_("View Offset 0x%lx is bigger than %s section size.\n"),
+ (unsigned long) voffset,
+ section->name);
continue;
}
--
2.31.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Use section name in warnings in display_debug_loc
2021-11-02 16:26 [PATCH] Use section name in warnings in display_debug_loc Tom Tromey
@ 2021-11-02 17:06 ` Andreas Schwab
2021-11-04 15:35 ` Tom Tromey
2021-11-03 0:52 ` Alan Modra
1 sibling, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2021-11-02 17:06 UTC (permalink / raw)
To: Tom Tromey via Binutils; +Cc: Tom Tromey
On Nov 02 2021, Tom Tromey via Binutils wrote:
> - warn (_("There is a hole [0x%lx - 0x%lx] in .debug_loc section.\n"),
> + warn (_("There is a hole [0x%lx - 0x%lx] in %s section.\n"),
Perhaps the section name should be put in quotes? I think that would
give translators a hint that it is some kind of literal.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Use section name in warnings in display_debug_loc
2021-11-02 16:26 [PATCH] Use section name in warnings in display_debug_loc Tom Tromey
2021-11-02 17:06 ` Andreas Schwab
@ 2021-11-03 0:52 ` Alan Modra
1 sibling, 0 replies; 4+ messages in thread
From: Alan Modra @ 2021-11-03 0:52 UTC (permalink / raw)
To: Tom Tromey; +Cc: binutils
On Tue, Nov 02, 2021 at 10:26:55AM -0600, Tom Tromey via Binutils wrote:
> * dwarf.c (display_debug_loc): Use section name in warnings.
Thanks. OK.
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Use section name in warnings in display_debug_loc
2021-11-02 17:06 ` Andreas Schwab
@ 2021-11-04 15:35 ` Tom Tromey
0 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2021-11-04 15:35 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Tom Tromey via Binutils, Tom Tromey
>>>>> "Andreas" == Andreas Schwab <schwab@linux-m68k.org> writes:
Andreas> On Nov 02 2021, Tom Tromey via Binutils wrote:
>> - warn (_("There is a hole [0x%lx - 0x%lx] in .debug_loc section.\n"),
>> + warn (_("There is a hole [0x%lx - 0x%lx] in %s section.\n"),
Andreas> Perhaps the section name should be put in quotes? I think that would
Andreas> give translators a hint that it is some kind of literal.
I looked and couldn't find any other section name in dwarf.c (either via
%s or hard-coded) in a printf that is quoted. However, there were
multiple existing uses like "%s section" or "section %s".
So, while I think this change would be fine (I don't have a strong
opinion on its desirability), I think that if it is done, it should be
done for all the binutils at once.
thanks,
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-11-04 15:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-02 16:26 [PATCH] Use section name in warnings in display_debug_loc Tom Tromey
2021-11-02 17:06 ` Andreas Schwab
2021-11-04 15:35 ` Tom Tromey
2021-11-03 0:52 ` Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).