+ register struct nlist *sp, *ep;
+ register struct nlist *sym = (struct nlist *)cursym;
+ unsigned long sodiff = -1UL, lndiff = -1UL, ln = 0;
+ char *fname = NULL;
+
+ sp = (struct nlist *)symtab->start;
+ ep = (struct nlist *)symtab->end;
+
+/* XXX - gcc specific */
+#define NEWSRC(str) ((str) != NULL && \
+ (str)[0] == 'g' && strcmp((str), "gcc_compiled.") == 0)
+
+ for (; sp < ep; sp++) {
+
+ /*
+ * Prevent bogus linenumbers in case module not compiled
+ * with debugging options
+ */
+#if 0
+ if (sp->n_value <= off && (off - sp->n_value) <= sodiff &&
+ NEWSRC(sp->n_un.n_name)) {
+#endif
+ if ((sp->n_type & N_TYPE) == N_FN || NEWSRC(sp->n_un.n_name)) {
+ sodiff = lndiff = -1UL;
+ ln = 0;
+ fname = NULL;
+ }
+
+ if (sp->n_type == N_SO) {
+ if (sp->n_value <= off && (off - sp->n_value) < sodiff) {
+ sodiff = off - sp->n_value;
+ fname = sp->n_un.n_name;
+ }
+ continue;
+ }
+
+ if (sp->n_type != N_SLINE)
+ continue;
+
+ if (sp->n_value > off)
+ break;
+
+ if (off - sp->n_value < lndiff) {
+ lndiff = off - sp->n_value;
+ ln = sp->n_desc;
+ }
+ }
+
+ if (fname != NULL && ln != 0) {
+ *filename = fname;
+ *linenum = ln;
+ return TRUE;
+ }
+