mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-29 16:38:05 +08:00
windows: Factorize handling of DLL load address offset
This patch is a small cleanup that moves the magic 0x1000 offset to apply to a DLL's base address inside the win32_add_one_solib function, rather than delegate that reponsibility to its callers. gdb/gdbserver/ChangeLog: * win32-low.c (win32_add_one_solib): Add 0x1000 to load_addr. Add comment. (win32_add_all_dlls): Remove 0x1000 offset applied to DLL base address when calling win32_add_one_solib. (handle_load_dll): Delete local variable load_addr. Remove 0x1000 offset applied to DLL base address when calling win32_add_one_solib. (handle_unload_dll): Add comment.
This commit is contained in:
@ -1,3 +1,14 @@
|
|||||||
|
2014-02-26 Joel Brobecker <brobecker@adacore.com>
|
||||||
|
|
||||||
|
* win32-low.c (win32_add_one_solib): Add 0x1000 to load_addr.
|
||||||
|
Add comment.
|
||||||
|
(win32_add_all_dlls): Remove 0x1000 offset applied to DLL
|
||||||
|
base address when calling win32_add_one_solib.
|
||||||
|
(handle_load_dll): Delete local variable load_addr.
|
||||||
|
Remove 0x1000 offset applied to DLL base address when calling
|
||||||
|
win32_add_one_solib.
|
||||||
|
(handle_unload_dll): Add comment.
|
||||||
|
|
||||||
2014-02-26 Joel Brobecker <brobecker@adacore.com>
|
2014-02-26 Joel Brobecker <brobecker@adacore.com>
|
||||||
|
|
||||||
* win32-low.c (win32_add_all_dlls): Renames
|
* win32-low.c (win32_add_all_dlls): Renames
|
||||||
|
@ -971,6 +971,11 @@ win32_add_one_solib (const char *name, CORE_ADDR load_addr)
|
|||||||
HANDLE h = FindFirstFileA (name, &w32_fd);
|
HANDLE h = FindFirstFileA (name, &w32_fd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* The symbols in a dll are offset by 0x1000, which is the
|
||||||
|
offset from 0 of the first byte in an image - because
|
||||||
|
of the file header and the section alignment. */
|
||||||
|
load_addr += 0x1000;
|
||||||
|
|
||||||
if (h == INVALID_HANDLE_VALUE)
|
if (h == INVALID_HANDLE_VALUE)
|
||||||
strcpy (buf, name);
|
strcpy (buf, name);
|
||||||
else
|
else
|
||||||
@ -1215,11 +1220,7 @@ win32_add_all_dlls (void)
|
|||||||
dll_name,
|
dll_name,
|
||||||
MAX_PATH) == 0)
|
MAX_PATH) == 0)
|
||||||
continue;
|
continue;
|
||||||
/* The symbols in a dll are offset by 0x1000, which is the
|
win32_add_one_solib (dll_name, (CORE_ADDR) (uintptr_t) mi.lpBaseOfDll);
|
||||||
offset from 0 of the first byte in an image - because
|
|
||||||
of the file header and the section alignment. */
|
|
||||||
win32_add_one_solib (dll_name,
|
|
||||||
(CORE_ADDR) (uintptr_t) mi.lpBaseOfDll + 0x1000);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1315,7 +1316,6 @@ handle_load_dll (void)
|
|||||||
LOAD_DLL_DEBUG_INFO *event = ¤t_event.u.LoadDll;
|
LOAD_DLL_DEBUG_INFO *event = ¤t_event.u.LoadDll;
|
||||||
char dll_buf[MAX_PATH + 1];
|
char dll_buf[MAX_PATH + 1];
|
||||||
char *dll_name = NULL;
|
char *dll_name = NULL;
|
||||||
CORE_ADDR load_addr;
|
|
||||||
|
|
||||||
dll_buf[0] = dll_buf[sizeof (dll_buf) - 1] = '\0';
|
dll_buf[0] = dll_buf[sizeof (dll_buf) - 1] = '\0';
|
||||||
|
|
||||||
@ -1340,12 +1340,7 @@ handle_load_dll (void)
|
|||||||
if (!dll_name)
|
if (!dll_name)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* The symbols in a dll are offset by 0x1000, which is the
|
win32_add_one_solib (dll_name, (CORE_ADDR) (uintptr_t) event->lpBaseOfDll);
|
||||||
offset from 0 of the first byte in an image - because
|
|
||||||
of the file header and the section alignment. */
|
|
||||||
|
|
||||||
load_addr = (CORE_ADDR) (uintptr_t) event->lpBaseOfDll + 0x1000;
|
|
||||||
win32_add_one_solib (dll_name, load_addr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle a DLL unload event.
|
/* Handle a DLL unload event.
|
||||||
@ -1360,6 +1355,10 @@ handle_unload_dll (void)
|
|||||||
{
|
{
|
||||||
CORE_ADDR load_addr =
|
CORE_ADDR load_addr =
|
||||||
(CORE_ADDR) (uintptr_t) current_event.u.UnloadDll.lpBaseOfDll;
|
(CORE_ADDR) (uintptr_t) current_event.u.UnloadDll.lpBaseOfDll;
|
||||||
|
|
||||||
|
/* The symbols in a dll are offset by 0x1000, which is the
|
||||||
|
offset from 0 of the first byte in an image - because
|
||||||
|
of the file header and the section alignment. */
|
||||||
load_addr += 0x1000;
|
load_addr += 0x1000;
|
||||||
unloaded_dll (NULL, load_addr);
|
unloaded_dll (NULL, load_addr);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user