Changeset View
Changeset View
Standalone View
Standalone View
devel/gdb/files/kgdb/fbsd-kld.c
Show First 20 Lines • Show All 132 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Try to find the path for a kld by looking in the kernel's directory and | * Try to find the path for a kld by looking in the kernel's directory and | ||||
* in the various paths in the module path. | * in the various paths in the module path. | ||||
*/ | */ | ||||
static int | static int | ||||
find_kld_path (const char *filename, char *path, size_t path_size) | find_kld_path (const char *filename, char *path, size_t path_size) | ||||
{ | { | ||||
struct kld_info *info; | struct kld_info *info; | ||||
struct cleanup *cleanup; | |||||
gdb::unique_xmalloc_ptr<char> module_path; | gdb::unique_xmalloc_ptr<char> module_path; | ||||
char *module_dir, *cp; | char *module_dir, *cp; | ||||
int error; | int error; | ||||
info = get_kld_info(); | info = get_kld_info(); | ||||
if (exec_bfd) { | if (exec_bfd) { | ||||
std::string kernel_dir = ldirname(bfd_get_filename(exec_bfd)); | std::string kernel_dir = ldirname(bfd_get_filename(exec_bfd)); | ||||
if (!kernel_dir.empty()) { | if (!kernel_dir.empty()) { | ||||
▲ Show 20 Lines • Show All 248 Lines • ▼ Show 20 Lines | TRY { | ||||
info->off_address = parse_and_eval_address( | info->off_address = parse_and_eval_address( | ||||
"&((struct linker_file *)0)->address"); | "&((struct linker_file *)0)->address"); | ||||
info->off_filename = parse_and_eval_address( | info->off_filename = parse_and_eval_address( | ||||
"&((struct linker_file *)0)->filename"); | "&((struct linker_file *)0)->filename"); | ||||
info->off_pathname = parse_and_eval_address( | info->off_pathname = parse_and_eval_address( | ||||
"&((struct linker_file *)0)->pathname"); | "&((struct linker_file *)0)->pathname"); | ||||
info->off_next = parse_and_eval_address( | info->off_next = parse_and_eval_address( | ||||
"&((struct linker_file *)0)->link.tqe_next"); | "&((struct linker_file *)0)->link.tqe_next"); | ||||
} CATCH(e, RETURN_MASK_ERROR) { | } CATCH(e2, RETURN_MASK_ERROR) { | ||||
return; | return; | ||||
} | } | ||||
END_CATCH | END_CATCH | ||||
} | } | ||||
END_CATCH | END_CATCH | ||||
TRY { | TRY { | ||||
info->module_path_addr = parse_and_eval_address("linker_path"); | info->module_path_addr = parse_and_eval_address("linker_path"); | ||||
▲ Show 20 Lines • Show All 158 Lines • Show Last 20 Lines |