summaryrefslogtreecommitdiffstats
path: root/loc2c.c
Commit message (Collapse)AuthorAgeFilesLines
* Report experssion stack slot use back from loc2c.Roland McGrath2009-10-141-5/+14
|
* Make sure loc2c declare_noncontig_union for different locs don't overlap.Mark Wielaard2009-10-051-10/+25
| | | | | | | * loc2c.c (declare_noncontig_union): Name union u_pieces for loc_noncontiguous or u_const for loc_constant. (translate_base_store): Use u_pieces for loc_noncontiguous. (translate_base_fetch): Likewise or u_const for loc_constant.
* loc2c discontiguify loops for not small enough loc_constant.Mark Wielaard2009-10-021-0/+2
| | | | | * loc2c.c (loc_constant): Add offset to size after creating piece in loc_constant loop.
* Support DW_AT_const_value cases in loc2c and loc2c-test.Roland McGrath2009-09-241-2/+101
| | | | | | * loc2c.c (c_translate_constant): New function. * loc2c.h: Declare it. * loc2c-test.c (main): Use it for DW_AT_const_value cases.
* PR10417 Fix declare_noncontig_union struct emitting.Mark Wielaard2009-09-181-2/+2
| | | | * loc2c.c (declare_noncontig_union): Only open struct when loc_noncontiguous.
* Fix build error with elfutils < 0.142.Roland McGrath2009-09-171-2/+4
| | | | | * loc2c.c [!_ELFUTILS_PREREQ (0,142)] (DW_OP_stack_value, DW_OP_implicit_value): Define as macros.
* Support DW_OP_implicit_value.Roland McGrath2009-09-171-31/+127
| | | | | | | | | | | | | | | * loc2c.c (struct location): Add loc_constant variant, with constant_block field. (translate): Handle DW_OP_implicit_value to make loc_constant pieces. (c_translate_location): Handle loc_constant. (discontiguify): Likewise. (location_relative): Likewise. (declare_noncontig_union): Likewise. (translate_base_fetch): Likewise. (c_translate_array): Likewise. (c_emit_location): Likewise. (emit_base_store): Refuse loc_constant. (c_translate_addressof): Likewise.
* Merge DW_OP_stack_value support.Roland McGrath2009-09-171-19/+65
|\ | | | | | | | | * loc2c.c (translate): Fix sense of _ELFUTILS_PREREQ test and clean up stub for DW_OP_implicit_value case, still not really implemented.
| * Unfinished nits in loc_value code.Roland McGrath2009-09-171-2/+11
| |
| * * loc2c.c: Handle DW_OP_stack_value. Untested and probably unfinished.Roland McGrath2009-09-161-3/+45
| |
* | dwarf_getlocation_implicit_value() was/will be introduced in elfutils 0.143.Mark Wielaard2009-09-171-2/+2
| | | | | | | | | | * loc2c.c (translate): _ELFUTILS_PREREQ(0,143). Clarify attr == NULL DIE message.
* | PR10417 Pass around attributes for supporting DW_OP_{implicit,stack}_value.Mark Wielaard2009-09-171-11/+36
|/ | | | | | | | | | | | | | | | | Preparation for retrieving the Dwarf_Block that holds the value of an DW_OP_implicit_value. We need the Dwarf_Attribute that is associated with the location expression operants. Depends on new elfutils 0.143 functionality. Recognizes, but does not yet handle the new operants DW_OP_{implicit,stack}_value. * loc2c.h (c_translate_location): Take an Dwarf_Attribute. * loc2c.c (c_translate_location): Likewise and pass it on. (location_relative): Likewise. (location_from_address): Likewise. (translate): Likewise and capture Dwarf_Block. * loc2c-test.c (handle_variable): Pass in Dwarf_Attribute. * dwflpp.cxx (translate_location): Likewise. (literal_stmt_for_return): Pass in NULL to indicate no attribute.
* Clean up dwflpp::translate_location workaround for DW_AT_data_member_location.Mark Wielaard2009-09-161-34/+0
| | | | | | | | | | | Do the same workaround as loc2c-test.c does. Just treat a constant member location offset as a DW_OP_plus_uconst and call c_translate_location for it. Also Remove c_translate_add_offset. * dwflpp.cxx (dwflpp::translate_location): Check elfutils version and only do workaround for elfutils < 0.142. * loc2c.h (c_translate_add_offset): Removed. * loc2c.c (c_translate_add_offset): Likewise.
* build fix: make buildable with elfutils < 0.142Frank Ch. Eigler2009-08-231-0/+16
| | | | | * dwarf_wrappers.h, loc2c.c: Define DW_TAG_rvalue_reference_type=0x42 for older elfutils.
* PR10461: Add support for C++ classes and referencesJosh Stone2009-08-211-1/+3
| | | | | | | | | | * dwarf_wrappers.cxx (dwarf_type_name): Name class and reference types. * dwflpp.cxx (dwflpp::iterate_over_globals): Capture class names. (dwflpp::print_members): Permit classes, and dig into inheritance. (dwflpp::find_struct_member): Ditto. (dwflpp::translate_components): Handle classes and references. (dwflpp::translate_final_fetch_or_store): Ditto. * loc2c.c (c_translate_pointer): Treat references as simple pointers.
* PR10475: ensure that loc2c can find its array sizeJosh Stone2009-08-031-0/+13
| | | | * loc2c.c (array_stride): iterate DIEs past typedef/const/volatile
* PR10388 Support DW_OP_call_frame_cfa.Mark Wielaard2009-07-151-8/+33
| | | | | | | | | | | | | | | | | | 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.
* PR4166: Allow array-like indexing on pointersJosh Stone2009-07-141-1/+2
| | | | | | | * 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
* Add support for constant struct member field offsets.Mark Wielaard2009-07-081-0/+31
| | | | | | | * 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.
* PR10348 Compilation failure with gcc 4.5 snapshot: switch jumps over vars.Mark Wielaard2009-07-071-4/+6
| | | | | | | * loc2c-test.c (print_vars): Define attr_mem, typedie_mem and typedie before switch. * loc2c.c (translate): Wrap case DW_OP_drop in block brackets. (location_relative): Initialize stack.
* Enable dwarf expansion of @castsJosh Stone2009-02-181-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This will iterate over the module and its CUs looking for the type definition, and then work with loc2c to dereference the pointer. * loc2c.c (c_translate_argument): Create a dummy location to start the address computation from a function parameter. * translate.cxx (base_query, dwarf_query): Move some members from base_query to dwarf_query, so the former can be more generic. Also add a constructor using a module string instead of probe parameters. (dwflpp::query_modules, dwflpp::iterate_over_modules): Use a generic base_query instead of a dwarf_query. (dwarf_cast_query): New query to scan the modules and CUs for a matching type definition, and then produce a code fragment to deref each component. (dwarf_cast_expanding_visitor): Tries to replace @casts with a function call to the result of a dwarf_cast_query. (dwflpp::declaration_resolve): Search by name instead of by die. (dwflpp::translate_components): Use the incoming vardie as the first type die, so we don't assume that attr_mem has a DW_AT_type already. (dwflpp::literal_stmt_for_pointer): Construct a C fragment that starts with a pointer argument (THIS->pointer) and dereferences each member component from there. (*_derived_probe::register_patterns): Take a session parameter instead of a match_node, so we can manipulate session-wide data. (dwarf_derived_probe::register_patterns): Add a session code filter to expand @casts with a dwarf_cast_expanding_visitor.
* Update a few more files with Vim modelinesJosh Stone2009-02-031-0/+2
|
* PR5516: assignment to $pointersfche2008-03-031-0/+31
| | | | | | | | | | | | | | | | | | | | | 2008-03-03 Frank Ch. Eigler <fche@elastic.org> PR5516 * elaborate.cxx (symbol_fetcher, dead_assignment_remover): Support unresolved $target lvalues. Propagate pretty error messages. * staptree.cxx (varuse_collecting_visitor target_symbol): Ditto. * staptree.h: Corresponding decl. * loc2c.c: c_translate_pointer_store: New function. * loc2c.h: Corresponding decl. * tapsets.cxx (dwflpp::translate_final_fetch_or_store): Call it for $target pointer assignments. 2008-03-03 Frank Ch. Eigler <fche@elastic.org> PR5516 * buildok/twentynine.stp: New test.
* 2007-10-15 Roland McGrath <roland@redhat.com>roland2007-10-151-13/+34
| | | | | | | | | | | PR 5101 * loc2c.c (struct location): Replace regno union member with struct member reg, fields regno and offset. (translate): Update uses. (emit_base_fetch, emit_base_store, emit_loc_register): Likewise. Fail if reg.offset is not zero. (location_relative): Handle DW_OP_plus_uconst relative to loc_register. (c_translate_array): Handle array index into loc_register.
* 2007-06-15 Frank Ch. Eigler <fche@elastic.org>fche2007-06-151-9/+7
| | | | | | | PR 3331 cont'd. * loc2c.c (base_encoding): Tolerate absenece of DW_AT_encoding. (c_translate_pointer): Don't even try to find signedness, assume unsigned.
* 2007-06-14 Frank Ch. Eigler <fche@elastic.org>fche2007-06-141-11/+40
| | | | | | | | | PR 3331 cont'd. * loc2c.c (emit_base_fetch): Emit size/signedness cast slightly differently for every low-level fetch. (translate_base_fetch, c_translate_fetch, c_translate_store, c_translate_pointer): Fetch & pass the $target signedness. (base_encoding): Follow typedefs etc.
* 2007-06-05 Frank Ch. Eigler <fche@redhat.com>fche2007-06-061-15/+38
| | | | | | | | | | | | | PR 3331. * loc2c.c (emit_base_fetch): Emit size/signedness cast for every low-level fetch. (translate_base_fetch, c_translate_fetch, c_translate_store, c_translate_pointer): Fetch & pass the $target signedness. 2007-06-05 Frank Ch. Eigler <fche@elastic.org> PR 3331. * systemtap.base/deref2.*: New test, disabled.
* 2007-03-30 Frank Ch. Eigler <fche@redhat.com>fche2007-03-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | PR 1570 * NEWS: Document probe handler language change re. inline functions. * stapprobes.5.in: Likewise. * tapsets.cxx: Many changes to simplify caches and implement new handling of inline functions, removed of stubs for future probes. * elaborate.cxx (derived_probe printsig_nested): New function. * elaborate.h: Declare it. * main.cxx (usage): Clarify "-r" meaning. (main): Tweak related "-p 4" message. 2007-03-30 Frank Ch. Eigler <fche@elastic.org> PR 1570. * memory.stp, scheduler.stp, signal.stp, LKET/signal.stp: Adapt to .inline -> .function change. 2007-03-30 Frank Ch. Eigler <fche@elastic.org> PR 1570 * */*.stp: Adapt to .inline -> .function change. * lib/stap_run.exp, stap_run2.exp, stap_run_binary.exp: Shorten pass/fail dejagnu log lines. * systemtap.syscall/sys.stp, test.tcl: Make slightly more compatible and failure more verbose.
* 2007-02-19 Frank Ch. Eigler <fche@elastic.org>fche2007-02-191-6/+12
| | | | | | | | | PR 4078 and more, including patch from Eugeniy Meshcheryakov <eugen@debian.org>: * Makefile.am (AM_CXXFLAGS, AM_CFLAGS): Add -Wextra -Wall -Werror consistently. * Makefile.in: Regenerated. (*): Many minor warning fixes.
* 2006-04-04 Roland McGrath <roland@redhat.com>roland2006-04-051-2/+2
| | | | * loc2c.c (array_stride): stride_size -> byte_stride
* 2005-11-27 Roland McGrath <roland@redhat.com>roland2005-11-281-0/+3
| | | | * loc2c.c (location_from_address): Diagnose null FB_ATTR specially.
* 2005-11-27 Roland McGrath <roland@redhat.com>roland2005-11-281-1/+1
| | | | * loc2c.c (location_from_address): Fix function name in error message.
* (location_from_address): w/s tweakroland2005-11-281-1/+1
|
* 2005-11-27 Frank Ch. Eigler <fche@elastic.org>fche2005-11-281-3/+3
| | | | * loc2c.c (location_from_address): Tolerate errors with NULL *input.
* 2005-11-26 Roland McGrath <roland@redhat.com>roland2005-11-271-17/+32
| | | | | | | | | | | * loc2c.c (struct location): Move frame_base member out of the union. (alloc_location): Initialize it. (new_synthetic_loc, translate, location_from_address): Update uses. (emit_loc_value): Don't handle frame_base here. (c_emit_location): Do it here instead. (translate): Track USED_DEREF separately for each piece. Use a temporary struct when allocating a new piece, letting a pending loc_address piece finish up first.
* 2005-11-26 Roland McGrath <roland@redhat.com>roland2005-11-271-0/+1
| | | | * loc2c.c (translate): Initialize LOC->address.used_deref at start.
* 2005-11-21 Roland McGrath <roland@redhat.com>roland2005-11-221-27/+5
| | | | | | | | | | * loc2c.c (c_translate_location): Take Dwarf_Op vector as argument directly, not Dwarf_Attribute.p * loc2c.h: Update decl. * loc2c-test.c (get_location): New function. (handle_variable): Use it. * tapsets.cxx (dwflpp::translate_location): New method. (dwflpp::translate_components, dwflpp::literal_stmt_for_local): Use it.
* 2005-10-31 Roland McGrath <roland@redhat.com>roland2005-10-311-11/+10
| | | | | | | | | | | | | | * configure.ac: Update libdw test to require 0.116 with dwarf_diecu. * configure: Regenerated. * systemtap.spec.in: Update elfutils requirement to 0.116. * loc2c.c: Dwarf_Loc -> Dwarf_Op. (location_from_address): dwarf_addrloclists -> dwarf_getlocation_addr. (c_translate_location): Likewise. (max_fetch_size): Remove fakeo dwarf_diecu macro. * tapsets.cxx (dwflpp): Dwarf_Func -> Dwarf_Die; dwarf_func_name -> dwarf_diename; dwarf_func_entrypc -> dwarf_entrypc; dwarf_func_file, dwarf_func_line -> dwarf_decl_file, dwarf_decl_line.
* 2005-10-26 Roland McGrath <roland@redhat.com>roland2005-10-261-1/+1
| | | | | * loc2c.c (max_fetch_size): Default to host pointer size, while still waiting for new libdw entrypoint.
* 2005-10-25 Roland McGrath <roland@redhat.com>roland2005-10-261-1/+1
| | | | | | | PR 1271 cont'd. * testsuite/buildok/twentytwo.stp: New file. * testsuite/buildok/twentythree.stp: New file. * loc2c.c (discontiguify): Add missing ; in output.
* 2005-10-14 Roland McGrath <roland@redhat.com>roland2005-10-141-133/+395
| | | | | | | | | | | | | | | | | | | | | | | | | | PR 1271. * loc2c.c (translate): Set LOC->byte_size in loc_noncontiguous result. (struct location.address): New member `declare'. (new_synthetic_loc, translate): Initialize it. (struct location.type): Add loc_fragment, loc_decl to enum. (c_emit_location): Emit unadorned code for loc_fragment. (discontiguify): New function. (c_translate_fetch, c_translate_store): Call it. (get_bitfield): New function, broken out of .... (emit_bitfield): ... here. Function removed. (declare_noncontig_union): New function. (max_fetch_size): New function. (translate_base_fetch): New function, broken out of ... (c_translate_fetch): ... here. Call it. Use get_bitfield here, not emit_bitfield. (c_translate_store): Likewise. (c_emit_location): Emit declarations first. * loc2c.c (dwarf_diename_integrate): Function removed. Change all callers to use dwarf_diename. 2005-10-13 Roland McGrath <roland@redhat.com> * loc2c.c (c_emit_location): Use final location's used_deref flag too. * loc2c.c (translate): Pass LOC to alloc_location, not INPUT.
* 2005-09-14 Frank Ch. Eigler <fche@elastic.org>fche2005-09-141-3/+3
| | | | | | | PR 1257 * Makefile.am (AM_CFLAGS): Add -fexceptions. * loc2c.c (c_translate_location): Invoke *fail properly. * Makefile.in: Regenerated.
* 2005-08-31 Graydon Hoare <graydon@redhat.com>graydon2005-09-011-1/+2
| | | | | | | | | PR systemtap/1258 * tapsets.cxx (dwflpp::literal_stmt_for_local): Support DW_TAG_enumeration_type tag as synonymous with DW_TAG_base_type. * loc2c.c (base_byte_size): Likewise. * testsuite/buildok/seven.stp: Adjust to work on UP kernels.
* 2005-08-18 Roland McGrath <roland@redhat.com>roland2005-08-181-1/+1
| | | | | | | * loc2c.c (c_translate_addressof): Take TYPEDIE instead of TYPEATTR. * loc2c.h: Update decl. * loc2c-test.c (handle_variable): Handle DW_TAG_pointer_type target for fetch.
* 2005-08-18 Roland McGrath <roland@redhat.com>roland2005-08-181-6/+25
| | | | | | | | | | | | | | | | * loc2c.c (struct location): New member `emit_address'. (alloc_location): Initialize new member from ORIGIN. (location_from_address): New argument EMIT_ADDRESS. Initialize new member. (translate): Use LOC->emit_address hook to format DW_OP_addr constant. (location_relative): Die if DW_OP_addr is used. (default_emit_address): New function. (c_translate_location): New argument EMIT_ADDRESS, pass it down. Use default_emit_address if argument is null. * loc2c.h: Update decl. * loc2c-test.c (handle_variable): Update caller. * tapsets.cxx (dwflpp::literal_stmt_for_local): Update caller. (dwflpp::loc2c_emit_address): New static method.
* 2005-08-17 Roland McGrath <roland@redhat.com>roland2005-08-181-60/+86
| | | | | | | | | | | | | PR systemtap/1197 * loc2c.c (struct location): New members `fail', `fail_arg'. (alloc_location): New function. Initialize those members. (new_synthetic_loc, translate): Use that instead of obstack_alloc. (location_from_address, location_relative): Likewise. (FAIL): New macro. Use it everywhere in place of `error'. * loc2c-test.c (fail): New function. (handle_variable): Pass it to c_translate_location. * tapsets.cxx (dwflpp::loc2c_error): New static method. (dwflpp::literal_stmt_for_local): Pass it to to c_translate_location.
* 2005-08-17 Roland McGrath <roland@redhat.com>roland2005-08-181-14/+11
| | | | | | | | | | | | | * loc2c.c (c_translate_fetch): Take TYPEDIE instead of TYPEATTR. (c_translate_store): Likewise. * loc2c.h: Update decls. * loc2c-test.c (handle_variable): Update callers. Look up type, resolve typedefs, and check that it's DW_TAG_base_type. * tapsets.cxx (dwflpp::literal_stmt_for_local): Likewise. * loc2c.c (base_byte_size): Add assert on expected DIE tag. (c_translate_array, c_translate_pointer): Likewise. * loc2c.h: Amend comments to explicitly state type DIE tags expected. * loc2c.c: #include "loc2c.h".
* 2005-08-10 Roland McGrath <roland@redhat.com>roland2005-08-111-8/+113
| | | | | | | | | | | * loc2c.c (emit_base_store): New function. (emit_bitfield): Rewritten to handle stores, change parameters. (c_translate_fetch): Update caller. (c_translate_store): New function. * loc2c-test.c (handle_variable): Grok "=" last argument to do a store. * loc2c.c (c_translate_location): Increment INDENT. (c_translate_pointer): Likewise. (emit_loc_value): Increment INDENT after emit_header.
* 2005-08-02 Roland McGrath <roland@redhat.com>roland2005-08-031-7/+9
| | | | | | * loc2c.c (emit_bitfield): Return bool, value from emit_base_fetch. (c_translate_fetch): Update caller. (c_translate_pointer): Never ignore emit_base_fetch return value.
* 2005-08-02 Frank Ch. Eigler <fche@elastic.org>fche2005-08-021-0/+2
| | | | | | | | | * loc2.c (emit_loc_address): Emit interleaved declaration into its own nested { } block. * tapsets.cxx (literal_stmt_for_local): Emit deref_fault block unconditionally. * tapset/builtin_hexstring.stp: New builtin. * testsuite/buildok/six.stp: New test.