Ken Thomases : dbghelp: Add debug logging to some error paths in the Mach-O support.
Alexandre Julliard
julliard at winehq.org
Tue Dec 3 13:46:36 CST 2013
Module: wine
Branch: master
Commit: 15467577fc5cda2e31253f575c2f618c1d6a5bc3
URL: http://source.winehq.org/git/wine.git/?a=commit;h=15467577fc5cda2e31253f575c2f618c1d6a5bc3
Author: Ken Thomases <ken at codeweavers.com>
Date: Mon Dec 2 21:04:13 2013 -0600
dbghelp: Add debug logging to some error paths in the Mach-O support.
---
dlls/dbghelp/macho_module.c | 22 +++++++++++++++++++---
1 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/dlls/dbghelp/macho_module.c b/dlls/dbghelp/macho_module.c
index 5da31aa..6d71168 100644
--- a/dlls/dbghelp/macho_module.c
+++ b/dlls/dbghelp/macho_module.c
@@ -30,6 +30,7 @@
#include <assert.h>
#include <stdarg.h>
+#include <errno.h>
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
@@ -432,17 +433,32 @@ static BOOL macho_map_file(const WCHAR* filenameW, struct macho_file_map* fmap)
RtlInitializeBitMap(&fmap->sect_is_code, fmap->sect_is_code_buff, MAX_SECT + 1);
len = WideCharToMultiByte(CP_UNIXCP, 0, filenameW, -1, NULL, 0, NULL, NULL);
- if (!(filename = HeapAlloc(GetProcessHeap(), 0, len))) return FALSE;
+ if (!(filename = HeapAlloc(GetProcessHeap(), 0, len)))
+ {
+ WARN("failed to allocate filename buffer\n");
+ return FALSE;
+ }
WideCharToMultiByte(CP_UNIXCP, 0, filenameW, -1, filename, len, NULL, NULL);
/* check that the file exists */
- if (stat(filename, &statbuf) == -1 || S_ISDIR(statbuf.st_mode)) goto done;
+ if (stat(filename, &statbuf) == -1 || S_ISDIR(statbuf.st_mode))
+ {
+ TRACE("stat() failed or %s is directory: %s\n", debugstr_a(filename), strerror(errno));
+ goto done;
+ }
/* Now open the file, so that we can mmap() it. */
- if ((fmap->fd = open(filename, O_RDONLY)) == -1) goto done;
+ if ((fmap->fd = open(filename, O_RDONLY)) == -1)
+ {
+ TRACE("failed to open file %s: %d\n", debugstr_a(filename), errno);
+ goto done;
+ }
if (read(fmap->fd, &fat_header, sizeof(fat_header)) != sizeof(fat_header))
+ {
+ TRACE("failed to read fat header: %d\n", errno);
goto done;
+ }
TRACE("... got possible fat header\n");
/* Fat header is always in big-endian order. */
More information about the wine-cvs
mailing list