From: VMware, Inc <> Date: Wed, 20 Jan 2010 21:30:24 +0000 (-0800) Subject: Switch to using a more generic loaded-module-list func X-Git-Tag: 2010.01.19-226760~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a63f6917208c99dc8222a2b8ffbbaf1954b10fb;p=thirdparty%2Fopen-vm-tools.git Switch to using a more generic loaded-module-list func There is a not-very-generic loaded-module-list function in lib/user (which is Linux-only). For other reasons, I've written a more generic one in lib/coreDump (checked in with a previous review, cn970593) that works for Linux, Windows, and Mac. Delete the old one, and hook up the one callsite to call the new one. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/lib/include/util.h b/open-vm-tools/lib/include/util.h index 8972bd253..de749ff02 100644 --- a/open-vm-tools/lib/include/util.h +++ b/open-vm-tools/lib/include/util.h @@ -144,10 +144,6 @@ void Util_BacktraceToBuffer(uintptr_t *basePtr, int Util_CompareDotted(const char *s1, const char *s2); -#if defined(__linux__) -void Util_PrintLoadedObjects(void *addr_inside_exec); -#endif - #if defined(VMX86_STATS) Bool Util_QueryCStResidency(uint32 *numCpus, uint32 *numCStates, uint64 **transitns, uint64 **residency, diff --git a/open-vm-tools/lib/user/util.c b/open-vm-tools/lib/user/util.c index 328703e08..d6e229a5f 100644 --- a/open-vm-tools/lib/user/util.c +++ b/open-vm-tools/lib/user/util.c @@ -1778,72 +1778,6 @@ Util_SeparateStrings(char *source, // IN #endif /* !defined(N_PLAT_NLM) */ -#if defined (__linux__) && !defined(VMX86_TOOLS) -/* - *----------------------------------------------------------------------------- - * - * UtilPrintLoadedObjectsCallback -- - * - * Callback from dl_iterate_phdr to add info for a single - * loaded object to the log. - * - * Results: - * 0: continue iterating/success - * non-zero: stop iterating/error - * - * Side effects: - * None. - * - *----------------------------------------------------------------------------- - */ - -static int -UtilPrintLoadedObjectsCallback(struct dl_phdr_info *info, //IN - size_t size, //IN - void *data) //IN -{ - /* Blank name means things like stack, which we don't care about */ - if (strcmp(info->dlpi_name, "")) { - Log("Object %s loaded at %p\n", info->dlpi_name, - (void *)info->dlpi_addr); - } - return 0; -} - - -/* - *---------------------------------------------------------------------- - * - * Util_PrintLoadedObjects -- - * - * Print the list of loaded objects to the log. Useful in - * parsing backtraces with ASLR. - * - * Results: - * - * void - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -void -Util_PrintLoadedObjects(void *addr_inside_exec) -{ - Dl_info dli; - - Log("Printing loaded objects\n"); - if (dladdr(addr_inside_exec, &dli)) { - Log("Object %s loaded at %p\n", dli.dli_fname, - (void *)dli.dli_fbase); - } - dl_iterate_phdr(UtilPrintLoadedObjectsCallback, NULL); - Log("End printing loaded objects\n"); -} -#endif - #if !defined(_WIN32) && !defined(N_PLAT_NLM) /*