Kaynağa Gözat

* Remove old stackdump code. It had no worth.

Bryan Drewery 17 yıl önce
ebeveyn
işleme
83702d4995
3 değiştirilmiş dosya ile 0 ekleme ve 65 silme
  1. 0 4
      src/cmds.c
  2. 0 60
      src/debug.c
  3. 0 1
      src/debug.h

+ 0 - 4
src/cmds.c

@@ -1937,10 +1937,6 @@ static void cmd_debug(int idx, char *par)
     tell_netdebug(idx);
   if (!cmd || (cmd && !strcmp(cmd, "dns")))
     tell_dnsdebug(idx);
-#if !defined(CYGWIN_HACKS) && defined(__i386__)
-  if (!cmd || (cmd &&!strcmp(cmd, "stackdump")))
-    stackdump(0);
-#endif /* !CYGWIN_HACKS */
 }
 
 static void cmd_timers(int idx, char *par)

+ 0 - 60
src/debug.c

@@ -277,65 +277,6 @@ static void got_bus(int z)
 #endif /* DEBUG */
 }
 
-#ifndef CYGWIN_HACKS
-#ifdef __i386__
-#ifndef PAGESIZE
-#define PAGESIZE 4096
-#endif
-
-struct stackframe {
-  struct stackframe *ebp;
-  unsigned long addr;
-};
-
-/*
-  CALL x
-  PUSH EBP
-  MOV EBP, ESP
-
-  0x10: EBP
-  0x14: EIP
-
- */
-
-static int
-canaccess(void *addr)
-{
-  addr = (void *) (((unsigned long) addr / PAGESIZE) * PAGESIZE);
-  if (mprotect(addr, PAGESIZE, PROT_READ | PROT_WRITE | PROT_EXEC))
-    if (errno != EACCES)
-      return 0;
-  return 1;
-}
-
-struct stackframe *sf = NULL;
-int stackdepth = 0;
-
-void
-stackdump(int idx)
-{
-  __asm__("movl %EBP, %EAX");
-  __asm__("movl %EAX, sf");
-  if (idx == 0)
-    putlog(LOG_MISC, "*", "STACK DUMP");
-  else
-    dprintf(idx, "STACK DUMP\n");
-
-  while (canaccess(sf) && stackdepth < 20 && sf->ebp) {
-    if (idx == 0)
-      putlog(LOG_MISC, "*", " %02d: 0x%08lx/0x%08lx", stackdepth, (unsigned long) sf->ebp, sf->addr);
-    else
-      dprintf(idx, " %02d: 0x%08lx/0x%08lx\n", stackdepth, (unsigned long) sf->ebp, sf->addr);
-    sf = sf->ebp;
-    stackdepth++;
-  }
-  stackdepth = 0;
-  sf = NULL;
-  sleep(1);
-}
-#endif /* __i386__ */
-#endif /* !CYGWIN_HACKS */
-
 #ifndef DEBUG
 static void got_segv(int) __attribute__ ((noreturn));
 #endif /* DEBUG */
@@ -345,7 +286,6 @@ static void got_segv(int z)
   segfaulted = 1;
   alarm(0);		/* dont let anything jump out of this signal! */
   signal(SIGSEGV, SIG_DFL);
-  /* stackdump(0); */
 #ifdef DEBUG_CONTEXT
   write_debug();
 #endif

+ 0 - 1
src/debug.h

@@ -32,7 +32,6 @@
 
 extern bool		sdebug, segfaulted;
 
-void stackdump(int);
 void setlimits();
 void sdprintf (const char *, ...) __attribute__((format(printf, 1, 2)));
 void init_signals();