From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 51044382CC27 for ; Tue, 17 Aug 2021 13:49:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 51044382CC27 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-221-DkwlG4VtNTWiRfzZIg2cNw-1; Tue, 17 Aug 2021 09:48:56 -0400 X-MC-Unique: DkwlG4VtNTWiRfzZIg2cNw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C6A74801AC0; Tue, 17 Aug 2021 13:48:55 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.194.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E02B560C17; Tue, 17 Aug 2021 13:48:54 +0000 (UTC) From: Florian Weimer To: "H.J. Lu via Gdb-patches" Cc: GNU C Library , "H.J. Lu" Subject: Re: [PATCH v2] gdbserver: Check r_version < 1 for Linux debugger interface References: Date: Tue, 17 Aug 2021 15:48:53 +0200 In-Reply-To: (H. J. Lu via Gdb-patches's message of "Mon, 16 Aug 2021 15:02:37 -0700") Message-ID: <87sfz85ghm.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=unavailable autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 13:49:01 -0000 * 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. Thanks, Florian