From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <1.41421@gmail.com> Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by sourceware.org (Postfix) with ESMTPS id 15ED43858D34 for ; Tue, 16 Jun 2020 19:55:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 15ED43858D34 Received: by mail-ej1-x62c.google.com with SMTP id o15so22986307ejm.12 for ; Tue, 16 Jun 2020 12:55:45 -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; bh=rR61hfTLAInrMLjdl21sh16SxfhVzbAyLIHQFyqFiYQ=; b=b71s9TBm1qkWOdveV+qgSElgZGl4+KDnU7txoONdRT6TgbVLZGxhsdX/xy+CSy763n nWrEDf5N0cTaLC1KVvZ30YPtdmWpVN+eVcXdrAE0vkAYsdV5zCXCafbV8nPbetB8KCJE 1bNuHqjpbKBoTXrr9QT05i2ZVGoFqpG6QHDoikKtJpWrPyYuus8wCCNs3vENLmNrU/yR A/4sMnp3MXCcD6xTYp5VRJI9UNwtSYsWO0bBzpZuDAWRv1py8mioBW/mmPQ5K2mEZavF E+WL0KlK9SY6GaqFQPeD18QkQ7BVL7q26mV+znMwwocKLaapOUVepWzjKJAWTdGTSCYD spgQ== X-Gm-Message-State: AOAM533Z0UgS2cd1bLYlGBrSl/BELbqQNZidE45QsnkcJZfxf+1ZfiOe +fQCihCWXwEMz0LH0EKcdblkWjBNk4EERRISp4/gQ/XiFA== X-Google-Smtp-Source: ABdhPJw2OzZOVeNtL9Q67xLTeCZukG4WxO4P+1VrdQxdS/sPNmaQfIE78rskk7W7pHJAetzLoxVytRSOzohxNb2w5wo= X-Received: by 2002:a17:906:46d0:: with SMTP id k16mr4226460ejs.76.1592337343774; Tue, 16 Jun 2020 12:55:43 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Luveh Keraph <1.41421@gmail.com> Date: Tue, 16 Jun 2020 13:55:32 -0600 Message-ID: Subject: Re: How to input decimal numbers when radix is set to hexadecimal To: gdb@sourceware.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, HTML_MESSAGE, 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 Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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, 16 Jun 2020 19:55:46 -0000 Replying to myself, for I found out about it five minutes after I posted the question (and such a thing happens so often to me that I am beginning to wonder...) Here is how this works: (gdb) show radix Input and output radices set to decimal 10, hex a, octal 12. (gdb) set radix 16 Input and output radices now set to decimal 16, hex 10, octal 20. (gdb) p 017 $1 = 0xf (gdb) p 0d17 $2 = 0x11 On Tue, Jun 16, 2020 at 1:42 PM Luveh Keraph <1.41421@gmail.com> wrote: > I run my gdb sessions so that the input and output radix is hex: > > (gdb) show radix > Input and output radices set to decimal 16, hex 10, octal 20. > > Occasionally, I would like to input integers using some base other than > hex. The gdb documentation (Controlling GDB section, Numbers subsection) > says the following: > > "You can always enter numbers in octal, decimal, or hexadecimal in GDB by > the usual conventions: octal numbers begin with `0', decimal numbers end > with `.', and hexadecimal numbers begin with `0x'.". > > This works fine with the set radix command, but not with the print command > for numbers to base 10: > > (gdb) p 017 > $1 = 0xf > (gdb) p 17. > $2 = 17 > > This seems to be in contradiction with the paragraph that I quoted, for it > does not say that such conventions are constrained to the commands to set > the radix. This aside, with the settings that I have (input and output in > hex) is it possible to input integers so that they are interpreted by gdb > as integers to base 10, rather than 16? My expectation was that, given the > way it works for octal, we would be able to do the following: > > (gdb) p 17. > $2 = 11 > >