https://bugs.kde.org/show_bug.cgi?id=356174

--- Comment #2 from Daniel Trebbien <dtrebb...@gmail.com> ---
Created attachment 95853
  --> https://bugs.kde.org/attachment.cgi?id=95853&action=edit
Fix handling of an 'Hc-1' packet

Looking through the packets logged just before the segfault, I noticed that the
response to an 'Hc-1' packet was not correct.  For example:
<   8> send packet: $Hc-1#09
<   7> read packet: $E01#a6

This is due to two issues:
1. Within server_main(), `strtoul (&own_buf[2], NULL, 16);' actually expands to
a call to VG_(strtoull16).  However, unlike the standard C library strtoul()
routine, VG_(strtoull16) did not support a minus sign.
2. gdb_id_to_thread_id() does not handle the case where the gdb thread ID is -1
(which means "all threads" in this case: 
https://sourceware.org/gdb/current/onlinedocs/gdb/Packets.html#Packets ).

The attached patch adds minus sign and overflow handling to VG_(strtoull10) and
VG_(strtoull16) so that their behavior is closer to the standard strtoull()
function: 
http://pubs.opengroup.org/onlinepubs/000095399/functions/strtoull.html
The patch also modifies server_main() to handle the case where `gdb_id' is
`(unsigned long)-1'.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to