[Git][NTPsec/ntpsec][master] 2 commits: libisc: we have no symbol table, so symbol never found.

Gary E. Miller gitlab at mg.gitlab.com
Sat May 27 03:41:05 UTC 2017


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
e8ccde51 by Gary E. Miller at 2017-05-26T20:34:32-07:00
libisc: we have no symbol table, so symbol never found.

More dead end code gone.

- - - - -
51d44dba by Gary E. Miller at 2017-05-26T20:40:05-07:00
libisc: we never have a symbol table, remove isc_backtrace_getsymbol()

- - - - -


3 changed files:

- libisc/assertions.c
- libisc/backtrace.c
- libisc/include/isc/backtrace.h


Changes:

=====================================
libisc/assertions.c
=====================================
--- a/libisc/assertions.c
+++ b/libisc/assertions.c
@@ -109,15 +109,8 @@ default_callback(const char *file, int line, isc_assertiontype_t type,
 			unsigned long offset;
 
 			fname = NULL;
-			result = isc_backtrace_getsymbol(tracebuf[i], &fname,
-							 &offset);
-			if (result == ISC_R_SUCCESS) {
-				fprintf(stderr, "#%d %p in %s()+0x%lx\n", i,
-					tracebuf[i], fname, offset);
-			} else {
-				fprintf(stderr, "#%d %p in ??\n", i,
-					tracebuf[i]);
-			}
+			fprintf(stderr, "#%d %p in ??\n", i,
+				tracebuf[i]);
 		}
 	}
 	fflush(stderr);


=====================================
libisc/backtrace.c
=====================================
--- a/libisc/backtrace.c
+++ b/libisc/backtrace.c
@@ -209,68 +209,3 @@ isc_backtrace_gettrace(void **addrs, int maxaddrs, int *nframes) {
 }
 #endif
 
-static int
-symtbl_compare(const void *addr, const void *entryarg) {
-	const isc_backtrace_symmap_t *entry = entryarg;
-	const isc_backtrace_symmap_t *end;
-
-        /* wow, this code never runs... */
-	if ( 0 >= isc__backtrace_nsymbols) 
-                  return -1;
-
-	end = &isc__backtrace_symtable[isc__backtrace_nsymbols - 1];
-
-	if (isc__backtrace_nsymbols == 1 || entry == end) {
-		if (addr >= entry->addr) {
-			/*
-			 * If addr is equal to or larger than that of the last
-			 * entry of the table, we cannot be sure if this is
-			 * within a valid range so we consider it valid.
-			 */
-			return (0);
-		}
-		return (-1);
-	}
-
-	/* entry + 1 is a valid entry from now on. */
-	if (addr < entry->addr)
-		return (-1);
-	else if (addr >= (entry + 1)->addr)
-		return (1);
-	return (0);
-}
-
-isc_result_t
-isc_backtrace_getsymbol(const void *addr, const char **symbolp,
-			unsigned long *offsetp)
-{
-	isc_result_t result = ISC_R_SUCCESS;
-	isc_backtrace_symmap_t *found;
-
-	/*
-	 * Validate the arguments: intentionally avoid using REQUIRE().
-	 * See notes in backtrace.h.
-	 */
-	if (symbolp == NULL || *symbolp != NULL || offsetp == NULL)
-		return (ISC_R_FAILURE);
-
-	if (isc__backtrace_nsymbols < 1)
-		return (ISC_R_NOTFOUND);
-
-	/*
-	 * Search the table for the entry that meets:
-	 * entry.addr <= addr < next_entry.addr.
-	 */
-	found = bsearch(addr, isc__backtrace_symtable,
-                        (size_t) isc__backtrace_nsymbols,
-			sizeof(isc__backtrace_symtable[0]), symtbl_compare);
-	if (found == NULL)
-		result = ISC_R_NOTFOUND;
-	else {
-		*symbolp = found->symbol;
-		*offsetp = (unsigned long)((const char *)addr \
-                                           - (char *)found->addr);
-	}
-
-	return (result);
-}


=====================================
libisc/include/isc/backtrace.h
=====================================
--- a/libisc/include/isc/backtrace.h
+++ b/libisc/include/isc/backtrace.h
@@ -83,26 +83,4 @@ isc_backtrace_gettrace(void **addrs, int maxaddrs, int *nframes)
  *\li	#ISC_R_RANGE
  */
 
-isc_result_t
-isc_backtrace_getsymbol(const void *addr, const char **symbolp,
-			unsigned long *offsetp);
-/*%<
- * Searches the internal symbol table for the symbol that most matches the
- * given 'addr'.  On success, '*symbolp' will point to the name of function
- * to which the address 'addr' belong, and '*offsetp' will store the offset
- * from the function's entry address to 'addr'.
- *
- * Requires (note that these are not ensured by assertion checks, see above):
- *
- *\li	'symbolp' must be non NULL && '*symbolp' == NULL.
- *
- *\li	'offsetp' must be non NULL.
- *
- * Returns:
- *
- *\li	#ISC_R_SUCCESS
- *\li	#ISC_R_FAILURE
- *\li	#ISC_R_NOTFOUND
- */
-
 #endif	/* GUARD_ISC_BACKTRACE_H */



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/62563836cf2f19bb680a007d4599bff82312d9e3...51d44dbadf570214616755715c308db6e169de71

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/62563836cf2f19bb680a007d4599bff82312d9e3...51d44dbadf570214616755715c308db6e169de71
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170527/3430a707/attachment.html>


More information about the vc mailing list