Proposal for customization of output of "to_pid_to_str" op in remote.c.

Nat Gurumoorthy natg@ubicom.com
Tue Dec 10 16:17:00 GMT 2002


HI all,
   This is a proposal to allow targets using the remote backend to
customize the output of "to_pid_to_str" operations.  The changes to
src/gdb/remote.c would be as follows:

/* Convert a thread ID to a string.  Returns the string in a static
   buffer.  */

static char *
remote_pid_to_str (ptid_t ptid)
{
  static char buf[30];

#ifndef REMOTE_PID_TO_STR
  sprintf (buf, "Thread %d", PIDGET (ptid));
#else
  REMOTE_PID_TO_STR(buf, ptid, 30);
#endif
  return buf;
}



In the target "tm-XXXX.h"

extern void my_target_pid_to_str(char *buf, ptid_t ptid, unsigned int buflength);
#define REMOTE_PID_TO_STR(buf, ptid, buflength) my_target_pid_to_str(buf, ptid, buflength)


In the target "target-tdep.c" file

void
my_target_pid_to_str(char *buf, ptid_t ptid, unsigned int buflength)
{
  /* sprintf some sensible string into the provided buffer */
  ..
  ..
  ..
}


Currently remote.c provides all the facilities for multithreaded
debugging except for a way to print a customized name for that thread.

Is this the proper forum to discuss this idea? Do I have to file a PR
and mark it as an enhancement request? 

I'd like some feedback on this proposal. Is this going to screw up
multi arch support?

Regards
Nat



More information about the Gdb mailing list