Stop threads when attaching to a PID that is the tgid.
[deliverable/binutils-gdb.git] / gdb / gdbserver / utils.c
index 45d032cd9d3e7cc4e9543926672c70593a05a0f9..f804ced1ea170eafc830ede3a12b645d4805613b 100644 (file)
 
 /* Generally useful subroutines used throughout the program.  */
 
-static void malloc_failure (size_t size) ATTR_NORETURN;
-
-static void
-malloc_failure (size_t size)
+void
+malloc_failure (long size)
 {
   fprintf (stderr,
           PREFIX "ran out of memory while trying to allocate %lu bytes\n",
@@ -46,61 +44,6 @@ malloc_failure (size_t size)
   exit (1);
 }
 
-/* Allocate memory without fail.
-   If malloc fails, this will print a message to stderr and exit.  */
-
-void *
-xmalloc (size_t size)
-{
-  void *newmem;
-
-  if (size == 0)
-    size = 1;
-  newmem = malloc (size);
-  if (!newmem)
-    malloc_failure (size);
-
-  return newmem;
-}
-
-/* Reallocate memory without fail.  This works like xmalloc. */
-
-void *
-xrealloc (void *ptr, size_t size)
-{
-  void *val;
-
-  if (size == 0)
-    size = 1;
-
-  if (ptr != NULL)
-    val = realloc (ptr, size); /* OK: realloc */
-  else
-    val = malloc (size);       /* OK: malloc */
-  if (val == NULL)
-    malloc_failure (size);
-
-  return val;
-}
-
-/* Allocate memory without fail and set it to zero.
-   If malloc fails, this will print a message to stderr and exit.  */
-
-void *
-xcalloc (size_t nelem, size_t elsize)
-{
-  void *newmem;
-
-  if (nelem == 0 || elsize == 0)
-    nelem = elsize = 1;
-
-  newmem = calloc (nelem, elsize);
-  if (!newmem)
-    malloc_failure (nelem * elsize);
-
-  return newmem;
-}
-
 /* Copy a string into a memory buffer.
    If malloc fails, this will print a message to stderr and exit.  */
 
@@ -239,22 +182,6 @@ get_cell (void)
   return buf[cell];
 }
 
-/* Stdarg wrapper around vsnprintf.
-   SIZE is the size of the buffer pointed to by STR.  */
-
-int
-xsnprintf (char *str, size_t size, const char *format, ...)
-{
-  va_list args;
-  int ret;
-
-  va_start (args, format);
-  ret = vsnprintf (str, size, format, args);
-  va_end (args);
-
-  return ret;
-}
-
 static char *
 decimal2str (char *sign, ULONGEST addr)
 {
@@ -263,19 +190,16 @@ decimal2str (char *sign, ULONGEST addr)
   unsigned long temp[3];
   char *str = get_cell ();
   int i = 0;
-  int width;
+  int width = 9;
 
   do
     {
       temp[i] = addr % (1000 * 1000 * 1000);
       addr /= (1000 * 1000 * 1000);
       i++;
-      width -= 9;
     }
   while (addr != 0 && i < (sizeof (temp) / sizeof (temp[0])));
 
-  width = 9;
-
   switch (i)
     {
     case 1:
This page took 0.160423 seconds and 4 git commands to generate.