summaryrefslogtreecommitdiffstats
path: root/loc2c.c
Commit message (Collapse)AuthorAgeFilesLines
* Swap DW_OP_shr and DW_OP_shra.Roland McGrath2010-01-191-2/+2
| | | | * loc2c.c (translate): DW_OP_shr is unsigned, DW_OP_shra is signed.
* Use signed division for DW_OP_div.Roland McGrath2010-01-191-1/+10
| | | | * loc2c.c (translate): Use signed division for DW_OP_div.
* Fix multi-piece constant failure in vta-test.exp on 32bit systems.Mark Wielaard2010-01-071-38/+38
| | | | | | | | | | | | | | | | | | | | | | | Commit 73b5e9 "Make sure loc2c declare_noncontig_union for different locs don't overlap", wasn't complete. It only took into account having a piece becuase of a noncontiguous loc and a constant loc together. But pieces can be nested deeper (newer gcc outputs multiple constant locations for one piece on 32bit systems). This patch keeps track of the piece declaration depth. Another approach could have been to have each sub-piece in its own local scope, but keeping track of the depth and naming the temporary unions distinct fitted the current code better. It currently only supports a depth of 10. An error will be emitted if a location construct needs more than 10 pieces to be assembled. * loc2c.c (declare_noncontig_union): Take depth argument. Always use the same name for the union (u_pieces<depth>). (translate_base_fetch): Take depth argument. Use it to calculate union names. (translate_base_store): Likewise. (c_translate_fetch): Pass in depth zero. (c_translate_store): Likewise. (c_translate_pointer): Likewise. (c_translate_pointer_store): Likewise.
* PR10601: comment on loc2c's use of [u]intptr_t for temp valuesFrank Ch. Eigler2009-12-201-0/+7
|
* Begin to parameterize loc2c for proper DWARF target address size.Roland McGrath2009-12-091-4/+15
| | | | | | * loc2c.c (stack_slot_type): New function. (translate): Use it in place of STACK_TYPE and UTYPE macros. (emit_loc_address, emit_loc_value, c_emit_location): Likewise.
* Fix uninitialized fields in loc2c.Roland McGrath2009-11-241-0/+6
| | | | | * loc2c.c (alloc_location, location_from_address, c_translate_constant): Initialize ops and nops fields.
* PR6979: fix loc2c handling of second and later piecesRoland McGrath2009-11-111-29/+39
| | | | * loc2c.c (translate): Reset stack state tracking after finishing each piece.
* 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.