Bug 24090 - Incorrect value of zmm register
Summary: Incorrect value of zmm register
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: 8.2.1
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-12 19:04 UTC by Sergey
Modified: 2019-01-13 16:40 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
source1 (104 bytes, text/plain)
2019-01-12 19:04 UTC, Sergey
Details
source2 (215 bytes, text/x-csrc)
2019-01-12 19:05 UTC, Sergey
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey 2019-01-12 19:04:14 UTC
Created attachment 11536 [details]
source1

GDB incorrectly shows values of upper halves(upper 32 bytes) of ZMM registers - it always are zero.

Program consists of 2 files:
////1st file "foo.asm" :
.intel_syntax noprefix

.text

.global foo

foo:
    vmovdqu64 zmm0, zmmword ptr[ rsi ]
    vmovdqu64 zmmword ptr[ rdi ], zmm0
    ret

////2nd file "main.c" :
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void foo( unsigned char* p1, const unsigned char* p2 );

int main( int argc, char** argv )
{
    unsigned char chbuf1[ 1000 ], chbuf2[ 1000 ];
    size_t len;

    memset( chbuf1, 0, sizeof( chbuf1 ) );
    for( len = 0; len < sizeof( chbuf2 ); ++len )
        chbuf2[ len ] = ( unsigned char )len;
    foo( chbuf1, chbuf2 );
    return 0;
}

////
build this program:
$ as -g foo.asm -o foo.o
$ gcc -g main.c -c -std=c89 -o main.o
$ gcc -g -o main main.o foo.o

////
debug it with GDB:
$ gdb main

(gdb) b foo.asm:9
Breakpoint 1 at 0x762: file foo.asm, line 9.

(gdb) r
Starting program: /home/serg/.../main 

Breakpoint 1, foo () at foo.asm:9
9	    vmovdqu64 zmmword ptr[ rsi ], zmm0

(gdb) info registers zmm0
zmm0           {v16_float = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_double = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v64_int8 = {0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x0 <repeats 32 times>}, v32_int16 = {0x100, 0x302, 0x504, 0x706, 0x908, 0xb0a, 0xd0c, 0xf0e, 0x1110, 0x1312, 0x1514, 0x1716, 0x1918, 0x1b1a, 0x1d1c, 0x1f1e, 0x0 <repeats 16 times>}, v16_int32 = {0x3020100, 0x7060504, 0xb0a0908, 0xf0e0d0c, 0x13121110, 0x17161514, 0x1b1a1918, 0x1f1e1d1c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int64 = {0x706050403020100, 0xf0e0d0c0b0a0908, 0x1716151413121110, 0x1f1e1d1c1b1a1918, 0x0, 0x0, 0x0, 0x0}, v4_int128 = {0xf0e0d0c0b0a09080706050403020100, 0x1f1e1d1c1b1a19181716151413121110, 0x0, 0x0}}
Comment 1 Sergey 2019-01-12 19:05:00 UTC
Created attachment 11537 [details]
source2
Comment 2 Sergey 2019-01-12 20:01:00 UTC
Target platform: Ubuntu 18.04.1 LTS x64
Proccessor: Intel® Core™ i7-7800X
Comment 3 Simon Marchi 2019-01-13 00:59:16 UTC
Could this commit (available in master) be related?

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=b5420128da08dc81d94b265e88083d172909ea25
Comment 4 Sergey 2019-01-13 15:51:13 UTC
(In reply to Simon Marchi from comment #3)
> Could this commit (available in master) be related?
> 
> https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;
> h=b5420128da08dc81d94b265e88083d172909ea25

I build this commit, and it works, ZMM registers are displayed as it should!)
Comment 5 Simon Marchi 2019-01-13 16:40:43 UTC
Ok thanks, I'll closed this as already FIXED then.