Re: [PATCH v4] gdb: ADI support

Wei-min Pan
2017-08-02T18:00:38Z

On 8/2/2017 12:55 AM, Yao Qi wrote:
> Weimin Pan <weimin.pan@oracle.com> writes:
>
>>> gdb_test "adi x shmaddr" "${hex}00:.*\t0.*" "examine ADI"
>> Or change it to:
>>
>> gdb_test "adi x shmaddr" "${hex}00:\t0 " "examine ADI"
>>
> Why does it print a trailing space? Can we remove it? It is from the
> for loop in adi_print_versions,

A trailing space is needed to separate tag values. I can change the code
so that no space is added for the last tag value:

if (tags[v_idx] == 0xff) /* no version tag */
printf_filtered ("-");
else
printf_filtered ("%1X", tags[v_idx]);
if (cnt > 1)
printf_filtered (" ");

and use your suggested "adi x" commands in the script.

> + for (int i = maxelts; i > 0 && cnt > 0; i--, cnt--)
> + {
> + if (tags[v_idx] == 0xff) /* no version tag */
> + printf_filtered ("- ");
> + else
> + printf_filtered ("%1X ", tags[v_idx]);
> + ++v_idx;
> + }
>
>>>
>>>> gdb_test "adi x/100 shmaddr" "${hex}00:\t${newadi} ${newadi}" \
>>>> "examine new ADI"
>>> It will pass if changed to:
>>>
>>> gdb_test "adi x/100 shmaddr" "${hex}00:.*\t${newadi} ${newadi}.*" \
>>> "examine new ADI"
>> Or change it to:
>>
>> gdb_test "adi x/100 shmaddr" "${hex}00:\t${newadi} ${newadi} " \
>> "examine new ADI"
>>
> Likewise.
>
>>>>> (gdb) PASS: gdb.arch/sparc64-adi.exp: reset ADI
>>>>> continue^M
>>>>> Continuing.^M
>>>>> ^M
>>>>> Program received signal SIGSEGV, Segmentation fault^M
>>>>> ADI precise mismatch while accessing address 0xfff8000100048000.^M
>>>>> 0xfff8000100129f38 in adi_set_version () from /usr/lib64/libadi.so^M
>>>> gdb_test "continue" \
>>>> [multi_line "Program received signal SIGSEGV, Segmentation fault" \
>>>> "ADI precise mismatch while accessing address $hex" ] \
>>>> "continue to sigsegv"
>>> And it will pass if changed to
>>>
>>> gdb_test "continue" \
>>> [multi_line ".*Program received signal SIGSEGV, Segmentation fault.*" \
>>> ".*ADI precise mismatch while accessing address $hex.*" ] \
>>> "continue to sigsegv"
>> Or change it to:
>>
>> gdb_test "continue" \
>> [multi_line "Program received signal SIGSEGV, Segmentation fault.*" \
>> "ADI precise mismatch while accessing address $hex.*" ] \
>> "continue to sigsegv"
> That is OK.
>