This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/9755] New: Thread id printed in negative


gdb 6.8 (i386) prints thread ids as a negative number. Some example : 

  6 Thread -1564525664 (LWP 28902)  0x002287a2 in _dl_sysinfo_int80 () from
/lib/ld-linux.so.2
  5 Thread -1599468640 (LWP 30488)  0x002287a2 in _dl_sysinfo_int80 () from
/lib/ld-linux.so.2
  4 Thread -1634944096 (LWP 30536)  0x002287a2 in _dl_sysinfo_int80 () from
/lib/ld-linux.so.2

Actually it is pthread_t , which is unsigned long. A small glitch in the
following code : 

linux-thread-db.c : 

static char *
thread_db_pid_to_str (ptid_t ptid)
{
  if (is_thread (ptid)) 
    {
      static char buf[64];
      struct thread_info *thread_info;

      thread_info = find_thread_pid (ptid); 
      if (thread_info == NULL)
        snprintf (buf, sizeof (buf), "Thread 0x%lx (LWP %ld) (Missing)",
                  GET_THREAD (ptid), GET_LWP (ptid));
      else    
        snprintf (buf, sizeof (buf), "Thread 0x%lx (LWP %ld)",
                  GET_THREAD (ptid), GET_LWP (ptid));

      return buf;
    }

  if (target_beneath->to_pid_to_str (ptid)) 
    return target_beneath->to_pid_to_str (ptid); 

  return normal_pid_to_str (ptid); 
}

%ld is wrong. It should be %lu. 

It is kind of fixed in 6.8 with a %lx , rather can we print it in %lu format
itself ? 

Also , another good feature will be to select a particular thread using thread
id or lwp id.

-- 
           Summary: Thread id printed in negative
           Product: gdb
           Version: 6.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: naaaag at gmail dot com
                CC: gdb-prs at sourceware dot org


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]