public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/15683] New: breakpoint adjustment warning truncates addresses
@ 2013-06-26 16:10 palves at redhat dot com
  2013-06-26 16:52 ` [Bug breakpoints/15683] " tromey at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: palves at redhat dot com @ 2013-06-26 16:10 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15683

            Bug ID: 15683
           Summary: breakpoint adjustment warning truncates addresses
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: breakpoints
          Assignee: unassigned at sourceware dot org
          Reporter: palves at redhat dot com

$ grep hex_string_custom * | grep long

finds:

breakpoint.c:  /* The longest string possibly returned by hex_string_custom
breakpoint.c:  strcpy (astr1, hex_string_custom ((unsigned long) from_addr,
8));
breakpoint.c:  strcpy (astr2, hex_string_custom ((unsigned long) to_addr, 8));

Those casts are bogus:

static void
breakpoint_adjustment_warning (CORE_ADDR from_addr, CORE_ADDR to_addr,
                               int bnum, int have_bnum)
{
  /* The longest string possibly returned by hex_string_custom
     is 50 chars.  These must be at least that big for safety.  */
  char astr1[64];
  char astr2[64];

  strcpy (astr1, hex_string_custom ((unsigned long) from_addr, 8));
  strcpy (astr2, hex_string_custom ((unsigned long) to_addr, 8));
  if (have_bnum)
    warning (_("Breakpoint %d address previously adjusted from %s to %s."),
             bnum, astr1, astr2);
  else
    warning (_("Breakpoint address adjusted from %s to %s."), astr1, astr2);
}

on a 32-bit hosts x 64-bit target scenario, those casts truncate the addresses
to 32-bit.

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug breakpoints/15683] breakpoint adjustment warning truncates addresses
  2013-06-26 16:10 [Bug breakpoints/15683] New: breakpoint adjustment warning truncates addresses palves at redhat dot com
@ 2013-06-26 16:52 ` tromey at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: tromey at redhat dot com @ 2013-06-26 16:52 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15683

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at redhat dot com

--- Comment #1 from Tom Tromey <tromey at redhat dot com> ---
If you change this code you might as well also remove the strcpy
calls.  The return values from hex_string_custom can be used as-is.

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-26 16:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-26 16:10 [Bug breakpoints/15683] New: breakpoint adjustment warning truncates addresses palves at redhat dot com
2013-06-26 16:52 ` [Bug breakpoints/15683] " tromey at redhat dot com

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).