summaryrefslogtreecommitdiffstats
path: root/translate.cxx
Commit message (Collapse)AuthorAgeFilesLines
* PR3498: speed up pass-2 and pass-3 for kernel offline dwfl module searchingFrank Ch. Eigler2009-07-071-11/+48
| | | | | | | | | | | | | | | | | | | * 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.
* Special case _stp_kretprobe_trampoline emission for -1Roland McGrath2009-06-301-7/+12
| | | | | | * translate.cxx (emit_symbol_data_done): Special case _stp_kretprobe_trampoline emission for -1, which is invalid in hex if host width > target width.
* PR10323 Some ustack exelib.exp tests fail with prelinked shared libs.Mark Wielaard2009-06-251-3/+8
| | | | | | | | | | | | For shared libraries (.dynamic sections) we need the eh frame section address offset. This is the sh_addr if the shared library isn't prelinked (since the base load address is zero in that case), otherwise it is the module start address minus the bias (which also works for the non-prelinked case). * translate.cxx (get_unwind_data): Adjust eh_addr for module start and bias if module isn't absolute (has no relocations). * testsuite/systemtap.exelib/ustack.tcl: Accept all prelink tests.
* PR10298: tweak global param initialization for NULL etc.Frank Ch. Eigler2009-06-181-6/+7
| | | | | * translate.cxx (translate_pass): Emit module_parm stuff at the very end. * testsuite/buildok/null.stp: New test.
* PR10260: Clean up all resources after init errorsJosh Stone2009-06-101-0/+8
| | | | | | | | | | | | | | When anything in systemtap_module_init fails, and we return non-zero, then the module load is aborted. The normal module unload path (systemtap_module_exit) is not even attempted, so we need to make sure that all partially-allocated resources are returned. Our timer callbacks for the gettimeofday subsystem are a classic example of this error. If we don't unregister the timers before aborting init, they will later be called and cause a kernel fault. We also were neglecting to free the percpu context. A memory leak is less harmful, but that's fixed now too.
* build compatibility fix for gcc 3.4Frank Ch. Eigler2009-06-091-1/+1
| | | | * translate.cxx (emit_symbol_data): Use ~0 instead of -1 for big unsigned constant
* Detect kretprobe trampoline and use fallback unwinder.Mark Wielaard2009-06-031-1/+14
| | | | | | | | | | | | * runtime/sym.h (_stp_kretprobe_trampoline): Document. * translate.cxx (unwindsym_dump_context): Add stp_kretprobe_trampoline_addr. (dump_unwindsyms): Detect kretprobe_trampoline_holder symbol address. (emit_symbol_data): Initialize and emit _stp_kretprobe_trampoline. * runtime/transport/symbols.c (_stp_do_relocation): Detect kernel load address and adjust _stp_kretprobe_trampoline. * runtime/stack-i386.c (__stp_stack_print): Always use fallback unwinder when hitting kretprobe_trampoline_holder. * runtime/stack-x86_64.c (__stp_stack_print): Likewise.
* PR10206: Include NOTYPE symbols in stap-symbols.hAnanth N Mavinakayanahalli2009-05-281-0/+1
| | | | | On powerpc, function descriptors are in the .opd section as NO_TYPE. Include them in stap-symbols.h
* Fix gcc warning about Dwarf_Addr initialization.Mark Wielaard2009-05-211-1/+1
| | | | * translate.cxx (dump_unwindsyms): Initialize eh_frame to 0, not NULL.
* PR10177: init/kill time in sleepy context onlyJosh Stone2009-05-201-0/+14
| | | | | | | | | | | | Previously, _stp_init_time and _stp_kill_time were being called from begin/end/error probes, which will run with preemption disabled. The BUG reported on RT kernels showed that cpufreq_unregister_notifier can end up sleeping, which violates our preemption block. This patch moves the init/kill into systemtap_module_init/exit, where it is safe to sleep. The code maintains a new predicate with the define STAP_NEED_GETTIMEOFDAY, so we don't still incur any timer overhead if it's not used.
* Properly read eh_frame and pass is_ehframe correctly.Mark Wielaard2009-05-201-2/+2
| | | | | | | | | * runtime/unwind.c (adjustStartLoc): Add extra dbug_unwind. (_stp_search_unwind_hdr): Always pass true for is_ehframe. (unwind_frame): Properly pass through is_ehframe to adjustStartLoc(). (unwind): Add extra dbug_unwind. * translate.cxx (dump_unwindsyms): Output and use correct eh_frame and eh_len.
* Fetch and store both debug_frame and eh_frame tables.Mark Wielaard2009-05-201-39/+91
| | | | | | | | | | | | | * runtime/sym.h (_stp_module): Remove unwind_data, unwind_data_len and unwind_is_ehframe fields. Add debug_frame, eh_frame, debug_frame_len, eh_frame_len and eh_frame_addr fields. * runtime/unwind.c: Use debug_frame and debug_frame_len instead of unwind_data and unwind_data_len throughout. (cie_for_fde): Take unwind_data and is_ehframe as direct arguments. * runtime/unwind/unwind.h (cie_for_fde): New function declaration. * translate.cxx (get_unwind_data): Fetch and return both debug_frame and eh_frame tables. (dump_unwindsyms): Dump both debug_frame and eh_frame tables.
* PR 9941: Add predicate function callback to check for an early abortRajan Arora2009-04-221-1/+1
| | | | | | | * tapsets.cxx: Add dwfl_report_offline_predicate to check pending interrupts for an early abort. * tapsets.h: Declare it. * translate.cxx: Add callback to function call.
* Simplify section size logic.Mark Wielaard2009-04-221-5/+1
| | | | | | * translate.cxx (dump_unwindsyms): Just check that dwfl_module_relocations() return more than 1 relocation section bases before calling dwfl_module_address_section().
* fix a bug with %% in format stringsTim Moore2009-04-201-1/+2
| | | | | | | | | | | * translate.cxx (c_unparser::visit_print_format): Always use _stp_printf if a format string contains "%%". Previously a format string with no arguments would always be printed with _stp_print. * testsuite/systemtap.printf/basic6.stp: New test for %% in format strings. * testsuite/systemtap.printf/basic6.exp: test driver * testsuite/systemtap.examples/grapher.stp: Remove workaround for "%%" literal problem.
* Micro-optimization: no-modules translate pass 3 case.Mark Wielaard2009-04-191-8/+22
| | | | | | | | Saves 250ms in the unlikely case there are no modules needed. * translate.cxx (emit_symbol_data_done): New function. (emit_symbol_data): Call emit_symbol_data_done immediately when no module data is needed.
* Keep track of relocation section sizes.Mark Wielaard2009-04-141-15/+43
| | | | | | | | * runtime/sym.h (_stp_section): Add size field. * translate.cxx (dump_unwindsyms): Get start of module address space, turn seclist into vector of secname, size pairs, track relocation section size, or add module address range if no sections, output size in _stp_section list.
* Cleanup symbol table sanity checking.Mark Wielaard2009-04-091-16/+29
| | | | | | * translate.cxx (dump_unwindsyms): Get and check against module end, only check STT_FUNC && SHN_ABS for kernel, check shndxp for non-allocated section.
* Omit symbols that have suspicious addresses (before base) from symbol table.Mark Wielaard2009-04-081-2/+5
| | | | * translate.cxx (dump_unwindsyms): Filter out sym.st_value < base values.
* PR10026: Read marker/tracepoint args directlyJosh Stone2009-04-061-1/+6
| | | | | | | | | | We already stash the context variables for markers and tracepoints into the locals for the probe body, but then we were using separate functions to read those locals for each particular probe body. This patch instead teaches the unparser how to emit the local name directly for those context variables. The resulting code from the translator is much simpler now.
* Reorder includes so regs.c and regs-ia64.c included before task_finder.c.William Cohen2009-04-021-2/+0
|
* PR10019: --skip-badvars to suppress run-time memory errors tooFrank Ch. Eigler2009-04-011-0/+2
| | | | | | | | * NEWS: Note this change. * hash.cxx (find_script_hash): Add s.skip_badvars into hash. * translate.cxx (translate_pass): Emit STP_SKIP_BADVARS. * runtime/loc2c-runtime.h (DEREF_FAULT, STORE_DEREF_FAULT): Provide dummy implementation if STP_SKIP_BADVARS.
* PR10000: emit _stp_relocate* calculations correctly for kernel/module global ↵Frank Ch. Eigler2009-03-271-3/+4
| | | | | | | | | | | | | | | | $data * translate.cxx (dump_unwindsyms): Also emit STT_OBJECT symbols, therefore .data etc. sections into stap-symbols.h. * tapsets.cxx (iterate_over_modules): Omit a dwfl_getmodules() RC-checking assertion that blocked meaningful $context var error messages. (dwflpp::emit_address): Bypass dwfl_module_relocate_address() for kernel symbols as it has been unreliable; subtract sess.sym_stext manually. * testsuite/buildok/seventeen.stp: Extend test with module $global.
* brown paper bag fix for commit 5d6b0142Frank Ch. Eigler2009-03-241-2/+2
| | | | return != break
* further accelerate pass-3 symbol/unwind process, skip one more iterationFrank Ch. Eigler2009-03-241-2/+4
|
* accelerate pass-3 symbol/unwind generationFrank Ch. Eigler2009-03-241-2/+2
| | | | | * translate.cxx (emit_symbol_data): Abort dwfl_getmodules loop as soon as we run out of modules we're looking for.
* fix build regression w/o -tFrank Ch. Eigler2009-03-201-2/+0
| | | | * translate.cxx (emit_common_header): Always emit atomic_t skipped_* counters.
* PR9967: don't count -DINTERRUPTIBLE=1 reentrancy against MAXSKIPPEDFrank Ch. Eigler2009-03-201-2/+3
| | | | | | | * tapsets.cxx (common_probe_entryfn_prologue): Become conditional on !INTERRUPTIBLE. * translate.cxx (emit_module_exit): Still print skipped_count_reentrant with -t, even if skipped_count was zero.
* Get the canonical path of the main file for comparison at runtime.Mark Wielaard2009-03-171-0/+9
| | | | | | | | | When given directly by the user through -d or in case of the kernel name and path might differ. path should be used for matching. * runtime/sym.h (_stp_module): Add path field. * runtime/task_finder.c (__stp_tf_vm_cb): Use module path to compare vm_path. * translate.cxx (dump_unwindsyms): Output canonical path.
* Add workaround for dwfl_module_build_id bug with elfutils < 0.140.Mark Wielaard2009-03-161-7/+25
| | | | | * translate.cxx (dump_unwindsyms): Check elfutils version and whether build_id_vaddr < base, and if so add main_bias to address.
* Let -DINTERRUPTIBLE=0 mask interrupts in probesJosh Stone2009-03-091-0/+3
| | | | | | | | | | | | | | | Some time ago we loosened up the code for all probe types to allow interrupts during the handler. However, when probing something like kernel.trace("*"), you get a mix of probes in and out of the interrupt path, and it becomes much more common to have probes skipped due to interrupt reentrancy. The common_probe_entryfn_prologue and common_probe_entryfn_epilogue functions had an interruptible flag, but this was no longer used anywhere. I removed this flag, but then reused the logic to check an INTERRUPTIBLE macro instead. Now users can use -DINTERRUPTIBLE=0 to prevent interrupt reentrancy in their script, at the cost of a bit more overhead to toggle the interrupt mask.
* Check pending_interrupts more frequently during unwindsyms (pass 3) processingFrank Ch. Eigler2009-03-081-0/+3
|
* Tweak tracepoint logic to run on tracepoint_synchronize_unregister()-less RHEL5Frank Ch. Eigler2009-03-071-0/+5
|
* PR9919: Set last_stmt for array (scalar or statistical) assignments.Mark Wielaard2009-03-041-2/+2
| | | | * translate.cxx (visit_arrayindex): Update last_stmt.
* Skip generating empty struct globalWenji Huang2009-02-241-15/+17
| | | | | | | | Impact: trivial cleanup. Avoid emitting empty struct global code that is harmless. Signed-off-by: Wenji Huang <wenji.huang@oracle.com>
* Adjust extra_offset address against module base.Mark Wielaard2009-02-241-0/+4
| | | | | * translate.cxx (dump_unwindsyms): Adjust extra_offset always against module base as workaround for buggy elfutils < 0.138.
* Made probe_start()/probe_exit() function definitions match their declarations.David Smith2009-02-231-2/+2
| | | | | | | 2009-02-23 David Smith <dsmith@redhat.com> * translate.cxx (translate_pass): Made probe_start()/probe_exit() function definitions match their declarations.
* Adjust ET_DYN symbol addresses against module base.Mark Wielaard2009-02-211-1/+10
| | | | | * translate.cxx (dump_unwindsyms): Adjust sym_addr for ET_DYN always against module base as workaround for buggy elfutils < 0.138.
* Ignore kernel functions with "absolute" addresses.Mark Wielaard2009-02-201-7/+6
| | | | | | | translate.cxx (dump_unwindsyms): Augment the test for creating the stap-symbols to be STT_FUNC && !(SHN_UNDEF || SHN_ABS). The combination STT_FUNC && SHN_ABS only seems to occur on older i386 kernels and covers the vDSO "functions" we were seeing.
* Ignore symbols before module base address.Mark Wielaard2009-02-191-0/+6
|
* Enable typecasting with @castJosh Stone2009-02-181-1/+9
|\ | | | | | | | | | | | | println(@cast(myptr, "task_struct")->pid) println(@cast(myptr, "task_struct", "kernel")->pid) Merge branch 'typecast', bump ChangeLog entries to push date
| * Bump copyright years to 2009Josh Stone2009-02-181-1/+1
| |
| * Add high-level support for @cast()ingJosh Stone2009-02-181-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This handles all of the parsing, traversal, and optimization. It doesn't actually resolve the cast yet though. * staptree.h (struct cast_op, visitor::visit_cast_op): New. * staptree.cxx (cast_op::print/visit, various visitor::visit_cast_op's): Incorporate cast_op into the basic tree operations. * parse.cxx (parser::parse_symbol): Parse @cast operator with an expression operand, type string, and optional module string. * translate.cxx (c_unparser::visit_cast_op): Error out if a @cast survives to translation. * elaborate.cxx (typeresolution_info::visit_cast_op): Error out if a @cast survives to type resolution. (symbol_fetcher::visit_cast_op): treat @casts as a symbol target (void_statement_reducer::visit_cast_op): unused @casts can be discarded, but the operand should still be evaluated.
* | convert remaining translator-output code from <<endl to \nFrank Ch. Eigler2009-02-131-60/+60
| |
* | Use "\n" instead of endl in inner loops.Mark Wielaard2009-02-121-2/+2
|/
* PR9810: Mostly revert "PR6961: initial sketch: set up dummy pt_regs for ↵Frank Ch. Eigler2009-02-031-1/+0
| | | | non-trap based probes"
* Process extra_offset for kernel symbols with dwfl_module_relocate_address.Mark Wielaard2009-02-011-0/+4
|
* Add Vim modelines for GNU style in stapJosh Stone2009-01-281-0/+2
|
* Use 'static' as much as possibleJosh Stone2009-01-281-18/+18
| | | | | | | | | | This change just inserts 'static' on runtime, tapset, and generated C functions and globals, so the compiler can do a better job of optimizing. My tests with small scripts show ~10% reduction in compile time and ~20% reduction in module size. Larger scripts may show less benefit, but I expect purely positive results.
* build: make compatible with elfutils 0.138 tooFrank Ch. Eigler2008-12-311-2/+12
|