Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Hannes Domani <ssbssa@yahoo.de>
To: Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH 1/7] Fix function argument and return value locations
Date: Mon, 25 May 2020 23:03:01 +0000 (UTC)	[thread overview]
Message-ID: <64358647.5760638.1590447781446@mail.yahoo.com> (raw)
In-Reply-To: <1cc831e4-c36a-d0a3-a500-7f57bc7775e9@simark.ca>

 Am Dienstag, 26. Mai 2020, 00:14:36 MESZ hat Simon Marchi <simark@simark.ca> Folgendes geschrieben:

> On 2020-05-25 5:32 p.m., Hannes Domani via Gdb-patches wrote:
> > You're probably right, the thing is, I was only able to test complex float
> > and complex double, because gdb doesn't like complex integral types:
> >
> > complex int complex_int = 5 + 6i;
> >
> > (gdb) p complex_int
> > 'complex_int' has unknown type; cast it to its declared type
> > (gdb) pt complex_int
> > 'complex_int' has unknown type; cast it to its declared type
> >
> > So I guess it should check for target-type float as well:
> >        || (type->code () == TYPE_CODE_COMPLEX
> >            && TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FLT))
> >
> > Do many people use complex int, because I personally wouldn't have expected
> > that this even exists.
>
> Err right that doesn't make sense, let's use floats instead.  I see:
>
>
> $ cat hello.c
> #include <complex.h>
>
> void other(float real, float imag);
> void func (complex float n)
> {
>   other(creal(n), cimag(n));
> }
> $ x86_64-w64-mingw32-gcc hello.c -g3 -O0 -c
> $ x86_64-w64-mingw32-objdump -d hello.o
>
> hello.o:    file format pe-x86-64
>
>
> Disassembly of section .text:
>
> 0000000000000000 <func>:
>   0:  55                      push  %rbp
>   1:  48 89 e5                mov    %rsp,%rbp
>   4:  48 83 ec 20            sub    $0x20,%rsp
>   8:  48 89 4d 10            mov    %rcx,0x10(%rbp)
>   c:  f3 0f 10 45 14          movss  0x14(%rbp),%xmm0
>   11:  f3 0f 5a c0            cvtss2sd %xmm0,%xmm0
>   15:  f2 0f 5a c8            cvtsd2ss %xmm0,%xmm1
>   19:  f3 0f 10 45 10          movss  0x10(%rbp),%xmm0
>   1e:  f3 0f 5a c0            cvtss2sd %xmm0,%xmm0
>   22:  f2 0f 5a c0            cvtsd2ss %xmm0,%xmm0
>   26:  e8 00 00 00 00          callq  2b <func+0x2b>
>   2b:  90                      nop
>   2c:  48 83 c4 20            add    $0x20,%rsp
>   30:  5d                      pop    %rbp
>   31:  c3                      retq
>
> Doesn't this suggest that the parameter gets passed through rcx?  I'm not saying you
> are wrong, I'm just trying to understand how things work :).

You're absolutely right again.
The complex arguments didn't work before, so I just tried it with
amd64_windows_passed_by_xmm_register (because that seemed the obvious choice
for me), and then it worked.

But it only worked because in case of XMM register, the argument is also
passed via the integer register:

      else if (amd64_windows_passed_by_xmm_register (type))
        {
          amd64_windows_store_arg_in_reg
            (regcache, args[i], AMD64_XMM0_REGNUM + reg_idx);
          /* In case of varargs, these parameters must also be
         passed via the integer registers.  */
          amd64_windows_store_arg_in_reg
        (regcache, args[i],
         amd64_windows_dummy_call_integer_regs[reg_idx]);
          on_stack_p = 0;
          reg_idx++;
        }

So it actually should be added to amd64_windows_passed_by_integer_register,
and a quick test just now confirms that this also works.

I'm very sorry about that, I should have checked the asm code.


Hannes


  reply	other threads:[~2020-05-25 23:03 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200525185659.59346-1-ssbssa.ref@yahoo.de>
2020-05-25 18:56 ` Windows testsuite failures Hannes Domani
2020-05-25 18:56   ` [PATCH 1/7] Fix function argument and return value locations Hannes Domani
2020-05-25 21:02     ` Simon Marchi
2020-05-25 21:32       ` Hannes Domani
2020-05-25 22:14         ` Simon Marchi
2020-05-25 23:03           ` Hannes Domani [this message]
2020-05-26 16:14             ` Simon Marchi
2020-05-26 20:43         ` Tom Tromey
2020-05-25 18:56   ` [PATCH 2/7] Handle Windows drives in auto-load script paths Hannes Domani
2020-05-26 16:04     ` Jon Turney
2020-05-26 16:31       ` Hannes Domani
2020-05-26 16:05     ` Christian Biesinger
2020-05-26 16:25       ` Hannes Domani
2020-05-26 16:31         ` Christian Biesinger
2020-05-26 16:40           ` Hannes Domani
2020-05-26 16:42             ` Christian Biesinger
2020-05-26 17:14               ` Hannes Domani
2020-05-25 18:56   ` [PATCH 3/7] Handle Windows drives in rbreak paths Hannes Domani
2020-05-25 18:56   ` [PATCH 4/7] Use errno value of first openp failure Hannes Domani
2020-05-26 20:37     ` Tom Tromey
2020-05-25 18:56   ` [PATCH 5/7] Close file handle of empty history file Hannes Domani
2020-05-26 16:37     ` Christian Biesinger
2020-05-26 17:42       ` Hannes Domani
2020-05-27 14:33         ` Tom Tromey
2020-05-27 17:37           ` Hannes Domani
2020-05-27 18:27             ` Christian Biesinger
2020-05-25 18:56   ` [PATCH 6/7] Move exit_status_set_internal_vars out of GLOBAL_CURDIR Hannes Domani
2020-05-26 20:45     ` Tom Tromey
2020-05-27 17:50       ` Hannes Domani
2020-05-25 18:56   ` [PATCH 7/7] Reset Windows hardware breakpoints on executable's entry point Hannes Domani
2020-05-27 12:07     ` Pedro Alves
2020-05-27 14:48       ` Pedro Alves
2020-05-27 15:39         ` Hannes Domani
2020-05-31 15:54           ` Pedro Alves
2020-05-31 16:37     ` Pedro Alves
2020-06-07 12:56       ` Hannes Domani
2020-07-08 17:43         ` Hannes Domani
2020-10-09 18:22         ` Pedro Alves
2020-10-09 18:51           ` Hannes Domani via Gdb-patches
2020-10-12 11:13             ` Pedro Alves
2020-10-12 17:21       ` Tom Tromey
2020-10-12 17:22         ` Tom Tromey
2020-05-28 18:15   ` Windows testsuite failures Christian Biesinger
2020-05-28 18:37     ` Hannes Domani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=64358647.5760638.1590447781446@mail.yahoo.com \
    --to=ssbssa@yahoo.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox