Commit Graph

72 Commits

Author SHA1 Message Date
d3d2faf680 globally rename Fail* to FAIL*
Change-Id: Ief2cb687cc69dd92c2e04f9314f0f1347e0a84ed
2016-07-26 17:41:32 +02:00
69da134956 Merge branch 'wsos' 2016-03-15 23:16:42 +01:00
927d6a5103 import-trace: import symbol size if available
Instead of using the address difference between two neighboring symbols as
an indication for the symbol's size, import the size as reported by
`nm -S'.

Additionally, this change fixes an off-by-one, which had the effect that
the last symbol in the list was not imported at all.

Change-Id: I3c8e139b788018702526bb968e36d248dc3fe8fc
2016-03-11 19:07:39 +01:00
806c71580f import-trace: add import of ELF symbols
This change adds the capability to import an ELF's symbols
into the database. The functionality is implemented via a
shell script and will be merged into "import-trace", when
it's being cleaned up sometime in the near future, but for
now this suffices.

Change-Id: I933783659674fcf31f5181fc13661fe10f5b9fe8
2016-03-11 19:01:17 +01:00
2c176715ed import-trace: code comments + --help clarifications
Change-Id: I796969f2dc8c7e440c9f9bd5434cbe09834057db
2016-01-29 18:06:41 +01:00
b6db95ffaa import-trace: objdump importer cut off long lines
Sometimes the lines in an objdump can get very long. Therefore, we limit
the size of the field, which is put into the database, to the maximal
size of the opcode, instruction, and comment column.

Change-Id: I8d7db33e8319f71e9dae14f683bba0ce1654b1f8
2015-09-18 12:51:55 +02:00
b01a5e80fd import-trace: initialize all members
This was never a real problem, but keeps us on the safe side.  Found
by Coverity Scan, CID 25731/25808/25817.

Change-Id: Ie4bd9fb52ff6140ce7ae024738b43c82f6f5045c
2015-02-07 17:29:53 +01:00
41a191eeaa import-trace: fix SQL value list termination
This fixes the (never intendedly occurring) case that no comma is
found in the SQL value list, and aligns the termination code with the
comment next to it.  Found by Coverity Scan, CID 25653.

Change-Id: I98062748458a50603cd63a9017acd94eef0753f9
2015-02-07 17:29:52 +01:00
8e5cd0d632 import-trace: check 2nd cmd.parse() return value
As the first cmd.parse() call was already checked before, parsing a
second time should never fail.  Nevertheless, we can look at the
return value without much effort.  Found by Coverity Scan, CID 25509.

Change-Id: I58466f5d123da2b541a6a88b72bafa1f754a581e
2015-02-07 17:29:50 +01:00
36d9e77c96 import-trace: extend sanity checks to time1/2
Up to now, the sanity checks only tested equivalence classes
determined by dynamic instructions (instr1/instr2), although the
actual timing boundaries (time1/time2) have been the really relevant
information for quite some time now.  This change extends the checks
to time1/time2.

Change-Id: I53d1ed10684ff09f6b9f1245ef842dd0d85f2655
2014-11-07 11:40:53 +01:00
569dd3328b import-trace: sanity-check speedup
The sanity check testing whether the fault space is rectangular is
unnecessarily slow, as it joins the "trace" table without any reason,
and includes all variants instead of the currently imported one.

Change-Id: Icfe948290ec595209868952fc1639c979bd78d83
2014-11-07 11:37:49 +01:00
d30ffdd3e5 import-trace: sanity-check code deduplication
Change-Id: I098981dfe93d760e3a423a374be05dbad3ee9cc1
2014-11-07 11:29:50 +01:00
5378573b1d util/DwarfReader, ElfImporter: import address ranges
This change implements the following:
-DwarfReader now exports the address range of linetable-entries instead of
	only the first address
-ElfImporter saves this range alongside the mapping

Change-Id: I7fe6361178f761a8f605a44bb0183c56a236cc95
2014-10-22 15:42:05 +02:00
d94b005be2 util/DwarfReader, ElfImporter: use unsigned addresses
This change alters DwarfReader and import-trace's ElfImporter so that they use
unsigned int for static address and line numbers instead of signed int.

Change-Id: I84ebbb500afd7cd4d93b137a35dcf736dc679fab
2014-10-22 14:30:43 +02:00
8fcbc7eeae import-trace: ElfImporter cleanups
-  added several insert_multiple() flushes (which completely broke
    the import before)
 -  import_source_code() refactored
 -  parameter naming improved
 -  better error handling
 -  whitespace/coding-style cleanups
 -  documentation added + cleanups

Change-Id: I70ac95391b9678e0dcce8adfa7df69a4f91ca30d
2014-10-15 11:42:29 +02:00
31166f990e import-trace: fix source line mapping to file IDs
Up to now, source code lines and mappings from static instruction
addresses to lines could be linked to the wrong file if
dbg_filename.path contained duplicates.  This is unfortunately the
normal case when importing multiple variants of the same program into
the database.

Change-Id: I57e71379584d7b01177606192b3aa644846225db
2014-10-08 13:08:05 +02:00
99f5d2833e ElfImporter: removed --debug, refactored code
This change removes the "--debug" parameter, which previously imported the
mapping of source code lines to static instructions into the database. This
mapping is useless by itself (i.e. without "--sources"), which is why its
code was refactored into the code handling "--sources".

Change-Id: I4700eb0a98661f4df9eb3c190f00dcbe4df0e200
2014-10-07 13:28:03 +02:00
b0e13b17c9 tools: abort at unknown cmdline parameters
This change makes all C++-based tools in tools/ abort when they
encounter an unknown commandline parameter (both option or
non-option).  This has already caused some confusion, as in some cases
unexpected behaviour can be the result.  For example, "prune-trace -t
mytrace.tc -d database" up to now ignored the "-t" parameter, took
"mytrace.tc" as the first non-option parameter (and ignored it); as no
option parameter may follow the non-option parameters, all other
options were ignored as well.

Change-Id: Ia0812a518c4760fa28ed54979c81f43fa7aa096e
2014-09-25 17:14:08 +02:00
ad0a15855d import-trace: log output number formatting fixed
Change-Id: Ifb81df86cb16254c04c946fa2cefca7030d2dd7a
2014-06-26 13:52:39 +02:00
7394a2cd53 import-trace: let RegisterImporter ignore unknown IP
This change makes the RegisterImporter continue importing if it
encounters an instruction pointer that is not part of the disassembled
ELF binary (and, thus, cannot be disassembled).  This is OK if we
don't want to inject into registers used by these instructions.

Change-Id: Ia9b5e7f789367f8386d63f235451dae5d399610d
2014-06-26 13:52:18 +02:00
73843fa634 import-trace: help sports all available importers
This change extends import-trace's help functionality for importers,
adds the ?-operator to option "-i" and refactors main.cc a little.
The extensions are "doing something useful with the AliasedRegistry"
and are merely listings of all importers' prime aliases.

Change-Id: I7bb184fc45dd9f90664e37455edfccc704d99ef1
2014-04-25 08:34:01 +02:00
af92a751d9 import-trace: alias-based (importer) registry
This change implements a generic registry in order to clean up import-trace's
code - it's possible (and reasonable) to use the registry for pruners as well.
Importer now extends AliasedRegisterable; all importers have been adapted
to suit the interface/abstract methods.
Each AliasedRegisterable should have at least one alias (the class' name
is a sensible choice) but can have several. The first specified alias is
the class' prime alias which can be used e.g. to list all registered objects.

Change-Id: If6daa34edce35a3b0194e4ba67ed3b44b74a49b0
2014-04-25 08:34:01 +02:00
11f77f0228 tools/import-trace: FullTraceImporter added
The FullTraceImporter imports every ip-event into the database.

Change-Id: I1c0ce2a0aae72dcd925930861780f2719d37b985
2014-04-05 16:57:13 +02:00
84a03b55ff import-trace: limit to general-purpose registers
This change limits fault injection to general-purpose registers, instead of
relying on the LLVM/Fail* bridge to only recognize the status register
(EFLAGS on x86) and general-purpose registers.  Since this bridge just
learned to translate x86's control and segment registers, and these
registers need special handling for fault injection (def/use pruning does
not work here), only import register accesses from the RT_GP subset.

Status register and instruction pointer injection remain functional, and
import-trace now should work architecture independently.

Change-Id: Id8ad2f0a9dab1861bf16ea9443c3bdfe7213d3fa
2014-03-26 17:18:18 +01:00
1df43e9726 import-trace: major speedup
Using Database::insert_multiple() instead of prepared statements
speeds up trace import by a factor of 3-4.  While being there, we now
properly deal with nonexistent extended trace values (i.e., put NULLs
into the DB).

Side note: The ElfImporter should switch to insert_multiple(), too.

Change-Id: I96785e9775e3ef4f242fd50720d5c34adb4e88a1
2014-02-25 13:32:55 +01:00
b4f144745a Revert "import-trace: emit warning for malformed traces"
Memory accesses that don't belong to the preceding IP event in the
trace *do* have a use case:  a hardware interrupt causes the CPU to
push its state onto the (kernel) stack.  At the moment we cannot
distinguish this case from a malformed trace (as we don't record the
occurrence of interrupts), hence this warning needs to be disabled for
now.

This reverts commit 84edd02b6f.
2014-02-11 14:57:29 +01:00
13175c259b import-trace: import debug info
If the --debug option is set, the line number table of the elf binary will
be imported into the database. The information will be stored in the
"dbg_mapping" table.

If the --sources option is set, the source files will be imported
into the database. Only the files that were actually used in the
elf binary will be imported.

Change-Id: I0e9de6b456bc42b329c1700c25e5839d9552cdbb
2014-01-28 11:07:34 +01:00
4cb97a7fa5 formatting, typos, comments, details
Change-Id: Iae5f1acb653a694622e9ac2bad93efcfca588f3a
2014-01-22 13:08:13 +01:00
84edd02b6f import-trace: emit warning for malformed traces
The Fail* tools expect trace events to be ordered in a specific way:
memory-access events are supposed to come *after* the instruction
event for the instruction that caused them.  Using a different order
may cause subtle problems with both fault-space pruning and fast
forwarding.  This change introduces a warning message when such a
malformed trace is detected (i.e., when the instruction pointer of a
memory-access event does not match the preceding instruction event).

Change-Id: I8ae7420fd8ff26e2574590748bdcc5a63db76490
2014-01-20 21:34:06 +01:00
8b6d744a3e import-trace: fix for using non-gzipped traces
As non-gzipped trace files cause import-trace to always import zero
events, the input file is now openend as in the dump-trace tool, where
opening non-gzipped files obviously works fine.

In the medium term we should find a centralized solution for this,
instead of re-implementing it all over the place.

Change-Id: I75845c03c0bbdc2b6b578b83d492b7dbbb40f051
2013-12-04 12:00:21 +01:00
c000b50101 Merge branch 'tracing-off-by-one' 2013-10-28 18:37:07 +01:00
148b09be2e tools/import-trace: added ElfImporter
The ElfImporter is not a real trace importer, but we locate it
into the import-trace utility, since here the infrastructure is
already in place to import things related to an elf binary into
the database.

The ElfImporter calls objdump and dissassembles an elf binary
and imports the results into the database.

Change-Id: I6e35673c8dbee3b7e8dfc7549d10e5dca9b55935
2013-10-24 15:30:17 +02:00
22b9646b80 import-trace: dynamic instruction off-by-one
Richard noticed that instr2 values are off by one when done with the
MemoryImporter vs. with his own importer.  The core problem is that
the dynamic instruction counter in the Importer base class
(Importer::copy_to_database, instruction_count_t instr) gets increased
*after* reporting an IP event to the importer implementation; this has
the side-effect that memory access events have a +1 dynamic
instruction count offset with regard to the IP event of the
instruction they belong to.

Bottom line: IP events and all memory events belonging to that
instruction should have the same dynamic instruction number.
Christian argued for the numbers starting with 0, which, as a side
effect, relativizes the repercussions of the change introduced in the
previous commit, as the new "first" event gets the sequence number 0
now.

 -  All experiments and importers only dealing with memory accesses
    (MemoryImporter) are affected by this change:  The dynamic
    instruction count now starts with 0 instead of 1.  Together with
    the previous commit, the only change is one additional dynamic
    instruction at position 0.  Note that existing trace files do not
    have this additional instruction, which shifts all trace positions
    by 1.

 -  All importers that process *only* IP events (InstructionImporter,
    RandomJumpImporter, RegisterImporter) won't see any difference.
    Commit 036e340, though, introduced a +1 offset.

 -  Experiments that use these instruction counts for navigating to
    the target instruction must be checked to properly deal with the
    dynamic instruction #0 (no forwarding necessary).  All dynamic
    instruction offsetting should now work uniformly for both memory
    accesses and all other fault models.  To be sure everything works
    in order, sanity-check the current absolute instruction pointer
    right before fault injection.

Change-Id: I3f509f1b47836fa78fd029a7bb7c36c878912d97
2013-10-17 18:28:40 +02:00
e636924d0f import-trace: reparse parameters after importer instantiation
Without this change, import-trace won't recognize, e.g., the -e and -t
parameters if they come after a parameter that was added by the Importer:

import-trace -i objdump --objdump arm-none-eabi-objdump -e B.elf -t C.tc
[...]
[import-trace 14:37:32] couldn't open trace.pb

Change-Id: I9532b01e432055479c79d801b1ca2736a8fd21cc
2013-10-14 14:43:47 +02:00
3307828690 import-trace: fixes for build on amd64
"std::vector<T>::size_type" is compatible to "unsigned int" on ia32,
but not on amd64.

Change-Id: I7d0f96780f7c17757dcfd015a1b3f9d5a3947f1a
2013-09-18 17:13:08 +02:00
aec5798f32 remove accidental checkin
Change-Id: I3cc42e153070b78bcea7df08ef2eddd1c838776c
2013-09-12 20:31:26 +02:00
014684ae1c L4Sys: check Bochs AS ID for mem accesses, too
Change-Id: Ifa2b38dc0e762ff4f956dc0b98c78b43f0d139cb
2013-09-12 20:29:08 +02:00
00f920f487 merge conflict resolved
... I somehow missed that one, sorry.

Change-Id: I2daf6f9215f34e39090145ff70e70eaf84d0f286
2013-09-12 09:52:34 +02:00
ec969603d5 Merge commit 'dcd2c021a5ac91d38187d397914e5f51e2fc8819'
Conflicts:
	tools/import-trace/RegisterImporter.cc

Change-Id: I4f49c976bd60badba73c15746aa03c420cb9f77b
2013-09-11 14:38:55 +02:00
04e96b977c tools/import-trace: add --do-not-split option to RegisterImporter
The RegisterImporter splits each register into 1 byte chunks. The
--do-not-split flag prohibits this splitting. Be aware, that def/use
pruning won't work correctly in mixed-width cases (EAX/AX/AH/AL).

Change-Id: Ifa1930bdd9f317a6fd3ae50c4ff3cffc97504640
2013-09-11 10:30:01 +02:00
d961ac0a72 import-trace: add --no-write-ecs switch
If you only need raw failure counts, no-effect write equivalence classes
are redundant and only slow down access to the trace and fspgroup tables.
This switch prevents any accesstype='W' entries from finding their way into
the trace table.

Change-Id: Ifb415994063a2107769bc80ebd2fd780de5a4dda
2013-09-10 17:43:12 +02:00
d39a9278ff import-trace: split into public and protected iface
Change-Id: I4b7d15f9181b1485d0546a77bd8d4f400b2fa880
2013-09-10 17:37:26 +02:00
64b3af299e import-trace: sliding-window AdvancedMemoryImporter
Initially this was implemented by directly passing through trace
events to the MemoryImporter, keeping a record of conditional jumps
and opcodes, and UPDATEing all inserted rows in a second pass when the
MemoryImporter is finished.

Unfortunately, UPDATE is very slow, and keeping all information in
memory till the end doesn't scale indefinitely.  Therefore the
implementation now delays passing memory access events upwards to the
MemoryImporter only until enough branch history is aggregated, and
taps into Importer's database operations with a set of new virtual
functions that are called downwards.

Change-Id: I159b2533932087087fb3049f4ff07a5f17a25a00
2013-09-10 17:37:26 +02:00
ba7c663551 import-trace: introduce AdvancedMemoryImporter
A MemoryImporter that additionally imports Relyzer-style conditional
branch history, instruction opcodes, and a virtual
duration=time2-time1+1 column (MariaDB 5.2+ only) for fault-space
pruning purposes.

Change-Id: I6764a26fa8aae21655be44134b88fdee85e67ff6
2013-09-10 17:37:26 +02:00
12b539ff75 misc cleanups
This change touches several subsystems, tools and experiments
(sal, util, cmake, import-trace, generic-tracing, nanojpeg), and
changes details not worth separate commits.

Change-Id: Icd1d664d1be5cfc2212dbf77801c271183214d08
2013-09-10 17:37:25 +02:00
25d88bf93a import-trace: import extended traces
This tool can now import extended trace information with the
--extended-trace command-line parameter.  The existing importers cease
using artificial access_info_t objects in favor of passing through the
original Trace_Event wherever possible.  This allows us to import
extended trace information for all importers.

Change-Id: I3613e9d05d5e69ad49e96f4dc5ba0b1c4ef95a11
2013-09-10 17:37:25 +02:00
96f2f56d5e Merge branch 'register-mapping-fixes' 2013-09-10 11:46:58 +02:00
11513ef78d util: handle missing register mapping gracefully
It's OK if we cannot map every register LLVM knows to a Fail register
ID, but we need to explicitly skip these cases in the
RegisterImporter.

Change-Id: I2152f819fb94aa4de5720c5798b229b66988d382
2013-09-09 16:14:35 +02:00
f33789b1ac Merge branch 'find-mysql' 2013-09-04 13:09:48 +02:00
203ec6c5cc remove #ifndef __puma from code using LLVM
Contemporary AspectC++ versions can deal with the LLVM headers very
well, and #ifdef __puma stuff in Fail* headers results in
unmaintainable #ifdef __puma blocks in other parts of Fail* (e.g., the
trace importer).

Make sure you're using a 64-bit ac++ when living in a 64-bit userland
(the 32-bit version doesn't know about __int128), and be aware that
AspectC++ r325 introduced a regression that has not been fixed yet.

Change-Id: I5bb759b08995a74b020d44a2b40e9d7a6e18111c
2013-09-04 10:13:48 +02:00