public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [committed] Fix error: Unknown DWARF DW_FORM_ref_sig8
@ 2020-10-02 17:05 Tom de Vries
  2020-10-02 17:10 ` Jakub Jelinek
  0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries @ 2020-10-02 17:05 UTC (permalink / raw)
  To: dwz, jakub; +Cc: Mark Wielaard

Hi,

When running the gdb testsuite using target board cc-with-dwz, I ran into:
...
dwz: cpexprs-debug-types: Unknown DWARF DW_FORM_ref_sig8
dwz: cpexprs-debug-types: Couldn't read abbrev at offset 0x64
...

I traced this back to some code in read_abbrev, which until recent was:
...
         if (form == 2
             || (form > DW_FORM_flag_present && form != DW_FORM_ref_sig8))
           {
             error (0, 0, "%s: Unknown DWARF %s",
                    dso->filename, get_DW_FORM_str (form));
...
but now has been extended to:
...
         if (form == 2
             || (form > DW_FORM_flag_present
                 && (form != DW_FORM_ref_sig8
                     || form != DW_FORM_data16
                     || form != DW_FORM_line_strp)))
...

Before, form == DW_FORM_ref_sig8 didn't trigger an error because
form != DW_FORM_ref_sig8 evaluated to false.

Now, form == DW_FORM_ref_sig8 does trigger an error because
form != DW_FORM_data16 evaluates to true.

Fix by using this instead:
...
                 && !(form == DW_FORM_ref_sig8
                      || form == DW_FORM_data16
                      || form == DW_FORM_line_strp)))
...

Tested dwz testsuite, and cpexprs-debug-types.

Committed to trunk.

Thanks,
- Tom

Fix error: Unknown DWARF DW_FORM_ref_sig8

2020-10-02  Tom de Vries  <tdevries@suse.de>

	* dwz.c (read_abbrev): Fix "Unknown DWARF DW_FORM_ref_sig8" error.

---
 dwz.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dwz.c b/dwz.c
index eb52079..487fbc6 100644
--- a/dwz.c
+++ b/dwz.c
@@ -1261,9 +1261,9 @@ read_abbrev (DSO *dso, unsigned char *ptr)
 	  form = read_uleb128 (p);
 	  if (form == 2
 	      || (form > DW_FORM_flag_present
-		  && (form != DW_FORM_ref_sig8
-		      || form != DW_FORM_data16
-		      || form != DW_FORM_line_strp)))
+		  && !(form == DW_FORM_ref_sig8
+		       || form == DW_FORM_data16
+		       || form == DW_FORM_line_strp)))
 	    {
 	      error (0, 0, "%s: Unknown DWARF %s",
 		     dso->filename, get_DW_FORM_str (form));

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [committed] Fix error: Unknown DWARF DW_FORM_ref_sig8
  2020-10-02 17:05 [committed] Fix error: Unknown DWARF DW_FORM_ref_sig8 Tom de Vries
@ 2020-10-02 17:10 ` Jakub Jelinek
  2020-10-02 17:43   ` Mark Wielaard
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jelinek @ 2020-10-02 17:10 UTC (permalink / raw)
  To: Tom de Vries; +Cc: dwz, Mark Wielaard

On Fri, Oct 02, 2020 at 07:05:22PM +0200, Tom de Vries wrote:
> Fix by using this instead:
> ...
>                  && !(form == DW_FORM_ref_sig8
>                       || form == DW_FORM_data16
>                       || form == DW_FORM_line_strp)))
> ...

Sorry for not catching it in the review.
I guess even simpler would be
	  if (form == 2
	      || (form > DW_FORM_flag_present
		  && form != DW_FORM_ref_sig8
		  && form != DW_FORM_data16
		  && form != DW_FORM_line_strp))
but not worth changing it.

	Jakub


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [committed] Fix error: Unknown DWARF DW_FORM_ref_sig8
  2020-10-02 17:10 ` Jakub Jelinek
@ 2020-10-02 17:43   ` Mark Wielaard
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Wielaard @ 2020-10-02 17:43 UTC (permalink / raw)
  To: Jakub Jelinek, Tom de Vries; +Cc: dwz, Mark Wielaard

On Fri, 2020-10-02 at 19:10 +0200, Jakub Jelinek wrote:
> On Fri, Oct 02, 2020 at 07:05:22PM +0200, Tom de Vries wrote:
> > Fix by using this instead:
> > ...
> >                  && !(form == DW_FORM_ref_sig8
> >                       || form == DW_FORM_data16
> >                       || form == DW_FORM_line_strp)))
> > ...
> 
> Sorry for not catching it in the review.

Actually you did, you did say the logic was wrong, but then we
remembered that for DWARF4 we had:

[...]
DW_FORM_flag_present = 0x19
DW_FORM_ref_sig8     = 0x20

(haha, someone forgot how to count in hex, should have been 0x1a)

which made the original logic correct. But not what I ended up
writing... doh.

Thanks for catching that Tom.
I have no idea how this got through my testing :{

Cheers,

Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-02 17:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-02 17:05 [committed] Fix error: Unknown DWARF DW_FORM_ref_sig8 Tom de Vries
2020-10-02 17:10 ` Jakub Jelinek
2020-10-02 17:43   ` Mark Wielaard

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).