Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle function drgn type when enumerating types #422

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions oi/type_graph/DrgnParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ Type& DrgnParser::enumerateType(struct drgn_type* type) {
case DRGN_TYPE_VOID:
t = &enumeratePrimitive(type);
break;
case DRGN_TYPE_FUNCTION:
t = &enumerateFunction(type);
break;
default:
throw DrgnParserError{"Unknown drgn type kind: " +
std::to_string(kind)};
Expand Down Expand Up @@ -469,6 +472,10 @@ Type& DrgnParser::enumeratePointer(struct drgn_type* type) {
return makeType<Pointer>(type, t);
}

Type& DrgnParser::enumerateFunction(struct drgn_type* type) {
return makeType<Primitive>(type, Primitive::Kind::StubbedPointer);
}

Array& DrgnParser::enumerateArray(struct drgn_type* type) {
struct drgn_type* elementType = drgn_type_type(type).type;
uint64_t len = drgn_type_length(type);
Expand Down
1 change: 1 addition & 0 deletions oi/type_graph/DrgnParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class DrgnParser {
Enum& enumerateEnum(struct drgn_type* type);
Typedef& enumerateTypedef(struct drgn_type* type);
Type& enumeratePointer(struct drgn_type* type);
Type& enumerateFunction(struct drgn_type* type);
Array& enumerateArray(struct drgn_type* type);
Primitive& enumeratePrimitive(struct drgn_type* type);

Expand Down