L4Re - L4 Runtime Environment
debugger
Go to the documentation of this file.
1 // vi:set ft=cpp: -*- Mode: C++ -*-
2 /**
3  * \file
4  * The debugger interface specifies common debugging related definitions.
5  */
6 /*
7  * (c) 2010-2011 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
8  * Alexander Warg <warg@os.inf.tu-dresden.de>
9  * economic rights: Technische Universit├Ąt Dresden (Germany)
10  *
11  * This file is part of TUD:OS and distributed under the terms of the
12  * GNU General Public License 2.
13  * Please see the COPYING-GPL-2 file for details.
14  *
15  * As a special exception, you may use this file as part of a free software
16  * library without restriction. Specifically, if other files instantiate
17  * templates or use macros or inline functions from this file, or you compile
18  * this file and link it with other files to produce an executable, this
19  * file does not by itself cause the resulting executable to be covered by
20  * the GNU General Public License. This exception does not however
21  * invalidate any other reasons why the executable file might be covered by
22  * the GNU General Public License.
23  */
24 #pragma once
25 
26 #include <l4/sys/debugger.h>
27 #include <l4/sys/kobject>
28 
29 namespace L4 {
30 
31 /**
32  * C++ debugger interface.
33  *
34  * \attention This API is subject to change! Do not rely on it in production
35  * code.
36  *
37  * \includefile{l4/sys/debugger}
38  */
39 class Debugger : public Kobject_t<Debugger, Kobject, L4_PROTO_DEBUGGER>
40 {
41 public:
42  enum
43  {
44  Switch_log_on = L4_DEBUGGER_SWITCH_LOG_ON,
45  Switch_log_off = L4_DEBUGGER_SWITCH_LOG_OFF,
46  };
47 
48  /**
49  * \copybrief l4_debugger_set_object_name()
50  *
51  * \param name Name
52  * \param utcb The UTCB to use for the operation.
53  *
54  * \return System call return tag.
55  */
56  l4_msgtag_t set_object_name(const char *name,
57  l4_utcb_t *utcb = l4_utcb()) throw()
58  { return l4_debugger_set_object_name_u(cap(), name, utcb); }
59 
60  /**
61  * \copybrief l4_debugger_global_id()
62  *
63  * \param utcb The UTCB to use for the operation.
64  *
65  * \retval ~0UL The capability is invalid.
66  * \retval >=0 The global debugger id.
67  */
68  unsigned long global_id(l4_utcb_t *utcb = l4_utcb()) throw()
69  { return l4_debugger_global_id_u(cap(), utcb); }
70 
71  /**
72  * \copybrief l4_debugger_kobj_to_id()
73  *
74  * \param kobjp Kobject pointer
75  * \param utcb The UTCB to use for the operation.
76  *
77  * \retval ~0UL The capability or the Kobject pointer are invalid.
78  * \retval >=0 The globally unique id.
79  */
80  unsigned long kobj_to_id(l4_addr_t kobjp,
81  l4_utcb_t *utcb = l4_utcb()) throw()
82  { return l4_debugger_kobj_to_id_u(cap(), kobjp, utcb); }
83 
84  /**
85  * \copybrief l4_debugger_query_log_typeid()
86  *
87  * \param name Name to query for.
88  * \param idx Idx to start searching, start with 0
89  * \param utcb The UTCB to use for the operation.
90  *
91  * \retval >=0 Id
92  * \retval <0 Error
93  */
94  int query_log_typeid(const char *name, unsigned idx,
95  l4_utcb_t *utcb = l4_utcb()) throw()
96  { return l4_debugger_query_log_typeid_u(cap(), name, idx, utcb); }
97 
98  /**
99  * \copybrief l4_debugger_query_log_name()
100  *
101  * \param idx ID to query.
102  * \param[out] name Buffer to copy name to. The buffer must be
103  * allocated by the caller.
104  * \param namelen Buffer length of name.
105  * \param[out] shortname Buffer to copy `shortname` to. The buffer must
106  * be allocated by the caller.
107  * \param shortnamelen Buffer length of `shortname`.
108  * \param utcb The UTCB to use for the operation.
109  *
110  * \retval 0 Success
111  * \retval <0 Error
112  */
113  int query_log_name(unsigned idx,
114  char *name, unsigned namelen,
115  char *shortname, unsigned shortnamelen,
116  l4_utcb_t *utcb = l4_utcb()) throw()
117  {
118  return l4_debugger_query_log_name_u(cap(), idx, name, namelen,
119  shortname, shortnamelen, utcb);
120  }
121 
122  /**
123  * \copybrief l4_debugger_switch_log()
124  * \param name Name of the log type.
125  * \param on_off 1: turn log on, 0: turn log off
126  * \param utcb The UTCB to use for the operation.
127  *
128  * \return Syscall return tag
129  */
130  l4_msgtag_t switch_log(const char *name, unsigned on_off,
131  l4_utcb_t *utcb = l4_utcb()) throw()
132  { return l4_debugger_switch_log_u(cap(), name, on_off, utcb); }
133 
134  /**
135  * Get name of object with Id `id`.
136  *
137  * \param id Id of the object whose name is asked.
138  * \param[out] name Buffer to copy the name into. The buffer must be
139  * allocated by the caller.
140  * \param size Length of the `name` buffer.
141  * \param utcb The UTCB to use for the operation.
142  *
143  * \return Syscall return tag
144  */
145  l4_msgtag_t get_object_name(unsigned id, char *name, unsigned size,
146  l4_utcb_t *utcb = l4_utcb()) throw()
147  { return l4_debugger_get_object_name_u(cap(), id, name, size, utcb); }
148 };
149 }