From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <1.41421@gmail.com> Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id D85CD3858D34 for ; Tue, 16 Jun 2020 19:42:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D85CD3858D34 Received: by mail-ej1-x62b.google.com with SMTP id n24so22994250ejd.0 for ; Tue, 16 Jun 2020 12:42:14 -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:from:date:message-id:subject:to; bh=l1Iaq1CtvhbltlUTpe/M++WU9HPjMwBLZVQCU5mcl+g=; b=LCw8r/ZpWWt9RhlvPAaDPGg6j9bDejAmDdBklA1Z2s8J4DPppKypCGv6v/UeoKMN+y BVWcInp4D6jnRb13lnb9oN256pVuYkswRoVxSf9ut7mJN/xzZV9xC31de6GS8XqzL6i4 TsktRlvPFd9UhlDXJOxHMZ3wlTGpzgV8iMqWV0hZ4rzYVNDd+w2GmK8pHoNxDJwtB1q+ CTj4BXJSWbUz4NCEdF651/q1A8p6eIpnO1X8V7i6kKvlAopKej7giJ8pou+Scb03oC9e WaCed5qk0mYwAmFX2SKEt1keTAsHP8An7p63ZbFG1bKF3uql2FNA2hbaM/cDT2dR1HrY SXIQ== X-Gm-Message-State: AOAM53049bqlfljZgTBvroth6KGSJ1WqyJBF9CqRoC2ouvp5TrABn8HB cPwP9xeeK+zujc2ysnYGqgLANJk35Zy+VfKG7ycmVhqDpQ== X-Google-Smtp-Source: ABdhPJy3Cr11AKAdmWJZDvq+9V+XHiJWF5HI/AOaZVbYaa2JLKh+sJEVL9i33zz2MJ8H3DejfZGpZkosA5BLa3OXEHM= X-Received: by 2002:a17:906:c837:: with SMTP id dd23mr4390698ejb.272.1592336533511; Tue, 16 Jun 2020 12:42:13 -0700 (PDT) MIME-Version: 1.0 From: Luveh Keraph <1.41421@gmail.com> Date: Tue, 16 Jun 2020 13:42:02 -0600 Message-ID: Subject: How to input decimal numbers when radix is set to hexadecimal To: gdb@sourceware.org X-Spam-Status: No, score=-2.1 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:42:16 -0000 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