4 * General fault observer functions
6 * (c) 2011-2013 Björn Döbel <doebel@os.inf.tu-dresden.de>,
7 * economic rights: Technische Universität Dresden (Germany)
8 * This file is part of TUD:OS and distributed under the terms of the
9 * GNU General Public License 2.
10 * Please see the COPYING-GPL-2 file for details.
13 #include "observers.h"
14 #include "../configuration"
17 Romain::ObserverFactory::CreateObserver(char const *name)
19 #define CASE(string, object) \
21 if (strcmp(name, string) == 0) { \
26 CASE("simple", new SimpleDebugObserver());
27 CASE("trap", new TrapObserver());
28 CASE("vcpu_state", new PrintVCPUStateObserver());
29 CASE("pagefaults", new PageFaultObserver());
30 CASE("syscalls", new SyscallObserver());
31 CASE("swifi", SWIFIObserver::Create());
32 CASE("kip-time", KIPTimeObserver::Create());
33 CASE("trap_limit", TrapLimitObserver::Create());
34 CASE("threads", PThreadLockObserver::Create());
35 CASE("replicalog", new ReplicaLogObserver());
38 if (strcmp(name, "gdb") == 0) {
39 int port = ConfigIntValue("gdbstub:port");
40 if (port > 0) { // want TCP connection
41 return new Romain::GDBServerObserver(new Romain::TCPConnection(port));
42 } else { // want serial line
43 return new Romain::GDBServerObserver(new Romain::SerialConnection());
48 enter_kdebug("no observer found.");
55 bool Romain::Observer::entry_reason_is_int3(L4vcpu::Vcpu* vcpu,
56 Romain::App_instance *,
57 Romain::App_model *am)
60 * Some other debugger component might already have
61 * replaced the opcode with sth. different (e.g., for emulating
62 * a breakpoint. In this case everything has become invalid
63 * right now and we skip, too.
65 l4_addr_t remote = vcpu->r()->ip - 1;
66 unsigned char op = *(unsigned char*)am->rm()->remote_to_local(remote, 0);
67 return (vcpu->r()->trapno == 3) && (op == 0xCC);