Skip to content
Merged
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
30 changes: 17 additions & 13 deletions ghostscope-compiler/src/ebpf/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1867,8 +1867,10 @@ impl<'ctx, 'dw> EbpfContext<'ctx, 'dw> {
CodeGenError::VariableNotFound(format!("{expr:?}"))
})?;
let mod_hint = self.take_module_hint();
self.variable_location_to_address_with_hint(
&var.location,
let pc_address = self.get_compile_time_context()?.pc_address;
self.variable_read_plan_to_lvalue_address_with_hint(
&var,
pc_address,
None,
mod_hint.as_deref(),
)?
Expand Down Expand Up @@ -1963,8 +1965,10 @@ impl<'ctx, 'dw> EbpfContext<'ctx, 'dw> {
|| CodeGenError::VariableNotFound(format!("{val_expr:?}")),
)?;
let mod_hint = self.take_module_hint();
self.variable_location_to_address_with_hint(
&var.location,
let pc_address = self.get_compile_time_context()?.pc_address;
self.variable_read_plan_to_lvalue_address_with_hint(
&var,
pc_address,
None,
mod_hint.as_deref(),
)?
Expand Down Expand Up @@ -2073,8 +2077,10 @@ impl<'ctx, 'dw> EbpfContext<'ctx, 'dw> {
|| CodeGenError::VariableNotFound(format!("{val_expr:?}")),
)?;
let mod_hint = self.take_module_hint();
self.variable_location_to_address_with_hint(
&var.location,
let pc_address = self.get_compile_time_context()?.pc_address;
self.variable_read_plan_to_lvalue_address_with_hint(
&var,
pc_address,
None,
mod_hint.as_deref(),
)?
Expand Down Expand Up @@ -4263,22 +4269,20 @@ impl<'ctx, 'dw> EbpfContext<'ctx, 'dw> {
match self.query_dwarf_for_variable(var_name)? {
Some(var_info) => {
info!(
"Found DWARF variable: {} = {:?}",
var_name, var_info.location
"Found DWARF variable read plan: {} availability={:?}",
var_name, var_info.availability
);

// Require DWARF type information
let dwarf_type = var_info.dwarf_type.as_ref().ok_or_else(|| {
var_info.dwarf_type.as_ref().ok_or_else(|| {
CodeGenError::DwarfError(format!(
"Variable '{var_name}' has no type information in DWARF"
))
})?;

let compile_context = self.get_compile_time_context()?;
self.variable_location_to_llvm_value(
&var_info.location,
dwarf_type,
var_name,
self.variable_read_plan_to_llvm_value(
&var_info,
compile_context.pc_address,
status_ptr,
)
Expand Down
Loading
Loading