This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Fwd: FW: [PATCH V5 1/2] Initialize bnd register before performing inferior calls.
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: Walfred Tedeschi <walfred dot tedeschi at intel dot com>
- Cc: qiyaoltc at gmail dot com, palves at redhat dot com, gdb-patches <gdb-patches at sourceware dot org>, brobecker at adacore dot com
- Date: Wed, 27 Apr 2016 09:47:24 +0100
- Subject: Re: Fwd: FW: [PATCH V5 1/2] Initialize bnd register before performing inferior calls.
- Authentication-results: sourceware.org; auth=none
- References: <AC542571535E904D8E8ADAE745D60B19445B77C8 at IRSMSX104 dot ger dot corp dot intel dot com> <571F7CC8 dot 7070702 at intel dot com>
Walfred Tedeschi <walfred.tedeschi@intel.com> writes:
[Could you reply to the mail rather than forward?]
> That is true, but not unattended. In case BND registers are not set
> to init state the current context value will be used for the inferior
> call.
> Causing with a higher chance a BND violation.
>
If the BND violation is caused by GDB inferior call, GDB should take
care of the violation. If the violation is caused by the function
itself we are doing inferior call, it is the right behavior.
Take the breakpoint for example, if I set a breakpoint in function foo,
and do the inferior call, the breakpoint is hit,
(gdb) b foo
Breakpoint 2 at 0x4004fa: file 2.c, line 11.
(gdb) p foo ()
Breakpoint 2, foo () at 2.c:11
11 counter = 1;
The program being debugged stopped while in a function called from GDB.
Evaluation of the expression containing the function
(foo) will be abandoned.
When the function is done executing, GDB will silently stop.
(gdb) bt
#0 foo () at 2.c:11
#1 <function called from gdb>
#2 main (argc=1, argv=0x7fffffffdfc8) at 2.c:15
> The question is was that intended by the user? Likely not.
>
It has nothing to do with user's intention. It is about the consistency
of GDB behavior. If the execution of function foo triggers BND
violation, the inferior call to function foo (with the same context)
should trigger the BND violation as well.
> Also it will invalidate the inferior call usage. The inferior call
> will finish before returning the result back to the user.
Looks the inferior call aborts when BND violation is triggered. IMO,
GDB should stop and frame #0 is the place where BND violation is
triggered.
--
Yao (éå)