Commit 3eb89949 authored by sewardj's avatar sewardj

[project @ 2001-10-26 11:33:13 by sewardj]

merge from stable, rev 1.60.2.10:

  Implement a debugging aid: look in GHCi's object symbol tables for
  symbols within DELTA bytes of the specified address, and show their
  names.  Only compiled with -DDEBUG.  The new fn is called ghci_enquire
  and you can call it from within a gdb session.
parent c2867d09
/* -----------------------------------------------------------------------------
* $Id: Linker.c,v 1.71 2001/10/22 22:55:31 sof Exp $
* $Id: Linker.c,v 1.72 2001/10/26 11:33:13 sewardj Exp $
*
* (c) The GHC Team, 2000, 2001
*
......@@ -577,6 +577,42 @@ lookupLocalSymbol( ObjectCode* oc, char *lbl )
}
/* -----------------------------------------------------------------------------
* Debugging aid: look in GHCi's object symbol tables for symbols
* within DELTA bytes of the specified address, and show their names.
*/
#ifdef DEBUG
void ghci_enquire ( char* addr );
void ghci_enquire ( char* addr )
{
int i;
char* sym;
char* a;
const int DELTA = 64;
ObjectCode* oc;
for (oc = objects; oc; oc = oc->next) {
for (i = 0; i < oc->n_symbols; i++) {
sym = oc->symbols[i];
if (sym == NULL) continue;
/* fprintf(stderr, "enquire %p %p\n", sym, oc->lochash); */
a = NULL;
if (oc->lochash != NULL)
a = lookupStrHashTable(oc->lochash, sym);
if (a == NULL)
a = lookupStrHashTable(symhash, sym);
if (a == NULL) {
/* fprintf(stderr, "ghci_enquire: can't find %s\n", sym); */
}
else if (addr-DELTA <= a && a <= addr+DELTA) {
fprintf(stderr, "%p + %3d == `%s'\n", addr, a - addr, sym);
}
}
}
}
#endif
/* -----------------------------------------------------------------------------
* Load an obj (populate the global symbol table, but don't resolve yet)
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment