This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] import drow dbxread.c fix to branch
Daniel Jacobowitz writes:
> >
> > Take a look at the way gdbtk does it, in
> > gdbtk/generic/gdbtk-cmd.c:gdb_disassemble_driver().
> > Can we adopt that solution?
> >
> > (I really can't wait until we can get rid of this duplication/triplication of
> > disassembly code. I think I'll start cleaning some things up).
>
> I'm not sure. That code assumes a different meaning of line==0 than
> the one we're using. Particularly, if I understand correctly, the
> meaning in gdbtk comes from a set of Cygnus-internal stabs for handling
> live range splitting, which never made it into any public GCC and are
> completely obsoleted by DWARF-2. I prefer:
>
Yes, you are right, that code predates even gdbtk bein contributed
publically. I initially thought that it was a recent fix.
> > + /* Skip any end-of-function markers. */
> > + if (le[i].line == 0)
> > + continue;
> > +
>
>
> to:
>
> /* GCC sometimes emits line directives with a linenumber
> of 0. It does this to handle live range splitting.
> This may be a bug, but we need to be able to handle it.
> For now, use the previous instructions line number.
> Since this is a bit of a hack anyway, we will just lose
> if the bogus sline is the first line of the range. For
> functions, I have never seen this to be the case. */
>
> if (le[i].line != 0)
> {
> mle[newlines].line = le[i].line;
> }
> else
> {
> if (newlines > 0)
> mle[newlines].line = mle[newlines - 1].line;
> }
>
>
> i.e. skip the line, not fake up a line number for it. It's a
> special-purpose marker, not a generic line number.
>
> If you agree with me, want me to update gdbtk's version to match? Does
> this same code exist in a third location?
>
I guess posting a patch to the insight list can do no harm. It's up to
them to approve it.
There is no real third location, but rather a third way to do
disassembly in gdb proper (disassemble_cmd).
Anyway, the code can go in for the MI part.
Elena
> --
> Daniel Jacobowitz Carnegie Mellon University
> MontaVista Software Debian GNU/Linux Developer