From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS17314 8.43.84.0/22 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,RDNS_DYNAMIC,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id DC0B31F8C6 for ; Tue, 17 Aug 2021 14:05:51 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7AD723971C06 for ; Tue, 17 Aug 2021 14:05:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7AD723971C06 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1629209150; bh=iaSNhNICdw4WZyKe8h7TDcZSEK6rVl7hCI3MM9a02zE=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=oOgJxE+Yh/TU/zz07cmG2311VyzrIo7aISKUJzCRCPL6wHQ57dvgEVxNMj3eykqPz Um//XJiMNXQ0rhEh7fFTr9zUa+h5aSHmvyhbE1YztmzyxusgiRSoM5L6a856MaRRfd vpZzmhrLDeaACMuqKBKzwOe7Y+gRer2n7mDizHWk= Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by sourceware.org (Postfix) with ESMTPS id 99E793971C06; Tue, 17 Aug 2021 14:05:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 99E793971C06 Received: by mail-pj1-x1030.google.com with SMTP id cp15-20020a17090afb8fb029017891959dcbso5389408pjb.2; Tue, 17 Aug 2021 07:05:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=iaSNhNICdw4WZyKe8h7TDcZSEK6rVl7hCI3MM9a02zE=; b=UBpUe5eQEDGK8/M0zNUPIP/vpkYemn3VSHOthb/WsYz0bscLELmyJAcW8Q6W24lggL 2UI/dm3uRNbftu0w3qQ31wRmIsm/b0mHur84lYjOw5iPOjJ9pJ5Y3a2Maqa8faK+nDhe 8wkMkvA8HYSu/MMcwcqtnSkXKc6HUkP7550uxVKqWuUc+NHA9xRAzsW3qB7wNBA3KuOm Ga40DSSYBB9XT7cZxy9eJczQgbmKURtZJRykwoM33Q+v/hyIX3acjI5NlOthvxNbcAfe 1NQagXxYtI35+VOy+0zEd+ZWsBKBw1bbyXKvGstbjgBO8tyI06Ao30DWoVVHB9DBxNTV XFrw== X-Gm-Message-State: AOAM533dPr+sXTkOwuwDOuNuhBCucdc3Ve5gn7gNKTgNhEGiEisOFkdu +184O8Lt+5Cf0TDVcEGurJyl+zF1lwbW0DCYMJA= X-Google-Smtp-Source: ABdhPJxsMm8WCI/Uuf3OH5Wrw+Vy5+IcI/A2KzbZGzXhRCMF0KwFN5O0cNzwiFhXLPf6gqybCNU83hQ0X/vfq93igyM= X-Received: by 2002:a17:90b:30d0:: with SMTP id hi16mr3824548pjb.154.1629209101705; Tue, 17 Aug 2021 07:05:01 -0700 (PDT) MIME-Version: 1.0 References: <87sfz85ghm.fsf@oldenburg.str.redhat.com> In-Reply-To: <87sfz85ghm.fsf@oldenburg.str.redhat.com> Date: Tue, 17 Aug 2021 07:04:25 -0700 Message-ID: Subject: Re: [PATCH v2] gdbserver: Check r_version < 1 for Linux debugger interface To: Florian Weimer Content-Type: text/plain; charset="UTF-8" X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "H.J. Lu via Libc-alpha" Reply-To: "H.J. Lu" Cc: GNU C Library , "H.J. Lu via Gdb-patches" Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" On Tue, Aug 17, 2021 at 6:48 AM Florian Weimer wrote: > > * H. J. Lu via Gdb-patches: > > > Set r_version == 2 breaks GDB due to > > > > static CORE_ADDR > > solib_svr4_r_ldsomap (struct svr4_info *info) > > { > > struct link_map_offsets *lmo = svr4_fetch_link_map_offsets (); > > struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr; > > enum bfd_endian byte_order = type_byte_order (ptr_type); > > ULONGEST version = 0; > > > > try > > { > > /* Check version, and return zero if `struct r_debug' doesn't have > > the r_ldsomap member. */ > > version > > = read_memory_unsigned_integer (info->debug_base + > > lmo->r_version_offset, > > lmo->r_version_size, byte_order); > > } > > catch (const gdb_exception_error &ex) > > { > > exception_print (gdb_stderr, ex); > > } > > > > if (version < 2 || lmo->r_ldsomap_offset == -1) > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > > > glibc doesn't have r_ldsomap. But r_ldsomap_offset is set > > unconditionally. Shouldn't it be set only if the target debugger > > interface has it? > > glibc should add r_ldsomap_offset and switch its own version number to > 3, I think. We can add an OS flavor field to struct link_map_offsets for this. -- H.J.