ETISS 0.11.2
ExtendableTranslatingInstructionSetSimulator(version0.11.2)
Loading...
Searching...
No Matches
VirtualStruct.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-3-Clause
2//
3// This file is part of ETISS. It is licensed under the BSD 3-Clause License; you may not use this file except in
4// compliance with the License. You should have received a copy of the license along with this project. If not, see the
5// LICENSE file.
6
10#include "etiss/fault/Fault.h"
11
12namespace etiss
13{
14
16
17VirtualStruct::Field::Field(VirtualStruct &parent, const std::string &name, const std::string &prettyname, int flags,
18 size_t width, size_t bitwidth)
19 : parent_(parent)
20 , name_(name)
21 , prettyname_(prettyname)
22 , flags_(flags)
23 , width_(width)
24 , bitwidth_(bitwidth ? bitwidth : width * 8)
26{
27}
28
29VirtualStruct::Field::Field(VirtualStruct &parent, const std::string &name, const std::string &prettyname, int flags,
30 size_t width, bool virtual_enabled, std::function<uint64_t()> lread,
31 std::function<void(uint64_t)> lwrite, size_t bitwidth)
32 : parent_(parent)
33 , name_(name)
34 , prettyname_(prettyname)
35 , flags_(flags)
36 , width_(width)
37 , bitwidth_(bitwidth ? bitwidth : width * 8)
38 , accessMode_(virtual_enabled ? VirtualStruct::Field::PREFER_LAMBDA : VirtualStruct::Field::LAMBDA)
39 , lread(lread)
40 , lwrite(lwrite)
41{
42}
43
45
47{
48
49 if (!(flags_ & R))
50 std::runtime_error("VirtualStruct::Field::write called but the write flag is not set");
51
52 uint64_t ret;
53 switch (accessMode_)
54 {
55 case LAMBDA:
56 if (lread)
57 {
58 ret = lread();
59 }
60 else
61 {
62 throw std::runtime_error(
63 "VirtualStruct is configured to use lambda expressions but no read function was provided.");
64 }
65 break;
66 case PREFER_LAMBDA:
67 if (lread)
68 {
69 ret = lread();
70 break;
71 }
72 case VIRTUAL:
73 ret = _read();
74 break;
75 default:
76 throw std::runtime_error("invalid enum value");
77 }
78 // call listeners
79
80 return ret;
81}
83{
84
85 if (!(flags_ & W))
86 throw std::runtime_error("VirtualStruct::Field::write called but the write flag is not set");
87
88 if (accessMode_ == LAMBDA && !lwrite) // throw error before calling listeners
89 throw std::runtime_error(
90 "VirtualStruct is configured to use lambda expressions but no read function was provided.");
91
92 switch (accessMode_)
93 {
94 case LAMBDA:
95 if (lwrite)
96 {
97 lwrite(val);
98 }
99 else
100 {
101 // throw std::runtime_error("VirtualStruct is configured to use lambda expressions but no read function was
102 // provided."); moved to start of function
103 }
104 break;
105 case PREFER_LAMBDA:
106 if (lwrite)
107 {
108 lwrite(val);
109 break;
110 }
111 case VIRTUAL:
112 _write(val);
113 break;
114 }
115
116 signalWrite();
117}
118
120{
121 for (auto l : listeners)
122 {
123 if (l.first)
124 {
125 l.first->write(*this, read());
126 }
127 }
128}
129
130bool VirtualStruct::Field::applyBitflip(unsigned position, uint64_t fault_id)
131{
132 if (!(flags_ & F))
133 return false;
134
135 switch (accessMode_)
136 {
137 case LAMBDA:
138 case PREFER_LAMBDA:
139 case VIRTUAL:
140 return _applyBitflip(position, fault_id);
141 }
142 return false;
143}
144
146 std::string &errormsg)
147{
148 if (!(flags_ & (A | F)))
149 {
150 errormsg = "field doesn't support action handling";
151 return false;
152 }
153 return _applyAction(f, a, errormsg);
154}
155
157{
158 throw std::runtime_error("VirtualStruct::Field::_read called but not implemented");
159}
161{
162 throw std::runtime_error("VirtualStruct::Field::_write called but not implemented");
163}
164bool VirtualStruct::Field::_applyBitflip(unsigned position, uint64_t fault_id)
165{
166 if (!(flags_ & F))
167 return false;
168 if (lapplyBitflip)
169 return lapplyBitflip(position, fault_id);
170 if ((flags_ & RW) != RW)
171 return false;
172 uint64_t val = read();
173 uint64_t errval = ((uint64_t)1) << position;
174 errval = val ^ errval;
175 write(errval);
176 std::stringstream ss;
177 ss << "Injected bitflip in " << name_ << " 0x" << std::hex << val << "->0x" << errval << std::dec;
178 etiss::log(etiss::INFO, ss.str());
179 return true;
180}
182 std::string &errormsg)
183{
184 if (a.getType() == +etiss::fault::Action::type_t::MASK)
185 {
186 uint64_t mask_value = a.getMaskValue();
187 uint64_t val = read(), errval;
188 switch (a.getMaskOp())
189 {
190 case etiss::fault::Action::mask_op_t::AND:
191 errval = (val & mask_value);
192 break;
193 case etiss::fault::Action::mask_op_t::OR:
194 errval = (val | mask_value);
195 break;
196 case etiss::fault::Action::mask_op_t::XOR:
197 errval = (val ^ mask_value);
198 break;
199 case etiss::fault::Action::mask_op_t::NAND:
200 errval = ~(val & mask_value);
201 break;
202 case etiss::fault::Action::mask_op_t::NOR:
203 errval = ~(val | mask_value);
204 break;
205 case etiss::fault::Action::mask_op_t::NOP:
206 errval = val;
207 break;
208 }
209 write(errval);
210 std::stringstream ss;
211 ss << "Injected mask fault in " << name_ << " 0x" << std::hex << val << " " << a.getMaskOp() << " 0x"
212 << mask_value << "->0x" << errval << std::dec;
213 etiss::log(etiss::INFO, ss.str());
214 return true;
215 }
216 else if (a.getType() == +etiss::fault::Action::type_t::BITFLIP)
217 {
218 return applyBitflip(a.getTargetBit(), f.id_);
219 }
220 return false;
221}
222
223bool VirtualStruct::Field::addListener(Listener *listener, std::shared_ptr<Listener> ref)
224{
225 if (!(flags_ & Field::L))
226 return false;
227 listeners.insert(std::pair<Listener *, std::shared_ptr<Listener>>(listener, ref));
228 return true;
229}
230void VirtualStruct::Field::removeListener(Listener *listener, std::shared_ptr<Listener> ref)
231{
232 listeners.erase(std::pair<Listener *, std::shared_ptr<Listener>>(listener, ref));
233}
234
235VirtualStruct::VirtualStruct(void *structure, std::function<void(Field *)> dtor)
236 : structure_(structure), dtor_(dtor), closed(false)
237{
238}
240{
241 close(); // VSSync is locked in close. IF THIS CHANGES VSSync MUST BE INSTANTIATED HERE
242 for (auto iter = fields_.begin(); iter != fields_.end(); ++iter)
243 {
244 if (*iter)
245 {
246 if ((*iter)->delete_)
247 {
248 std::function<void(Field *)> del_ = (*iter)->delete_;
249 del_(*iter);
250 }
251 else
252 {
253 if (dtor_)
254 {
255 dtor_(*iter);
256 }
257 else
258 {
259 etiss::log(etiss::ERROR, "The delete function passed to etiss::VirtualStruct is null. This will "
260 "likely result in a memory leak.");
261 }
262 }
263 }
264 }
265}
266
268{
269
270 if (f == 0)
271 {
272 if (!noerrorprint)
273 etiss::log(etiss::VERBOSE, "NULL pointer passed to etiss::VirtualStruct::addField", ETISS_SRCLOC);
274 return false;
275 }
276
277 if (f->name_.empty())
278 {
279 if (!noerrorprint)
280 etiss::log(etiss::ERROR, "Failed to add an field to etiss::VirtualStruct due to empty name", f->name_,
282 return false;
283 }
284 if (fieldNames_.find(f->name_) != fieldNames_.end())
285 {
286 if (!noerrorprint)
287 etiss::log(etiss::ERROR, "Failed to add an field to etiss::VirtualStruct due to duplicated name", f->name_,
289 return false;
290 }
291 if ((!f->prettyname_.empty()) && (fieldPrettyNames_.find(f->prettyname_) != fieldPrettyNames_.end()))
292 {
293 if (!noerrorprint)
294 etiss::log(etiss::ERROR, "Failed to add an field to etiss::VirtualStruct due to duplicated prettyname",
296 return false;
297 }
298
299 fields_.push_back(f);
300 fieldNames_.insert(std::make_pair(f->name_, f));
301 if (!f->prettyname_.empty())
302 fieldPrettyNames_.insert(std::make_pair(f->prettyname_, f));
303 return true;
304}
305
306std::shared_ptr<VirtualStruct::Field> VirtualStruct::findName(const std::string &name) const
307{
308 VSSync lock;
309 if (closed)
310 return 0;
311
312 auto find = fieldNames_.find(name);
313 if (find != fieldNames_.end())
314 {
315 std::shared_ptr<const VirtualStruct> pref = shared_from_this();
316 return std::shared_ptr<VirtualStruct::Field>(find->second, [pref](VirtualStruct::Field *) {});
317 }
318 return std::shared_ptr<VirtualStruct::Field>();
319}
320std::shared_ptr<VirtualStruct::Field> VirtualStruct::findPrettyName(const std::string &name) const
321{
322 VSSync lock;
323 if (closed)
324 return 0;
325 auto find = fieldPrettyNames_.find(name);
326 if (find != fieldPrettyNames_.end())
327 {
328 std::shared_ptr<const VirtualStruct> pref = shared_from_this();
329 return std::shared_ptr<VirtualStruct::Field>(find->second, [pref](VirtualStruct::Field *) {});
330 }
331 return 0;
332}
333void VirtualStruct::foreachField(const std::function<void(std::shared_ptr<Field>)> &func)
334{
335 VSSync lock;
336 if (closed)
337 return;
338 std::shared_ptr<const VirtualStruct> pref = shared_from_this();
339 for (Field *f : fields_)
340 {
341 func(std::shared_ptr<Field>(f, [pref](VirtualStruct::Field *) {}));
342 }
343}
345{
347 {
348 return acceleratedTrigger_(t, fault_id);
349 }
350 else
351 {
352 }
353 return false;
354}
355bool VirtualStruct::mountStruct(const std::string &name, std::shared_ptr<VirtualStruct> vs)
356{
357 if (!vs)
358 return false;
359 VSSync lock;
360 // check for existing
361 {
362 auto find = subStructs_.find(name);
363 if (find != subStructs_.end())
364 {
365 if (find->second.lock())
366 {
367 return false;
368 }
369 }
370 }
371 if (vs->parent_) // already mounted elsewere
372 return false;
373 vs->parent_ = shared_from_this();
374 subStructs_.insert(std::pair<std::string, std::weak_ptr<VirtualStruct>>(name, vs));
375 return true;
376}
377std::shared_ptr<VirtualStruct> VirtualStruct::findStruct(const std::string &name)
378{
379 VSSync lock;
380 auto find = subStructs_.find(name);
381 if (find != subStructs_.end())
382 return find->second.lock();
383 return std::shared_ptr<VirtualStruct>();
384}
385void VirtualStruct::foreachStruct(const std::function<void(const std::string &name, VirtualStruct &vs)> &func)
386{
387 VSSync lock;
388 for (auto e : subStructs_)
389 {
390 auto sp = e.second.lock();
391 auto p = sp.get();
392 if (p)
393 {
394 func(e.first, *p);
395 }
396 }
397}
398
400{
401 VSSync lock;
402 closed = true;
403 // dont't delete fields here.
404}
406{
407 VSSync lock;
408 return closed;
409}
410
411std::list<std::string> VirtualStruct::listFields()
412{
413 std::list<std::string> ret;
415 [&ret](std::shared_ptr<Field> f)
416 {
417 if (f)
418 ret.push_back(f->name_);
419 });
420 return ret;
421}
422std::list<std::string> VirtualStruct::listSubInjectors()
423{
424 std::list<std::string> ret;
425 foreachStruct([&ret](const std::string &name, VirtualStruct &vs) { ret.push_back(name); });
426 return ret;
427}
428
429std::shared_ptr<etiss::fault::Injector> VirtualStruct::getSubInjector(const std::string &name)
430{
431 return findStruct(name);
432}
433std::shared_ptr<etiss::fault::Injector> VirtualStruct::getParentInjector()
434{
435 return parent_;
436}
437
438void *VirtualStruct::fastFieldAccessPtr(const std::string &name, std::string &errormsg)
439{
440 VSSync lock;
441 {
442 auto iter = fieldNames_.find(name);
443 if (iter != fieldNames_.end())
444 return iter->second;
445 }
446 {
447 auto iter = fieldPrettyNames_.find(name);
448 if (iter != fieldPrettyNames_.end())
449 return iter->second;
450 }
451 return 0;
452}
453bool VirtualStruct::readField(void *fastfieldaccessptr, uint64_t &val, std::string &errormsg)
454{
455 Field *f = (Field *)fastfieldaccessptr;
456 if (!f)
457 {
458 errormsg = "No such field";
459 return false;
460 }
461 if (!(f->flags_ & Field::R))
462 {
463 errormsg = "No read access";
464 return false;
465 }
466 val = f->read();
467 return true;
468}
470 std::string &errormsg)
471{
472 switch (action.getType())
473 {
474 case +etiss::fault::Action::type_t::COMMAND: // handle command
475 {
477 {
478 errormsg = getInjectorPath() +
479 ": VirtualStruct::applyCustomAction function not set. cannot handle custom actions.";
480 return false;
481 }
482 return applyCustomAction(fault, action, errormsg);
483 }
484 case +etiss::fault::Action::type_t::MASK:
485#if __cplusplus >= 201703L // in case of c++17 present we can use explicit fallthrough etc.
486 [[fallthrough]];
487#endif
488 case +etiss::fault::Action::type_t::BITFLIP: // handle bitflip
489 {
490 Field *f;
491 auto find = fieldNames_.find(action.getTargetField());
492 if (find == fieldNames_.end())
493 {
494 find = fieldPrettyNames_.find(action.getTargetField());
495 if (find == fieldPrettyNames_.end())
496 {
497 f = 0;
498 }
499 else
500 {
501 f = find->second;
502 }
503 }
504 else
505 {
506 f = find->second;
507 }
508
509 if (!f)
510 {
511 errormsg = std::string("No such field: ") + getInjectorPath() + "." + action.getTargetField();
512 return false;
513 }
514 if (f->flags_ & (Field::A | Field::F))
515 {
516 return f->applyAction(fault, action, errormsg);
517 }
518 }
519 return false;
520 default:
521 return false;
522 }
523}
524
525bool VirtualStruct::update_field_access_rights(const etiss::fault::Action &action, std::string &errormsg)
526{
527 Field *f = nullptr;
528 auto find = fieldNames_.find(action.getTargetField());
529 if (find == fieldNames_.end())
530 {
531 find = fieldPrettyNames_.find(action.getTargetField());
532 if (find != fieldPrettyNames_.end())
533 {
534 f = find->second;
535 }
536 }
537 else
538 {
539 f = find->second;
540 }
541
542 if (f)
543 {
544 switch (action.getType())
545 {
546 case +etiss::fault::Action::type_t::MASK:
547#if __cplusplus >= 201703L // in case of c++17 present we can use explicit fallthrough etc.
548 [[fallthrough]];
549#endif
550 case +etiss::fault::Action::type_t::BITFLIP:
551 f->flags_ |= Field::F;
552 break;
553 default:
554 break;
555 }
556 }
557 else
558 {
559 errormsg =
560 std::string("VirtualStruct:update_field_access_rights(): Required field not a field in VirtualStruct!");
561 return false;
562 }
563 return true;
564}
565
567{
568 mutex().lock();
569}
571{
572 mutex().unlock();
573}
574std::recursive_mutex &VSSync::mutex()
575{
576 static std::recursive_mutex mu;
577 return mu;
578}
579
580void copy(VirtualStruct &dst, VirtualStruct &src, std::list<std::shared_ptr<VirtualStruct::Field>> &notPresent,
581 std::list<std::shared_ptr<VirtualStruct::Field>> &notWriteable,
582 std::list<std::shared_ptr<VirtualStruct::Field>> unknown, bool pretend,
583 std::list<std::shared_ptr<VirtualStruct::Field>> *src_private,
584 std::list<std::shared_ptr<VirtualStruct::Field>> *dst_private)
585{
586
587 []() {}();
588
589 std::set<std::shared_ptr<VirtualStruct::Field>> dst_known;
590
591 src.foreachField(
592 [&](std::shared_ptr<VirtualStruct::Field> srcf)
593 {
594 if (srcf->flags_ & VirtualStruct::Field::P)
595 {
596 if (src_private)
597 src_private->push_back(srcf);
598 return;
599 }
600
601 auto dstf = dst.findName(srcf->name_);
602 if (dstf == 0)
603 {
604 notPresent.push_back(srcf);
605 return;
606 }
607
608 if (dstf->flags_ & VirtualStruct::Field::P)
609 {
610 notPresent.push_back(srcf);
611 return;
612 }
613
614 dst_known.insert(dstf);
615
616 if (!(dstf->flags_ & VirtualStruct::Field::W))
617 {
618 notWriteable.push_back(dstf);
619 return;
620 }
621
622 if (!pretend)
623 dstf->write(srcf->read()); // copy value
624 });
625
626 dst.foreachField(
627 [&](std::shared_ptr<VirtualStruct::Field> dstf)
628 {
629 if (dst_known.find(dstf) == dst_known.end())
630 {
631 if (dstf->flags_ & VirtualStruct::Field::P)
632 {
633 if (dst_private)
634 {
635 dst_private->push_back(dstf);
636 }
637 }
638 else
639 {
640 unknown.push_back(dstf);
641 }
642 }
643 });
644}
645
646std::shared_ptr<VirtualStruct> VirtualStruct::allocate(void *structure, std::function<void(Field *)> delete_)
647{
648 VirtualStruct *ret = new VirtualStruct(structure, delete_);
649
650 return std::shared_ptr<VirtualStruct>(ret, [](VirtualStruct *vs) { delete vs; });
651}
652
653std::shared_ptr<VirtualStruct> VirtualStruct::root()
654{
655 static std::shared_ptr<VirtualStruct> r = allocate(0, [](Field *) {});
656 return r;
657}
658
659std::shared_ptr<VirtualStruct> VirtualStruct::getVirtualStruct(const std::string &path)
660{
661 if (path.empty())
662 return shared_from_this();
663 std::shared_ptr<VirtualStruct> ret;
664 if (path.find_first_of(".") != std::string::npos)
665 {
666 // error
667 return ret;
668 }
669 auto pp1 = path.find("::");
670
671 if (pp1 == 0) // absolute path
672 {
673 auto ptr = parent_;
674 auto prev = shared_from_this();
675 while (ptr)
676 {
677 prev = ptr;
678 ptr = ptr->parent_;
679 }
680 return prev->getVirtualStruct(path.substr(pp1 + 2));
681 }
682
683 {
684 VSSync lock;
685 auto find = subStructs_.find((pp1 == std::string::npos) ? path : path.substr(0, pp1));
686 if (find != subStructs_.end())
687 {
688 ret = find->second.lock();
689 }
690 }
691
692 if (!ret)
693 return ret;
694
695 if (pp1 == std::string::npos)
696 {
697 return ret;
698 }
699 else
700 {
701 return ret->getVirtualStruct(path.substr(pp1 + 2));
702 }
703}
704
705std::shared_ptr<etiss::fault::Injector> etiss::fault::Injector::get(const std::string &path)
706{
707 return std::shared_ptr<etiss::fault::Injector>(VirtualStruct::root()->getVirtualStruct(path));
708}
709
710std::shared_ptr<VirtualStruct::Field> VirtualStruct::getResolvedField(const std::string &path)
711{
712 auto pp1 = path.find_first_of(".");
713 if (pp1 == std::string::npos) // if no point exists the this is not a path
714 return std::shared_ptr<VirtualStruct::Field>();
715
716 auto m = getVirtualStruct(path.substr(0, pp1));
717 if (!m)
718 return std::shared_ptr<VirtualStruct::Field>();
719
720 auto ret = m->findName(path.substr(pp1 + 1));
721 if (!ret)
722 ret = m->findPrettyName(path.substr(pp1 + 1));
723
724 return ret;
725}
726
727} // namespace etiss
contains an action class that describes actions associated with a fault
contains the fault container class that stores triggers and actions for fault injection
#define ETISS_SRCLOC
Definition Misc.h:202
contains the Trigger class that defines conditions under which actions of a Fault need to be applied.
static __inline__ uint64_t
Definition arm_cde.h:31
static __inline__ int32_t
Definition arm_mve.h:51
used for synchronization of the tree of virtual structs.
static std::recursive_mutex & mutex()
NOTE: etiss::CPUArch should implement support for Listeners by either using the etiss::VirtualStruct:...
a Field instance represents e.g.
static const int W
write flag
Field(VirtualStruct &parent, const std::string &name, const std::string &prettyname, int flags, size_t width, size_t bitwidth=0)
@ VIRTUAL
uses the virtual _read() / _write functions
bool applyAction(const etiss::fault::Fault &f, const etiss::fault::Action &a, std::string &errormsg)
advanced fault injection. Field must have the A flag to use this.
static const int A
supports advanced fault injection/tracing with the applyAction function
const std::string name_
name of the field.
virtual bool _applyBitflip(unsigned position, uint64_t fault_id)
override this function to implement bitflip applying to a field
const size_t width_
width in bytes (rounded up if neccessary)
void signalWrite()
this function should be called if the listener flag is set and the field changed without using the wr...
void removeListener(Listener *listener, std::shared_ptr< Listener > ref=nullptr)
static const int L
supports listener plugins; used for etiss::RegisterDevicePlugins to determine access to a variable/fi...
virtual uint64_t _read() const
override this function to implement reads in case of AccessMode::VIRTUAL / AccessMode::PREFER_LAMBDA
VirtualStruct & parent_
reference to parent virtual struct
int flags_
read write flags as specified by the static const int parameters of Field: R,W,L
bool addListener(Listener *listener, std::shared_ptr< Listener > ref=nullptr)
void write(uint64_t)
function to write bits/a value to the Field.
static const int P
private field: this flag indicates that this field is an implementation specific field that e....
bool applyBitflip(unsigned position, uint64_t fault_id)
function to write a bitflip to a field
static const int R
read flag
static const int F
supports fault injection/tracing
uint64_t read() const
function to read bits/a value from the Field.
const std::string prettyname_
alternative/human readable name of the field.
virtual bool _applyAction(const etiss::fault::Fault &f, const etiss::fault::Action &a, std::string &errormsg)
override this function to implement advanced action handling
const size_t bitwidth_
width in bits
virtual void _write(uint64_t)
override this function to implement writes in case of AccessMode::VIRTUAL / AccessMode::PREFER_LAMBDA
abstract representation of an module of a simulation which could be a embedded device of the cpu of a...
virtual bool readField(void *fastfieldaccessptr, uint64_t &val, std::string &errormsg)
read the value of a field
std::map< std::string, Field * > fieldNames_
std::map< std::string, Field * > fieldPrettyNames_
void foreachStruct(const std::function< void(const std::string &name, VirtualStruct &vs)> &func)
bool mountStruct(const std::string &name, const std::shared_ptr< VirtualStruct > vs)
std::shared_ptr< VirtualStruct > getVirtualStruct(const std::string &path)
virtual bool acceleratedTrigger(const etiss::fault::Trigger &, int32_t fault_id)
std::list< Field * > fields_
std::shared_ptr< Field > findName(const std::string &name) const
virtual bool applyAction(const etiss::fault::Fault &fault, const etiss::fault::Action &action, std::string &errormsg)
static std::shared_ptr< VirtualStruct > root()
std::map< std::string, std::weak_ptr< VirtualStruct > > subStructs_
bool addField(Field *f, bool noerrorprint=false)
static std::shared_ptr< VirtualStruct > allocate(void *structure, std::function< void(Field *)> delete_)
virtual std::list< std::string > listSubInjectors()
list all sub injectors.
virtual std::list< std::string > listFields()
list all fields directly reachable by this injector
std::function< void(Field *)> dtor_
virtual void * fastFieldAccessPtr(const std::string &name, std::string &errormsg)
void foreachField(const std::function< void(std::shared_ptr< Field >)> &func)
std::shared_ptr< VirtualStruct > parent_
std::shared_ptr< VirtualStruct::Field > getResolvedField(const std::string &path)
VirtualStruct(void *structure, std::function< void(Field *)> dtor=[](Field *f) { delete f;})
std::function< bool(const etiss::fault::Trigger &, int32_t)> acceleratedTrigger_
virtual std::shared_ptr< etiss::fault::Injector > getParentInjector()
get a the parent injector (root returns 0).
virtual bool update_field_access_rights(const etiss::fault::Action &action, std::string &errormsg)
Update the field of injector with access rights to allow action (used to get type of action).
std::shared_ptr< Field > findPrettyName(const std::string &name) const
std::function< bool(const etiss::fault::Fault &, const etiss::fault::Action &, std::string &)> applyCustomAction
set this function to handle custom commands passed by etiss::fault::Action of the type etiss::fault::...
std::shared_ptr< VirtualStruct > findStruct(const std::string &name)
virtual std::shared_ptr< etiss::fault::Injector > getSubInjector(const std::string &name)
get a sub injector.
const mask_op_t & getMaskOp() const
MASK only.
Definition Action.cpp:189
uint64_t getMaskValue() const
Definition Action.cpp:197
const std::string & getTargetField() const
BITFLIP only.
Definition Action.cpp:164
const type_t & getType() const
Definition Action.cpp:139
unsigned getTargetBit() const
BITFLIP only.
Definition Action.cpp:173
virtual std::string getInjectorPath()
returns the path of the current object.
Definition Injector.cpp:122
static ptr get(const std::string &injectorPath)
forwards: include/jit/*
Definition Benchmark.h:17
void copy(VirtualStruct &dst, VirtualStruct &src, std::list< std::shared_ptr< VirtualStruct::Field > > &dst_notPresent, std::list< std::shared_ptr< VirtualStruct::Field > > &dst_notWriteable, std::list< std::shared_ptr< VirtualStruct::Field > > dst_unknown, bool pretend=false, std::list< std::shared_ptr< VirtualStruct::Field > > *src_private=0, std::list< std::shared_ptr< VirtualStruct::Field > > *dst_private=0)
copies all fields with the same name from the source to the destination structure.
@ INFO
Definition Misc.h:87
@ VERBOSE
Definition Misc.h:88
@ ERROR
Definition Misc.h:85
void log(Verbosity level, std::string msg)
write log message at the given level.
Definition Misc.cpp:94
#define false
Definition stdbool.h:17