From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) by sourceware.org (Postfix) with ESMTPS id 49645385BF83 for ; Tue, 14 Apr 2020 12:37:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 49645385BF83 Received: by mail-qk1-x72b.google.com with SMTP id y3so12912780qky.8 for ; Tue, 14 Apr 2020 05:37: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:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=CEk/QsofgM5x5q11W9AYYKc+J2F2fAd4SAlkCcnFX7A=; b=X/JJloeP6wTvril2ZWq/wSKinjY9XBUf9ojUJxjzvY/ohboABM0y1lb5ldopYQ9G50 8l6bce4BkYwUuQIUf3yKWMwmMZCvkchjU/z2f6q3+/xNmpiiy+P3kBPiBHpRTQEUN+uc Nqhq4wYDQhoNeJ3bXpcDpdZEqK+JIdjYgf8eBNtHs7TZ38apUkN06DR0xghRh47bJjJT UAicL1XPULkSwA9sNNcna2EOeIVpfqBQO1i4syWL/BipP+8TptWInd/fBuWf8xSRwg9I yq5VZuo36Z7tsrI41/HVQeMIvzOg+v9CkatVIecH3FDmtFzP1z3tJJCQAEMRNUOR9TOj kXyQ== X-Gm-Message-State: AGi0PuZ0cGhTtgjMyeB+gVDJ26j8jpj/Z3z203s8OpvREosB76OWbeQw yfK6jqZ6mShn0sHjLaDXbIlnlCr4aUs= X-Google-Smtp-Source: APiQypI5kAwvsa7IryNNjPhvTgQdBN2DOnzclqD8yV1fsKv3MBNFP1M3wY8Qd9j78f95k/AuvPx0yg== X-Received: by 2002:a37:b786:: with SMTP id h128mr20670272qkf.92.1586867821221; Tue, 14 Apr 2020 05:37:01 -0700 (PDT) Received: from [192.168.0.181] ([191.249.229.71]) by smtp.gmail.com with ESMTPSA id f188sm10272758qkd.101.2020.04.14.05.36.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Apr 2020 05:37:00 -0700 (PDT) Subject: Re: Specifying target endianness via Remote Serial Protocol To: Omer Cc: gdb@sourceware.org References: From: Luis Machado Message-ID: <6addc629-36c9-45ec-ae6d-f300ff810c31@linaro.org> Date: Tue, 14 Apr 2020 09:36:57 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Apr 2020 12:37:03 -0000 Hi, On 4/14/20 7:45 AM, Omer wrote: > Will older gdb's really break if we send them fields they don't know? > The logical thing to do seems to me to just to discard them. > I want to use remote gdb without giving it an elf to work with locally > (for example if I want to debug some weird embedded system). > I can somewhat circumvent the problem by giving gdb an empty elf with my > wanted endianness, but I don't think it's the optimal solution. Indeed it seems we properly discard unknown fields. I may have misremembered some buggy behavior at some point. There is some indication in the dtd in gdb/features: I also gave it a try by forcing an endian entry in the XML description. So it seems we only need to tweak the XML machinery to accept such a field and pass it on to the architecture initialization code. > > On Mon, 13 Apr 2020 at 16:04, Luis Machado > wrote: > > Hi, > > On 4/12/20 9:02 AM, Omer via Gdb wrote: > > Hi, > > > > While writing my own gdb stub, I noticed that there is no way to > specify > > what endianness the target is using (I guess the logical place > for that > > would be in the target.xml file). > > One can use "set endian" manually to fix that, but when debugging > an ARM > > BE8 target, there is no way to specify that the code is little endian > > (currently byte_order_for_code is initialized to little only when > loading a > > BE8 elf). > > Shouldn't there be an additional field for target XML tag to > specify that? > > We could probably extend the XML descriptions to incorporate this, but > we may also have backwards compatibility issues with older GDB's by > returning new fields the target doesn't know how to parse properly. > > The way to fix this, right now, would be to teach GDB about other arch > variations using little endian, so GDB initializes the proper set of > architecture hooks and types. > > What arch variation are you working with? Doesn't the tools generate a > EF_ARM_BE8 flag to let GDB know it needs to assume little endian? >