Hi,
this is similar to the fix that I did recently for rerequesting dwarf_tag for DIE with zero abbrev code, except this time the DIE has non-zero invalid code. On such a DIE, the following SEGVs libdw:
die = dwarf_offdie (dw, 11, &die_mem); dwarf_tag (die); die = dwarf_offdie (dw, 11, &die_mem) dwarf_tag (die);
The fix and a test case are on pmachata/rerequest-tag.
Thanks, PM
Hi Petr,
On Wed, 2011-03-16 at 18:13 +0100, Petr Machata wrote:
this is similar to the fix that I did recently for rerequesting dwarf_tag for DIE with zero abbrev code, except this time the DIE has non-zero invalid code. On such a DIE, the following SEGVs libdw:
die = dwarf_offdie (dw, 11, &die_mem); dwarf_tag (die); die = dwarf_offdie (dw, 11, &die_mem) dwarf_tag (die);
The fix and a test case are on pmachata/rerequest-tag.
That fix makes sense to me. Although I had to triple check why it was correct.
<pedantic> The comment and the return inside the while loop was confusing me at first. It would maybe be slightly easier on the reader to replace the "return DWARF_END_ABBREV;" with a "break;", so that your "at the end already" logic triggers always instead of only on the second (or third, etc.) call. </pedantic>
Cheers,
Mark
BTW. I wouldn't mind seeing small patches like that on the list. In this case I needed to pull anyway, to see it in full context, but otherwise it is slightly easier/quicker to review.
BTW. I wouldn't mind seeing small patches like that on the list. In this case I needed to pull anyway, to see it in full context, but otherwise it is slightly easier/quicker to review.
Agreed. Or at least include the URL of the gitweb page showing the diff (actually, best is to do both). I am at the moment on a machine where I read mail and web but not where I have my elfutils checkout, so I'd review something simple looking at the diff but delay it if I need to use git or compile things myself to have anything to say.
Thanks, Roland
<pedantic> The comment and the return inside the while loop was confusing me at first. It would maybe be slightly easier on the reader to replace the "return DWARF_END_ABBREV;" with a "break;", so that your "at the end already" logic triggers always instead of only on the second (or third, etc.) call. </pedantic>
I'm looking at http://git.fedorahosted.org/git/?p=elfutils.git;a=commitdiff;h=bd1d16c3a17c2... and I can't see what you're referring to. Are we talking about the same change?
Thanks, Roland
On Wed, 2011-03-16 at 14:27 -0700, Roland McGrath wrote:
<pedantic> The comment and the return inside the while loop was confusing me at first. It would maybe be slightly easier on the reader to replace the "return DWARF_END_ABBREV;" with a "break;", so that your "at the end already" logic triggers always instead of only on the second (or third, etc.) call. </pedantic>
I'm looking at http://git.fedorahosted.org/git/?p=elfutils.git;a=commitdiff;h=bd1d16c3a17c2... and I can't see what you're referring to. Are we talking about the same change?
Yes.
My confusion was about the comment "second (or third, etc.) call". It took me a while to understand that above that change, there is a while loop which on the first call intercepts the abb == NULL itself and returns a value, but on subsequent calls, when last_abbrev_offset == -1, it drops out of the loop, and so then this logic triggers. Like I said, pedantic...
elfutils-devel@lists.fedorahosted.org