public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "tromey at sourceware dot org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug cli/24124] Command `b *804874e` sets breakpoint at 0xc480a - hex value of 804874
Date: Sat, 03 Sep 2022 21:15:14 +0000	[thread overview]
Message-ID: <bug-24124-4717-S9H7RlXXkC@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-24124-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=24124

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to Enze Li from comment #2)

> "804874e" is parsed as a floating point number because "en" stands for
> "10^n".  If there is no decimal number after "e", "e" will be ignored.  "d"
> and "f" are not as special as "e", that is why breakpoint address with a "d"
> or "f" are recognized as illegal.  This is my understanding.

I think gdb's lexing here is weird, because it disagrees with C:

prentzel. gcc --syntax-only q.c
q.c:1:11: error: exponent has no digits
    1 | float x = 80e;
      |           ^~~

(gdb) print 80e
$1 = 80
(gdb) ptype 80e
type = double

So not treating this as floating point (and rejecting the parse)
might be fine.

> In GDB, do users usually use decimal numbers to define the address of
> breakpoints?

No but nothing prohibits it.

> Or, if only hexadecimal numbers are used to set the breakpoint
> address, how about we restrict the value of the address to start with 0x?

That's harder than it sounds because the text after the "*" is an
arbitrary expression, not just an integer.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2022-09-03 21:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-24124-4717@http.sourceware.org/bugzilla/>
2022-09-03 13:43 ` lienze at sourceware dot org
2022-09-03 21:15 ` tromey at sourceware dot org [this message]
2022-09-04  8:45 ` lienze at sourceware dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-24124-4717-S9H7RlXXkC@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).