x86_64-m32 internal error for multi-thread-step.exp [Re: [PATCH v10 06/28] btrace: change branch trace data structure]

Jan Kratochvil
2015-01-08T20:49:54Z

On Tue, 14 Jan 2014 09:04:16 +0100, Markus Metzger wrote:
[...]
> +/* Allocate and initialize a new branch trace function segment.
> + PREV is the chronologically preceding function segment.
> + MFUN and FUN are the symbol information we have for this function. */
> +
> +static struct btrace_function *
> +ftrace_new_function (struct btrace_function *prev,
> + struct minimal_symbol *mfun,
> + struct symbol *fun)
> +{
> + struct btrace_function *bfun;
> +
> + bfun = xzalloc (sizeof (*bfun));
> +
> + bfun->msym = mfun;
> + bfun->sym = fun;
> + bfun->flow.prev = prev;
> +
> + /* We start with the identities of min and max, respectively. */
> + bfun->lbegin = INT_MAX;
> + bfun->lend = INT_MIN;
>
> - if (filename == NULL)
> - filename = "";
> + if (prev != NULL)
> + {
> + gdb_assert (prev->flow.next == NULL);

(gdb) PASS: gdb.btrace/multi-thread-step.exp: navigate: thread 1: record goto begin
info record^M
Active record target: record-btrace^M
btrace.c:220: internal-error: ftrace_new_function: Assertion `prev->flow.next == NULL' failed.^M

This occasionally happens on x86_64 system with -m32 inferior:
runtest CC_FOR_TARGET="gcc -m32" CXX_FOR_TARGET="g++ -m32" gdb.btrace/multi-thread-step.exp

cpu family : 6
model : 63
model name : Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
stepping : 2
microcode : 0x2a

> + prev->flow.next = bfun;
>
> - return (filename_cmp (bfile, filename) != 0);
> + bfun->number = prev->number + 1;
> + bfun->insn_offset = (prev->insn_offset
> + + VEC_length (btrace_insn_s, prev->insn));
> + }
> +
> + return bfun;
> }

Although for -m32 inferior there are 100% reproducible more FAILs:
FAIL: gdb.btrace/rn-dl-bind.exp: reverse-next
FAIL: gdb.btrace/rn-dl-bind.exp: reverse-step
FAIL: gdb.btrace/rn-dl-bind.exp: reverse-step
FAIL: gdb.btrace/rn-dl-bind.exp: reverse-next
FAIL: gdb.btrace/rn-dl-bind.exp: next (the program exited)
FAIL: gdb.btrace/exception.exp: flat (pattern 1)
FAIL: gdb.btrace/exception.exp: indented (pattern 1)

So I do not think the assert may be such a critical issue as IIUC btrace is
probably not used for 32-bit inferiors.

Regards,
Jan