This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 11/11] ELFv2 ABI: skip global entry point code
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Ulrich Weigand <uweigand at de dot ibm dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 31 Jan 2014 14:14:32 +0400
- Subject: Re: [PATCH 11/11] ELFv2 ABI: skip global entry point code
- Authentication-results: sourceware.org; auth=none
- References: <20140129080932 dot GR4101 at adacore dot com> <201401291830 dot s0TIUWWI026029 at d06av02 dot portsmouth dot uk dot ibm dot com>
> No, there are no multiple entry points on AIX. (What you are refering
> to are mabye linker stubs? Those exist on Linux too, but they're not
> causing any issues with setting break points ...)
Maybe something like that, yes. I kind of remember that "break *func"
would sometimes not trigger, because a call of that function would
just to the 3rd instruction of the function instead of the first one.
It's not important.
> I first thought of using deprecated_function_start_offset too, but this
> hasn't quite the correct semantics. In particular, function_start_offset
> is also applied when evaluating a symbol name as function pointer expression
> and when doing inferior calls; see infcall.c:find_function_addr.
>
> This is exactly wrong for powerpc64le-linux, because when using function
> pointers or doing inferior calls, we definitely must use the *global*
> entry point, not the local one.
>
> Maybe it would be possible to change VAX to now use gdbarch_skip_entrypoint
> plus in addition define gdbarch_convert_from_func_ptr_addr to handle the
> function pointer expression case, and thereby get rid of the
> deprecated_function_start_offset callback ... I'm not sure I feel
> confident to do that without actual testing on VAX though.
Agreed on all counts.
> > > -gdb_test "break *hello" \
> > > +gdb_test "break hello" \
> > > "Breakpoint.*at.* file .*$srcfile, line .*" \
> > > "breakpoint at first instruction of hello()"
> >
> > I am not sure about this one, however. It seems to me that the purpose
> > of this test is to verify the behavior of the "bt" command while
> > still inside a function's prologue. That is something useful that
> > I wouldn't change.
>
> Hmm, looks like you're right. I had been under the impression that
> this test was about testing optimized code where we wouldn't do
> prologue skipping even with "break hello", but it is actually not
> optimized ...
>
> > For ppc64 using ELFv2, my suggestion would be to break at *hello+8?
>
> I don't particularly like this, since it hard-codes that:
> - this routine has a local entry point (not all routines do)
> - and it is at offset 8 (while all current compilers only ever create
> global entry point prologues of size 8, this might change in theory)
>
> I'd rather either skip the test, or modify it so that it also works on
> powerpc64le-linux. One way to do that would be to ensure that "hello"
> is entered via its global entry point, e.g. by calling it via a
> function pointer. This is what I've implemented now. Does this look
> reasonable to you?
Ha! That's indeed a much better idea.
--
Joel