Re: [PATCH] Fix for incorrect breakpoint set in case of flang compiled binary

Andrew Burgess
2020-08-19T13:05:28Z

* Tom Tromey <tom@tromey.com> [2020-08-17 14:51:19 -0600]:

> >>>>> ">" == Sharma, Alok Kumar <AlokKumar.Sharma@amd.com> writes:
>
> >> + || startswith(COMPUNIT_PRODUCER(cust), " F90 Flang"))))
>
> Space before "(".
>
> Does it really start with a space? That seems weird.
>
> >> # Check if not allocated VLA in type does not break
> >> # the debugger when accessing it.
> >> -gdb_breakpoint [gdb_get_line_number "before-allocated"]
> >> -gdb_continue_to_breakpoint "before-allocated"
> >> +# break main for Flang compiler already breaks here
>
> Do you know why?

The line marked 'before-allocated' is the first line that should be
considered after the prologue.

Due to GCC not really marking the end of prologue correctly we rely on
the prologue scanner for GCC, while for Flang we can use the line
table to spot the end of prologue.

On Flang this leaves us in the correct place, the 'before-allocated'
line.

On GCC the prologue scanner aborts early because the prologue contains
a small control flow loop to initialise some of the local variables.
As a result on GCC we stop part way through the prologue.

We could improve the prologue scanner to handle this case on GCC, but
that's obviously a separate issue.

... or GCC could start marking the end of prologue.

Thanks,
Andrew