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: Fwd: FW: [PATCH V5 1/2] Initialize bnd register before performing inferior calls.


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 (éå)


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