Datapin global/local differentiation

This commit is contained in:
York Jasper Niebuhr 2025-10-26 13:07:38 +01:00
parent 6b716fbd56
commit 59eb91dcdf
5 changed files with 7 additions and 6 deletions

View File

@ -12,8 +12,8 @@ ipin <label> <target uid> <field offset>
ipin <label> <target uid> <field offset>
ipin <label> <target uid> <field offset>
...
dpin <symbol> <offset> <level> <target uid>
dpin <symbol> <offset> <level> <target uid>
dpin <local/global> <symbol> <offset> <level> <target uid>
dpin <local/global> <symbol> <offset> <level> <target uid>
...

View File

@ -19,7 +19,8 @@ void on_finish_unit(void* plugin_data, void* user_data) {
std::cout << " Target " << uid << " -> \"" << target.name() << "\" (" << target.size() << ")" << std::endl;
for (const DataPin& dpin : dpins()) {
std::cout << " Data pin at symbol \"" << dpin.symbol << "\":" << std::endl;
std::cout << " " << (dpin.global ? "Global" : "Local") << " data pin at symbol \""
<< dpin.symbol << "\":" << std::endl;
for (const DataPin::Component& c : dpin.components)
std::cout << " offset " << c.offset << " (level " << c.level << ") -> target " << c.target << std::endl;
}

View File

@ -55,8 +55,7 @@ static void on_static_var(tree var) {
return;
DECL_PRESERVE_P(var) = 1;
DECL_VISIBILITY(var) = VISIBILITY_DEFAULT;
DECL_VISIBILITY_SPECIFIED(var) = 1;
pin.global = static_cast<bool>(TREE_PUBLIC(var));
tree symbol_tree = DECL_ASSEMBLER_NAME(var);
const char* symbol;

View File

@ -77,6 +77,7 @@ struct DataPin {
};
std::string symbol;
bool global;
std::list<Component> components;
};

View File

@ -3,7 +3,7 @@
int second_pid();
int third_pid();
struct task_struct global = { .pid = 42, .comm = "main_global" };
extern struct task_struct global = { .pid = 42, .comm = "main_global" };
int main(void)
{