| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is less useful than one would hope. gcc will often emit a label with
a DW_AT_low_pc that is not really in the neighbourhood of where one would
expect it when the label is inlined and gcc can proof the label isn't really
used in the optimized code. dwflpp::iterate_over_labels will now really
iterate recursively through the die, even for dies without a name (like
lexical blocks). This means we should now always find the concrete inlined
label instances that have a real DW_AT_low_pc and so we don't need the trick
to use the line table to get at the actual address.
* dwflpp.cxx (iterate_over_labels): Accept dies without a name. Don't handle
labels without a name or without a lowpc attribute.
* testsuite/systemtap.base/inlinedvars.c (m): Trick gcc into thinking label
is always used.
(call, call2): Activate.
(main): Call call and call2.
* testsuite/systemtap.base/inlinedvars.exp: New result_string.
Test both unoptimized and optimized (inlined) builds.
|
|
|
|
| |
* dwflpp.cxx (dwflpp::translate_components): Check for void* deref.
|
|
|
|
|
|
|
|
| |
When we list the possible members for an anonymous struct/union, the
user may want to go look at the source for the type. That's hard
without a type name, so we now list the decl file:line for them.
* dwflpp.cxx (dwflpp::translate_components): List file:line for anon.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We commonly do a dwarf_attr_integrate followed by dwarf_formref_die,
with no care for the Dwarf_Attribute, so I captured that idiom in an
inline function.
* dwarf_wrappers.h (dwarf_attr_die): New.
* dwarf_wrappers.cxx (dwarf_type_name): Call dwarf_attr_die.
* dwflpp.cxx (dwflpp::print_members): Ditto.
(dwflpp::find_struct_member): Ditto.
* tapsets.cxx (dwarf_derived_probe::saveargs): Ditto.
(uprobe_derived_probe::saveargs): Ditto.
(resolve_tracepoint_arg_type): Ditto.
(tracepoint_derived_probe::build_args): Ditto.
|
|
|
|
|
|
|
|
| |
We should always use the canonical dwarf_diename. The code being
replaced here wasn't even using dwarf_attr_integrate, so it may have
been missing the accessibility of some names.
* dwflpp.cxx (dwflpp::iterate_over_labels): Use dwarf_diename.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* dwarf_wrappers.cxx (dwarf_type_name): Moved here from tapsets.cxx, and
added a variant that returns a string for easier ostreaming.
* dwflpp.cxx (dwflpp::print_members): Use dwarf_type_name for errors.
(dwflpp::find_struct_member): Ditto.
(dwflpp::translate_components): Ditto.
(dwflpp::translate_final_fetch_or_store): Ditto.
(dwflpp::literal_stmt_for_pointer): Ditto.
* tapsets.cxx (dwarf_derived_probe::saveargs): Pass die to
dwarf_type_name by pointer instead of reference.
(uprobe_derived_probe::saveargs): Ditto.
(resolve_tracepoint_arg_type): Ditto.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We had a bug that the starting call to find_struct_member used the same
memory for the parentdie and the resulting member. If parentdie is a
union, then the first member probably won't have a location, and we
actually assert that it must be a union. Since we wrote the result in
the same memory, we lost the real info about the parent, and so the
assertion failed.
* dwflpp.cxx (dwflpp::translate_components): Use distinct memory for the
parent and resulting member in the call to find_struct_member.
(dwflpp::find_struct_member): Remove the needless parentdie copy.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
dwflpp::find_variable_and_frame_base switched too early to "pyshical view"
of die tree. We need to lookup the var in the "syntactical view" of the die
tree first. Then when we see a DW_TAG_inlined_subroutine while walking the
syntactical die tree as returned by dwarf_getscopes for a given variable
to retrieve the frame base, then we need to switch to walking the physical
die tree where the subroutine is inlined.
* dwflpp.cxx (find_variable_and_frame_base): Don't immediately go to
die_scopes, but lookup var first based on pc. Then switch "die branches"
when searching for frame base and a DW_TAG_inlined_subroutine is
encountered.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In C++ especially, a function definition in a header may be compiled
into multiple CUs, but the linker will merge those into a single output
function. We don't want to place multiple probes on the same function.
The dupe-detection from the alias code (commit 1c6b77e5) already tracks
identical functions within a CU, so I've just lifted this to instead
track function entrypcs at the module level.
* dwflpp.cxx (dwflpp::iterate_over_functions): Remove dupe checks.
* tapsets.cxx (dwarf_query): Add alias_dupes set to the query.
(dwarf_query::handle_query_module): Reset the dupes for each module.
(query_dwarf_func): Check that we only probe each entrypc once.
|
|
|
|
|
|
|
|
| |
The implementation of dwarf_entrypc already checks for _lowpc, so it's
redundant for us to attempt a _lowpc call too.
* dwflpp.cxx (dwflpp::function_entrypc): Remove XXX comment.
(dwflpp::die_entrypc): Don't bother with _lowpc if _entrypc fails
|
|
|
|
|
| |
* dwflpp.cxx (iterate_over_functions): Return for NULL pointer.
* testsuite/systemtap.base/statement.exp: Add test case.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Elfutils prior to 0.143 didn't use attr_integrate when looking up the
decl_file or decl_line, so the attributes would sometimes be missed.
For those old versions, we define custom implementations to do the
integration.
* dwarf_wrappers.cxx (dwarf_decl_file_integrate): New.
(dwarf_decl_line_integrate): New.
* dwarf_wrappers.h: Add macros to redirect calls to the above functions.
* dwflpp.cxx (dwflpp::iterate_over_labels): Replace a manual attribute
lookup that is the same as dwarf_decl_line.
|
|
|
|
|
|
|
| |
We were jumping through a few hoops to deal with elfutils < 0.138 that
did not have the _ELFUTILS_PREREQ macro. I've added an always-false
dummy macro to take its place when it doesn't exit. All of the other
"#ifdef _ELFUTILS_PREREQ" ugliness can now go away.
|
|
|
|
|
|
| |
The dwarf_diename in elfutils learned a long time ago to use
dwarf_attr_integrate when looking up the name. Our minimum elfutils
0.126 has this, so we don't need to kludge it ourselves.
|
|
|
|
|
|
|
|
|
| |
* dwflpp.cxx (iterate_over_srcfile_lines): Add pattern parameter.
* dwflpp.h (iterate_over_srcfile_lines): Ditto.
* testsuite/systemtap.base/bz10294.c: Test case.
* testsuite/systemtap.base/bz10294.stp: Ditto.
* testsuite/systemtap.base/bz6905.exp: Deleted.
* testsuite/systemtap.base/statement.exp: Merge bz10294 with bz6905.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Rather than just numeric literals, we can now support arbitrary
expressions for the index value. Note that loc2c won't allow this for
noncontiguous arrays, as the access methods need to be statically
computed, but for contiguous arrays and pointers-as-arrays it works
just fine.
* staptree.h (target_symbol::component): Add expression_array_index.
* staptree.cxx (target_symbol::visit_components): New helper.
(target_symbol::assert_no_components): Recognize new array type.
(target_symbol::component::print): Print subexpressions.
(traversing_visitor::visit_target_symbol, visit_cast_op): Visit the
indexing components too.
(varuse_collecting_visitor::visit_target_symbol): Ditto.
(update_visitor::visit_target_symbol, visit_cast_op): Ditto.
* elaborate.cxx (void_statement_reducer::visit_target_symbol): New.
(void_statement_reducer::visit_cast_op): Save indexes too.
* parse.cxx (parser::parse_target_symbol_components): Parse expressions.
* tapsets.cxx (dwarf_var_expanding_visitor::visit_target_symbol): Pass
expression-indexes as parameters (indexN) to the dwarf function.
(dwarf_cast_expanding_visitor::visit_cast_op): Ditto.
(tracepoint_var_expanding_visitor::visit_target_symbol_arg): Ditto.
(sdt_var_expanding_visitor::visit_target_symbol): Visit the new @cast.
* dwflpp.cxx (dwflpp::translate_components): Use THIS->indexN.
* translate.cxx (c_unparser::visit_target_symbol): Correct error msg.
* testsuite/systemtap.base/pointer_array.stp: Use a simple index.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now the dereferences on target_symbol and cast_op are tracked with a
struct instead of just a generic pair. The first immediate benefit is
that we can track the token for more exact error reporting.
* staptree.h (target_symbol): Add a new component type.
* staptree.cxx (target_symbol::component::print): New.
(operator<<(ostream&, target_symbol::component&): New.
(target_symbol::print): Adapt component printing.
(cast_op::print): Ditto.
* parse.cxx (parser::parse_target_symbol_components): Adapt to the new
component construction.
* dwflpp.cxx (dwflpp::find_struct_member): take the component as a
parameter for a better token in error messages
(dwflpp::translate_components): Adapt to the new component type.
* tapsets.cxx (dwarf_var_expanding_visitor::visit_target_symbol): Don't
overwrite the token in target_symbol saved errors.
(tracepoint_var_expanding_visitor::visit_target_symbol_arg): Ditto.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stap.1.in: Document that -w disables all warning messages.
* dwflpp.cxx (get_module_dwarf): Only output warning when session
suppress_warnings is not set.
* translate.cxx (dump_unwindsyms): Likewise.
(emit_symbol_data_done): Likewise.
* tapsets.cxx (query_module_symtab): Likewise.
(read_from_elf_file): Take systemtap_session, check suppress_warnings
before emitting warning.
(read_from_text_file): Likewise.
(get_symtab): Call read_from_elf_file and read_from_text_file with session.
|
|
|
|
|
|
|
|
| |
* dwflpp.cxx (iterate_over_srcfile_lines): Check the line range
and tolerate invalid line number for WILDCARD line type.
* testsuite/systemtap.base/bz6905.c: Test case.
* testsuite/systemtap.base/bz6905.exp: Ditto.
* testsuite/systemtap.base/bz6905.stp: Ditto.
|
|
|
|
|
| |
* dwflpp.cxx (get_cfa_ops): Only define cfa_nops if _ELFUTILS_PREREQ(0,142).
* loc2c-test.c (main): Likewise.
|
|
|
|
|
| |
* dwflpp.cxx (get_cfa_ops): Call dwarf_frame_cfa with cfa_nops size_t.
* loc2c-test.c (main): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There was a bad assumption in the probe_table initialization that the
dwflpp->module would be immediately valid. We should not assume that
dwflpp only has one module, or that any module is necessarily in focus.
Instead, I've created an sdt_query class which will call an
iterate_over_modules like the other dwarf probe types. For now this
means just a single module, but it will also open the door to iterating
over all linked libraries too, for example.
* dwflpp.cxx (dwflpp::setup_user): don't "save mod!" anymore
* tapsets.cxx (probe_table -> sdt_query): convert to a query-style
class, and also take over the task of iterating over the probes.
(dwarf_builder::build): leave the iteration to sdt_query
|
|
|
|
| |
* dwflpp.cxx (setup_user): Set module to mod.
|
|
|
|
|
|
|
|
|
| |
This will be used to load tracepoint modules as a bunch of little query
modules into a single dwflpp.
* dwflpp.cxx (setup_user): take a vector instead of a single module
(dwflpp::dwflpp): form a vector in the singular case, and add a
variant that takes and passes through a vector of modules.
|
|
|
|
|
|
|
| |
* dwflpp.cxx (translate_location): Call get_cfa_ops with relative pc plus
module bias.
(literal_addr_to_sym_addr): Add verbose logging.
(get_cfa_ops): Adjust pc for returned bias. Add verbose logging.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This allows the '&' operator to get the address of @cast and $target
variable expressions.
* staptree.h (target_symbol): add addressof field
* staptree.cxx (target_symbol::print): print '&' for addressof
(cast_op::print): ditto
* parse.cxx (parser::parse_value): allow '&' prefix on $target/@cast
* dwflpp.cxx (dwflpp::translate_final_fetch_or_store): allow taking the
computed address without actually doing a final fetch.
* tapset* (*::visit_target_symbol): throw errors for $vars w/o addresses
* testsuite/systemtap.base/cast.stp: add &@cast test
* testsuite/semok/target_addr.stp: test '&' on different member types
* testsuite/semko/target_addr?.stp: test failure on bitfields/registers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Depends on elfutils 0.142 cfi support.
* loc2c.h (c_translate_location): Take (optional) Dwarf_Op *cfa_ops.
* loc2c.c (translate): Recognize DW_OP_call_frame_cfa.
(location_from_address): Take cfa_ops, examine fb_ops, if it is
DW_OP_call_frame_cfa, pass cfa_ops to translate instead.
(location_relative): Take cfa_ops, pass to location_from_address.
(c_translate_location): Take cfa_ops, pass to location_from_address.
* loc2c-test.c (handle_variable): Take cfa_ops, pass to c_translate_location
when needed.
(main): Fetch cfa_ops, pass to handle_variable.
* dwflpp.h (struct dwflpp): Add new method get_cfa_ops.
* dwflpp.cxx: Include elfutils/version.h.
(translate_location): Fetch cfa_ops when necessary.
(get_cfa_ops): New method.
|
|
|
|
|
|
|
| |
* dwflpp.cxx (dwflpp::translate_components): let pointers get treated
the same as arrays, and add a final DIE dereference for array access.
* loc2c.c (c_translate_array): tolerate pointer types
* testsuite/systemtap.base/pointer_array.*: new test
|
|
|
|
| |
* dwflpp.cxx (dwfl_report_offline_predicate): Reject NULL filenames.
|
|
|
|
|
|
|
|
| |
* dwflpp.cxx (name_has_wildcard): Make static.
(dwfl_report_offline_predicate): Check & adjust behavior.
* dwflpp.h: Corresponding changes.
* tapsets.cxx: Note that kern_dw[] keys may be wildcard strings.
* testsuite/buildok/fortysix.stp: New test.
|
|
|
|
|
|
|
| |
* loc2c.h (c_translate_add_offset): New function prototype.
* loc2c.c (c_translate_add_offset): New function implementation.
* loc2c-test.c (handle_variable): Use c_translate_add_offset if appropriate.
* dwflpp.cxx (translate_location): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* dwflpp.cxx (dwflpp ctor): Parametrize for user/kernel modes.
Update callers.
(dwfl_report_offline_predicate): New function. Filter and
abort searches early if possible.
(setup_kernel): Use new predicate.
* dwflpp.h: Corresponding changes.
* tapsets.cxx (dwfl_report_offline_predicate): Remove this shared
implementation.
(dwarf_builder): Turn kern_dw into module_name->dwflpp* map, just
like user_dw.
(get_kern_dw): Adapt.
(dwarf_build_no_more): Adapt.
* tapsets.h: Remove old shared predicate.
* translate.cxx (dwfl_report_offline_predicate2): New function.
Filter and abort searches early if possible.
(emit_symbol_data): Use it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This will first read in the symbol table for modules, and update the
dwarf cu_function_cache with aliased names too. Then when iterating
in dwarf, all of the possible names are matched, instead of only the
canonical dwarf name.
* dwflpp.cxx (dwflpp::iterate_over_functions): call update_symtab,
and track wildcard addresses in a set to avoid alias dupes
* dwflpp.h (symbol_table::Compare): removed
* tapsets.cxx (symbol_table::map_by_addr): replaces list_by_addr
(symbol_table::sort): removed -- multimap doesn't need sorting
(symbol_table::mark_dwarf_redundancies): removed, see update_symtab
(symbol_table::purge_syscall_stubs): remove map elements inline
(dwarf_query::handle_query_module): preload the symtable.
(query_dwarf_func): don't compare the function a second time,
especially since it may have been an alias that matched at first.
(module_info::get_symtab): allow being called multiple times
(module_info::update_symtab): copy dies from the cache to the symtab,
and also add aliased names to the cache
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Mark probes rely on literal statement addresses, these are based on the
on-disk module address space. Introduce helper function to turn such
addresses into symbol addresses as expected by libdwfl. Also properly
adjust for dw bias when such addresses are used in dw queries.
* dwflpp.h (dwflpp::literal_addr_to_sym_addr): New method.
* dwflpp.cxx (query_cu_containing_address): Don't "globalize" address.
(literal_addr_to_sym_addr): New method.
* tapsets.cxx (query_module_dwarf): Turn literal addresses into symbol
addresses.
(query_dwarf_func): Likewise and adjust for dw module bias.
|
|
|
|
|
|
|
|
|
|
|
|
| |
More fat-trimming optimization for ~7% off listing syscall.*.
* dwflpp.cxx (dwflpp::iterate_over_functions): remove a parameter copy
(dwflpp::module_name_matches): Use const string& parameters
(dwflpp::name_has_wildcard): Ditto.
(dwflpp::module_name_final_match): Ditto.
(dwflpp::function_name_matches_pattern): Ditto.
(dwflpp::function_name_matches): Ditto.
(dwflpp::function_name_final_match): Ditto.
|
|
|
|
|
|
|
|
| |
* dwflpp.h: Check elfutils version, define elf_getshdrstrndx as
elf_getshstrndx if elfutils 0.142 detected.
* dwflpp.cxx (get_blacklist_section): Use elf_getshdrstrndx.
* tapsets.cxx (probe_table): Likewise.
(prepare_section_rejection): Likewise.
|
|
|
|
| |
* dwflpp.cxx (relocate_address): Adjust reloc_addr at start, not afterwards.
|
|
|
|
|
| |
* dwflpp.cxx (relocate_address): For .dynamic section addresses adjust for
module bias.
|
|
|
|
|
|
| |
It was just a basic NULL check, but creating its string temporaries was
causing a fair slowdown. Removing this function and adjusting the
callers shaves ~5% off the syscall.* elaboration time.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
query_module was already returning DW_CB_ABORT when a simple match was
found, but dwflpp::iterate_over_modules was ignoring that and instead
forcing the module loop to restart. The only way out of the loop was
with the pending_interrupts flag, which is only for signalled
interrupts.
Now iterate_over_modules will only attempt the dwfl_getmodules loop
once, since that loop will only abort if the CB returns DW_CB_ABORT.
Then query_module is also modified to return ABORT if pending_interrupts
is flagged.
My trusty test, stap -l syscall.*, is nearly 2x faster with this change.
Empirically, I found that the kernel object is always the first "module"
returned, so the syscall probepoints always gets to short-circuit the
loop right away.
|
|\ |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This one function accounted for ~30% of my callgrind profile of
"stap -l 'syscall.*'", even though it was only called ~1200 times. We
call dwarf_getscopes for each $target variable, with the same parameters
within a given probe. Since they're no nicely grouped, it's easy to
just cache the most recent call, and the next few calls will be a hit.
Overall this cuts the number of calls down to about 300, for an easy
speed gain.
|
|/
|
|
|
|
|
| |
For a call like "stap -l 'syscall.*'", I found that ~10% of the time was
spent compiling the blacklist regexps over again for each probe point.
By moving this functionality into the kernel dwflpp instance, we can
reuse the regexps and get an easy speed boost.
|
|
|
|
|
|
|
|
|
| |
The patch makes use of the RPM libraries to determine which rpm supplied
the executable and from that information suggest a command to install the
appropriate debuginfo rpm.
This is enabled using the "--with-rpm" option for configure. Can be
explicitly disabled with "--without-rpm".
|
|
|
|
|
| |
This helps make it more obvious which methods are accessed by external
classes, which should help in refactoring.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
The method query_cu_containing_global_address was only called by
query_cu_containing_module_address, and the latter was just doing a
simple argument transform. They are now merged into a single method,
query_cu_containing_address. The function module_address_to_global is
also merged here at its only call site.
|