mirror of
https://github.com/JakeHillion/drgn.git
synced 2024-12-22 09:13:06 +00:00
eb83d51175
For Python-based object, type, and symbol finders, the vmcoreinfo is a critical source of information. It can contain addresses necessary for loading certain information (such as kallsyms). Expose this information as a special object. Signed-off-by: Stephen Brennan <stephen.s.brennan@oracle.com>
44 lines
1.3 KiB
Plaintext
44 lines
1.3 KiB
Plaintext
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
// SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
struct drgn_error *linux_kernel_object_find(const char *name, size_t name_len,
|
|
const char *filename,
|
|
enum drgn_find_object_flags flags,
|
|
void *arg, struct drgn_object *ret)
|
|
{
|
|
struct drgn_program *prog = arg;
|
|
if (!filename) {
|
|
@memswitch (name, name_len)@
|
|
@case "PAGE_SHIFT"@
|
|
if (flags & DRGN_FIND_OBJECT_CONSTANT)
|
|
return linux_kernel_get_page_shift(prog, ret);
|
|
break;
|
|
@case "PAGE_SIZE"@
|
|
if (flags & DRGN_FIND_OBJECT_CONSTANT)
|
|
return linux_kernel_get_page_size(prog, ret);
|
|
break;
|
|
@case "PAGE_MASK"@
|
|
if (flags & DRGN_FIND_OBJECT_CONSTANT)
|
|
return linux_kernel_get_page_mask(prog, ret);
|
|
break;
|
|
@case "UTS_RELEASE"@
|
|
if (flags & DRGN_FIND_OBJECT_CONSTANT)
|
|
return linux_kernel_get_uts_release(prog, ret);
|
|
break;
|
|
@case "VMCOREINFO"@
|
|
if (flags & DRGN_FIND_OBJECT_CONSTANT)
|
|
return linux_kernel_get_vmcoreinfo(prog, ret);
|
|
break;
|
|
@case "jiffies"@
|
|
if (flags & DRGN_FIND_OBJECT_VARIABLE)
|
|
return linux_kernel_get_jiffies(prog, ret);
|
|
break;
|
|
@case "vmemmap"@
|
|
if (flags & DRGN_FIND_OBJECT_CONSTANT)
|
|
return linux_kernel_get_vmemmap(prog, ret);
|
|
break;
|
|
@endswitch@
|
|
}
|
|
return &drgn_not_found;
|
|
}
|