From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8465 invoked by alias); 24 Jul 2013 16:09:55 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 8431 invoked by uid 89); 24 Jul 2013 16:09:54 -0000 X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,RDNS_NONE,SPF_PASS autolearn=ham version=3.3.1 Received: from Unknown (HELO mail-qa0-f43.google.com) (209.85.216.43) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 24 Jul 2013 16:09:54 +0000 Received: by mail-qa0-f43.google.com with SMTP id cl20so1994693qab.16 for ; Wed, 24 Jul 2013 09:09:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=VgPq3ORUw2hoieICwlMGL1+qny9fopb8eHWQrtyTsy4=; b=nyrcaV2cvkH7bHL+5MCgEFIYf+VkTCqy1Rn+VrNHyHbOVit+KJLz3KUbY3ZtiQXi1K C3JYRJzl14QsGRFOpF82E0LtPNu60v7M9vy+eutrCq9H29071uYU+jcf6/ySgi1MIyHa FBvFnRGRXXmI+l6ztmOfKtCROMAliD+nY3C6NMyGCAhyFqpiNIDowQJPKa19trqijPaY OXqpfcGkb2+rrzgCLqm6KltaoDcE1pb00bwcr9y4Z/vRsRyoOiy46mj0mF4kmurYyic7 EvMsA2ef35mgEb9Nh1AVoIY6PomL7TmqQms8aEgF1W9xJJdZVvykPbs2Ab5ICxqv5rB+ fTjQ== MIME-Version: 1.0 X-Received: by 10.224.52.1 with SMTP id f1mr45350584qag.77.1374682183296; Wed, 24 Jul 2013 09:09:43 -0700 (PDT) Received: by 10.229.118.199 with HTTP; Wed, 24 Jul 2013 09:09:43 -0700 (PDT) In-Reply-To: <51EFE5C0.60706@redhat.com> References: <87r4f8oxo3.fsf@karetnikov.org> <51EFE5C0.60706@redhat.com> Date: Wed, 24 Jul 2013 16:09:00 -0000 Message-ID: Subject: Re: Debugging 64-bit programs using 32-bit GDB From: Doug Evans To: Pedro Alves Cc: Nikita Karetnikov , gdb Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQkTktcsT9RM4+1GdkW5ZAx8UaHIFj6m92UCLleG2Mx11r8fG90MUU5HXm4AlBZg3w76t4+EQgYSBRzCKim441SN5lZhJKNf5EyBQ67WriGGAcQGVeOhpQufrkv7rTYNN5Gq18VpcnpARTXDw0B74gw/E7cjQbA8DdiT/FN49wzayWdM+TobaLebVVRuFL6fVI26dElw X-SW-Source: 2013-07/txt/msg00086.txt.bz2 On Wed, Jul 24, 2013 at 7:33 AM, Pedro Alves wrote: > On 07/09/2013 11:06 AM, Nikita Karetnikov wrote: >> Is it possible to debug a 64-bit executable ('bin/guile' [1]) using >> 32-bit GDB? (I use GNU/Linux.) > > I don't think so. The ptrace registers interfaces allow retrieving > the right register sets (at least the modern interfaces), but > things like breakpoints, etc. won't work, as the 32-bit GDB won't > be able to handle the inferior's 64-bit addresses (due to how ptrace > works). Last I checked, Power had extra ptrace interfaces for that. > Don't know about MIPS. > > (you can however connect a 32-bit GDB to a 64-bit GDBserver, and use > that to debug a 64-bit program, though that's more trouble > than just using a 64-bit GDB.). > >> >> I've tried to configure GDB 7.6 with '--enable-64-bit-bfd' (see [2]), >> but it still shows "mips-tdep.c:709: internal-error: bad register >> size". > > The x86_64 port catches the case early and bails out (amd64_linux_read_description): > > if (sizeof (void *) == 4 && is_64bit && !is_x32) > error (_("Can't debug 64-bit process with 32-bit GDB")); [filed for reference sake] Alas basic 32-bit linux builds of gdb don't compile amd64-linux-nat.c. It would be really nice to print a better error message than the following for 32-bit gdb debugging 64-bit executable: "/tmp/hello.x64": not in executable format: File format not recognized It's a not uncommon failure mode. Hmmm, amd64-linux-nat.c is not compiled even if I do --enable-targets=all --enable-64-bit-bfd. When does the above error get triggered?