[patch] Fix for PR gdb/12573

Paul Pluzhnikov
2011-03-16T23:54:26Z

Greetings,

Attached patch fixes http://sourceware.org/bugzilla/show_bug.cgi?id=12573
by removing (I believe incorrect) assertion.

The assertion is incorrect, because skip_prologue_sal may in fact put the
sal at a different line than what original_pc describes (if there are
inlined functions in the picture).

Also, we don't perform the same check if expanded.nelts == 1, which is why
the test from that PR does not cause a crash when built with GCC-4.6
(GCC-4.6 does not emit two copies -- C1 and C2 -- of a constructor).

If it did, we'd see the same crash there as well.

Thanks,

--
Paul Pluzhnikov

2011-03-16 Paul Pluzhnikov <ppluzhnikov@google.com>

PR gdb/12573
* breakpoint.c (expand_line_sal_maybe): Remove bogus assertion.

Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.552
diff -u -p -r1.552 breakpoint.c
--- breakpoint.c 14 Mar 2011 16:09:52 -0000 1.552
+++ breakpoint.c 16 Mar 2011 22:31:08 -0000
@@ -7447,18 +7447,6 @@ expand_line_sal_maybe (struct symtab_and
return expanded;
}

- if (original_pc)
- {
- found = 0;
- for (i = 0; i < expanded.nelts; ++i)
- if (expanded.sals[i].pc == original_pc)
- {
- found = 1;
- break;
- }
- gdb_assert (found);
- }
-
return expanded;
}