From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id kFDYJZp/KmbWyzsAWB0awg (envelope-from ) for ; Thu, 25 Apr 2024 12:06:50 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=OPWMmKPQ; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 8898A1E0C0; Thu, 25 Apr 2024 12:06:50 -0400 (EDT) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 66BE61E092 for ; Thu, 25 Apr 2024 12:06:48 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 080073858C66 for ; Thu, 25 Apr 2024 16:06:48 +0000 (GMT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 1070C3858D20 for ; Thu, 25 Apr 2024 16:06:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1070C3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1070C3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714061185; cv=none; b=b1ZiAtgJiz8sYKRqs9HK8QudM3lv1NuPXfi/UNHCpHjFtHberHATdQc6x2ctg7BZU8CfdhNgvit/vXR+bqWazXUoXG6EZFdEU2sTllJcpsbS4qW3+xNopzpoWq6kYD73bFawZ1vEZXnQO8empOQtvZUmzfPEGdj5DUWEjn/DSko= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714061185; c=relaxed/simple; bh=z+CX+1ktkqJrnRhA+YpbajxXTIY8YwWdvRPEz1sxhHU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=cCNwxbtLRk6wMXradeHpaFAjsNaMdRsfzjrc5zYtriEXVz5Qhrd6jaPBDa+rgO5K/+I6BqRF8jbItI+Ccntp9VMaQ1EpTRrh24q9++oG33eF9M+1mO8XS5NbofY2bCzmb6UfVKuyoVj2exjhqst1nxwqFBOt0ID0Oo271zcCHAs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714061176; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Wym3yQExnmhIBbCgNQPoR/Amo8q2wY7Jyxu/efocJLU=; b=OPWMmKPQYPGUyDyjvNqDfm+FCSaC3K5ieXvFdhfl/RGsQg9CQQviDow3YPt0LEm2wMNVA2 mv51ZRd1ilOnSm7HEvZYiCXakYspnCF9FNmUC+0bAN8GIPb4p5vagrVuJjemk0lOxb7fKV DqHYcPKNEFqiCKf46ZCeA6ziMudR12s= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-271-1Q77qLHdOY2KwEkE8Okpaw-1; Thu, 25 Apr 2024 12:06:15 -0400 X-MC-Unique: 1Q77qLHdOY2KwEkE8Okpaw-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-34a49f5a6baso964257f8f.3 for ; Thu, 25 Apr 2024 09:06:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714061173; x=1714665973; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Wym3yQExnmhIBbCgNQPoR/Amo8q2wY7Jyxu/efocJLU=; b=vTmgDRdKZRu8OCfmFutSZnff4ooTQvdr3b4zUCkmDrvXXA3qXYQwkJvWCQeBgt5GI5 Gr7HGF4rExYA+db0kXLD6yVMI157Y6kPHotkWhyzTDRkdkF/7ecegs7mMiXdD8lTgMLu ol1zg4E+cCEYrczlWgivw8MvXFQeFCFDIbHalgSBPkM8VqIdXPm3GoqqEP0lxVhcPcUL bhSUh9oUa5dHDEvz7kLZcvDOFMCrwHlXSDAAbZLLZy7yMfT6eGB3RE7eEKKAUJJfnRqt 5OwBdwkrxJhSef/lCbNefjeTm3JxjVhSo9Ce4DWFmJkNgQ38XOJZvBuQ/OUZ9Hiv3VL0 /DIQ== X-Forwarded-Encrypted: i=1; AJvYcCXuAdfJy3nCjKLX+cJhHLgPnrm4TBU6bJARu0X25P+2eKE81fDKg1wbqsJuULTF2GYeL8S5+hlH9U0y+v6jI5m9PTM+rQI1obqrYA== X-Gm-Message-State: AOJu0YwLbNHsN8I27PrYM0B/UgYpMCiPtmDO9Nk2CTZ4N2fqY+6QGGJq PuklUQlh+NuBvMhN3n1DZG9aWjC++AZL2sG0L5GYGCdIYjfzISF+jgkv+FB/7W7y127k3tonHdC 2Ok47aVBBJqeq3yaNQMseG4mWQymR9S8e99PnTB9fFzQdO1X81jEDu83vjF0uJJ+YZCM= X-Received: by 2002:a5d:6511:0:b0:347:9e5a:3078 with SMTP id x17-20020a5d6511000000b003479e5a3078mr5137501wru.1.1714061173151; Thu, 25 Apr 2024 09:06:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFlS1zylVNpz8+yBJ9V94nnvHvt3hqG4yr/jehjSecq5HykfxWJFYav3oTDER9vdF8V/8l6ZA== X-Received: by 2002:a5d:6511:0:b0:347:9e5a:3078 with SMTP id x17-20020a5d6511000000b003479e5a3078mr5137455wru.1.1714061172440; Thu, 25 Apr 2024 09:06:12 -0700 (PDT) Received: from localhost (185.223.159.143.dyn.plus.net. [143.159.223.185]) by smtp.gmail.com with ESMTPSA id e24-20020a5d5958000000b0034c0fefd7d2sm1888331wri.23.2024.04.25.09.06.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 09:06:12 -0700 (PDT) From: Andrew Burgess To: "Willgerodt, Felix" , "gdb-patches@sourceware.org" Subject: RE: [PATCHv4 00/10] x86/Linux Target Description Changes In-Reply-To: References: Date: Thu, 25 Apr 2024 17:06:11 +0100 Message-ID: <87frv9tojw.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org "Willgerodt, Felix" writes: >> -----Original Message----- >> From: Andrew Burgess >> Sent: Freitag, 5. April 2024 14:33 >> To: gdb-patches@sourceware.org >> Cc: Andrew Burgess >> Subject: [PATCHv4 00/10] x86/Linux Target Description Changes >> >> In v4: >> >> - I tried merging V3, but it turned out I broke pretty much >> everything that wasn't x86 based when configured with >> --enable-targets=all, >> >> - The problem was a failure to correctly split the shared code >> between the gdb/arch/ and gdb/nat/ directories, as a consequence, >> code which is needed on a non x86 based host to support x86 based >> targets wasn't available to the compilation, and the build failed, >> >> - In V4 I've gone through every patch and resplit the code in a way >> which I now believe is correct, I've done the following tests: >> >> + On a non x86 host I've built GDB to support only the current >> host as a target, to support all targets, and to support x86-64 >> and i386 linux targets, >> >> + On an i386 virtual machine I built GDB only for the host as a >> target, and for all targets. I regression tested the all targets >> build for unix, native-gdbserver, and native-extended-gdbserver, >> >> + On an x86-64 machine I've built GDB for only the current host as >> a target, and for all targets. I regression tested the all targets >> build for unix, native-gdbserver, and native-extended-gdbserver. >> >> - Only patches 6, 8, and 10 require significant review. All of the >> other patches are pretty trivial (though reviews always welcome). >> >> - I think there's more improvements that can be made to the x86 >> target description creation/lookup/caching. This series only >> changes the Linux lookup, and we still cache i386/amd64/x32 >> separately. >> >> In the future I think we can merge all x86 target description >> caching into a single data structure, this would be for all OS >> variants and all ABI variants. >> >> Though making that "grand unification" will certainly require some >> of the code in this series to change, I think the bulk of it will >> remain, and trying to do everything in one series is just going to >> result in an even larger series. I'd prefer to get these first >> patches merged, then come back to build on this work once this is >> merged and we know there's no problems with it. >> >> In v3: >> >> - Rebased. Nasty merge conflict with 4bb20a6244b7091 which I think >> I've resolved, but am unable to test. Reposting so the author of >> that other commit can validate. >> >> - Initial testing looks good. Full tests are still running. >> >> In v2: >> >> - Rebase to current upstream/master, no merge conflicts, >> >> - Retested. >> >> --- >> >> Andrew Burgess (10): >> gdbserver/ipa/x86: remove unneeded declarations >> gdbserver: convert have_ptrace_getregset to a tribool >> gdb/x86: move reading of cs and ds state into gdb/nat directory >> gdbserver/x86: move no-xml code earlier in x86_linux_read_description >> gdb/gdbserver: share I386_LINUX_XSAVE_XCR0_OFFSET definition >> gdb/gdbserver: share some code relating to target description creation >> gdb/arch: assert that X86_XSTATE_MPX is not set for x32 >> gdbserver: update target description creation for x86/linux >> gdb: move xcr0 == 0 check into i386_linux_core_read_description >> gdb/gdbserver: share x86/linux tdesc caching >> >> gdb/Makefile.in | 8 + >> gdb/amd64-linux-tdep.c | 32 +--- >> gdb/amd64-linux-tdep.h | 6 - >> gdb/arch/amd64-linux-tdesc.c | 61 +++++++ >> gdb/arch/amd64-linux-tdesc.h | 30 ++++ >> gdb/arch/amd64.c | 8 +- >> gdb/arch/i386-linux-tdesc.c | 51 ++++++ >> gdb/arch/i386-linux-tdesc.h | 29 ++++ >> gdb/arch/x86-linux-tdesc-features.c | 247 ++++++++++++++++++++++++++++ >> gdb/arch/x86-linux-tdesc-features.h | 62 +++++++ >> gdb/arch/x86-linux-tdesc.h | 37 +++++ >> gdb/configure.nat | 8 +- >> gdb/configure.tgt | 11 +- >> gdb/i386-linux-tdep.c | 42 ++--- >> gdb/i386-linux-tdep.h | 23 --- >> gdb/nat/x86-linux-tdesc.c | 120 ++++++++++++++ >> gdb/nat/x86-linux-tdesc.h | 60 +++++++ >> gdb/nat/x86-linux.c | 47 ++++++ >> gdb/nat/x86-linux.h | 28 ++++ >> gdb/x86-linux-nat.c | 123 ++------------ >> gdbserver/configure.srv | 11 ++ >> gdbserver/linux-amd64-ipa.cc | 50 ++---- >> gdbserver/linux-arm-low.cc | 6 +- >> gdbserver/linux-i386-ipa.cc | 26 +-- >> gdbserver/linux-low.cc | 2 +- >> gdbserver/linux-low.h | 2 +- >> gdbserver/linux-x86-low.cc | 192 +++++++-------------- >> gdbserver/linux-x86-tdesc.cc | 142 +--------------- >> gdbserver/linux-x86-tdesc.h | 56 ------- >> gdbsupport/x86-xstate.h | 20 +++ >> 30 files changed, 949 insertions(+), 591 deletions(-) >> create mode 100644 gdb/arch/amd64-linux-tdesc.c >> create mode 100644 gdb/arch/amd64-linux-tdesc.h >> create mode 100644 gdb/arch/i386-linux-tdesc.c >> create mode 100644 gdb/arch/i386-linux-tdesc.h >> create mode 100644 gdb/arch/x86-linux-tdesc-features.c >> create mode 100644 gdb/arch/x86-linux-tdesc-features.h >> create mode 100644 gdb/arch/x86-linux-tdesc.h >> create mode 100644 gdb/nat/x86-linux-tdesc.c >> create mode 100644 gdb/nat/x86-linux-tdesc.h >> delete mode 100644 gdbserver/linux-x86-tdesc.h >> >> >> base-commit: 16810e455feb26ef826a3ed876d6d7e6d24818b0 >> -- >> 2.25.4 > > > Hi Andrew, > > Thanks for doing this, I like what this does. > I am still in the middle of reviewing this. Though in first testing I saw > that I can't build a 32-bit gdbserver on Ubuntu 22.04. > I am building like this: > > export CFLAGS="-g -O0 -m32" > export CXXFLAGS="${CFLAGS} -m32" > export LDFLAGS="-m32" > > $src/gdb/configure \ > --build="x86_64-linux-gnu" \ > --host="i686-linux-gnu" \ > --disable-gdb > > make -s -j$(nproc) all-gdbserver > > Not sure if there is an easier way of doing this, but this works for master. > With your series I see this: > > CXX nat/x86-linux-tdesc.o > /gdb/gdbserver/../gdb/nat/x86-linux-tdesc.c: In function ?const target_desc* > x86_linux_tdesc_for_tid(int, tribool*, gdb::function_view, const char*, uint64_t*)?: > /gdb/gdbserver/../gdb/nat/x86-linux-tdesc.c:54:7: error: ?have_ptrace_getfpxregs? was not declared in this scope; > did you mean ?have_ptrace_getregset?? > 54 | if (have_ptrace_getfpxregs == -1) > | ^~~~~~~~~~~~~~~~~~~~~~ > | have_ptrace_getregset > /gdb/gdbserver/../gdb/nat/x86-linux-tdesc.c:56:7: error: ?elf_fpxregset_t? was not declared in this scope > 56 | elf_fpxregset_t fpxregs; > | ^~~~~~~~~~~~~~~ > In file included from /gdb/gdbserver/../gdb/nat/x86-linux-tdesc.c:29: > /gdb/gdbserver/../gdb/nat/x86-linux-tdesc.c:58:53: error: ?fpxregs? was not declared in this scope > 58 | if (ptrace (PTRACE_GETFPXREGS, tid, 0, (int) &fpxregs) < 0) > | ^~~~~~~ > /gdb/gdbserver/../gdb/nat/gdb_ptrace.h:142:57: note: in definition of macro ?ptrace? > 142 | ptrace ((PTRACE_TYPE_ARG1) request, pid, addr, data) > | ^~~~ > make[1]: *** [Makefile:577: nat/x86-linux-tdesc.o] Error 1 > make: *** [Makefile:13074: install-gdbserver] Error 2 > > I didn't investigate further yet, sorry. Thanks for bringing this to my attention. I'll investigate this tomorrow. Thanks, Andrew > > Regards, > Felix > Intel Deutschland GmbH > Registered Address: Am Campeon 10, 85579 Neubiberg, Germany > Tel: +49 89 99 8853-0, www.intel.de > Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva > Chairperson of the Supervisory Board: Nicole Lau > Registered Office: Munich > Commercial Register: Amtsgericht Muenchen HRB 186928