diff options
author | Philipp Rudo <prudo@linux.vnet.ibm.com> | 2017-02-07 14:17:05 +0100 |
---|---|---|
committer | Andreas Arnez <arnez@linux.vnet.ibm.com> | 2017-02-07 16:25:54 +0100 |
commit | fc83f37b41084a8aeae0338b16039db8c0870f04 (patch) | |
tree | b2f62bfeb8f9b514f16e99728c0de3d42a395b42 /gdb/lk-modules.h | |
parent | 757186093b40ad3b37962c34294d032b0d88739f (diff) | |
download | gdb-fc83f37b41084a8aeae0338b16039db8c0870f04.zip gdb-fc83f37b41084a8aeae0338b16039db8c0870f04.tar.gz gdb-fc83f37b41084a8aeae0338b16039db8c0870f04.tar.bz2 |
Add kernel module support for linux-kernel target
This patch implements module support for the new linux-kernel target by
adding a target_so_ops. In addition this patch adds handling for kernel
virtual addresses. This is necessary because kernel modules, unlike
task_structs, live in kernel virtual address space. Thus addresses need
to be translated before they can be read from. We achieve this by adding
an implementation for the targets to_xfer_partial hook, which translates
the addresses before passing them down to the target beneath.
gdb/ChangeLog:
* lk-modules.h: New file.
* lk-modules.c: New file.
* lk-low.h (lk_hook_is_kvaddr, lk_hook_vtop)
(lk_hook_get_module_text_offset): New arch dependent hooks.
(sturct lk_private_hooks): Add new hooks.
(LK_MODULES_NAME_LEN, LK_UTS_NAME_LEN): New define.
* lk-low.c (lk-modules.h): New include.
(lk_kvtop, restore_current_target, lk_xfer_partial): New functions.
(lk_init_private_data): Declare needed debug symbols.
(lk_try_push_target): Assert for new hooks and set solib_ops.
(init_linux_kernel_ops): Add implementation for to_xfer_partial.
* solib.c (get_solib_search_path): New function.
* solib.h (get_solib_search_path): New export.
* Makefile.in (SFILES, ALLDEPFILES): Add lk-modules.c.
(HFILES_NO_SRCDIR): Add lk-modules.h.
(COMMON_OBS): Add lk-modules.o.
Diffstat (limited to 'gdb/lk-modules.h')
-rw-r--r-- | gdb/lk-modules.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gdb/lk-modules.h b/gdb/lk-modules.h new file mode 100644 index 0000000..47e6dde --- /dev/null +++ b/gdb/lk-modules.h @@ -0,0 +1,29 @@ +/* Handle kernel modules as shared libraries. + + Copyright (C) 2016 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#ifndef __LK_MODULES_H__ +#define __LK_MODULES_H__ + +extern struct target_so_ops *lk_modules_so_ops; + +/* Check if debug info for module NAME are loaded. Needed by lsmod command. */ + +extern bool lk_modules_debug_info_loaded (const std::string &name); + +#endif /* __LK_MODULES_H__ */ |