This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PING][RFC][PATCH v2] Python API: add gdb.stack_may_be_invalid


On 11/07/2014 01:32 PM, Martin Galvan wrote:
> 2) The behavior of handle_step_into_function and setting breakpoints
> is inconsistent for optimized code, at least in ARM. If you step into
> a function in a program compiled with gcc -O1, you'll see the PC ends
> up one instruction after the set of instructions that place the
> arguments passed as registers in the registers they'll be used in. If
> you do "break myFunction", however, the breakpoint will correctly be
> placed at the very first instruction. Both handle_step.. and setting
> breakpoints have the same effect on -O0 code.

We should really fix this.  I can't imagine we do this on purpose.

> If we look at how "break myFunction" works, we'll see that we end up
> calling find_function_start_sal to determine at which PC we have to
> place our breakpoint. Therefore, that's the function we should be
> calling when checking whether the stack frame will be valid at a
> prologue, as it also accounts for optimizations.

We expose functions and sals as python objects.
Shouldn't we instead consider exposing find_function_start_sal
in the function object?  Or maybe symbol_to_sal in the Symbol object?
I can well imagine these being useful to other use cases.

Thanks,
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]