Skip to content

Commit

Permalink
libdrgn: dwarf_info: ignore DW_OP_{,GNU_}entry_value
Browse files Browse the repository at this point in the history
These opcodes appear in practice, and we choke on them with an exception
like "unknown DWARF expression opcode 0xf3" or "unknown DWARF expression
opcode 0xa3". In some cases, it'd be possible to recover the entry value
by looking at call site information, but that's pretty involved. For
now, just treat these operations as optimized out so we stop failing
hard.

Closes #233.

Signed-off-by: Omar Sandoval <[email protected]>
  • Loading branch information
osandov committed Jul 7, 2023
1 parent 916a721 commit c76f25b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion libdrgn/dwarf_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -4450,6 +4450,16 @@ drgn_eval_dwarf_expression(struct drgn_dwarf_expression_context *ctx,
/* Special operations. */
case DW_OP_nop:
break;
case DW_OP_entry_value:
case DW_OP_GNU_entry_value:
// TODO: DW_OP_(GNU_)entry_value followed by
// DW_OP_reg<n> means the value of the register when the
// current subprogram was entered. We could recover this
// by finding the DW_TAG_(GNU_)call_site for the return
// address and using the DW_AT_(GNU_)call_value of a
// DW_TAG_(GNU_)call_parameter with a DW_AT_location
// matching that register.
return &drgn_not_found;
/* Location description operations. */
case DW_OP_reg0 ... DW_OP_reg31:
case DW_OP_regx:
Expand All @@ -4465,7 +4475,6 @@ drgn_eval_dwarf_expression(struct drgn_dwarf_expression_context *ctx,
*
* - DW_OP_push_object_address
* - DW_OP_form_tls_address
* - DW_OP_entry_value
* DW_OP_implicit_pointer
* - Procedure calls: DW_OP_call2, DW_OP_call4, DW_OP_call_ref.
* - Typed operations: DW_OP_const_type, DW_OP_regval_type,
Expand Down

0 comments on commit c76f25b

Please sign in to comment.