27#include <l4/sys/utcb.h>
28#include <l4/sys/ipc.h>
82l4_debugger_get_object_name_u(
l4_cap_idx_t cap,
unsigned id,
83 char *name,
unsigned size,
147l4_debugger_query_log_typeid_u(
l4_cap_idx_t cap,
const char *name,
168 char *name,
unsigned namelen,
169 char *shortname,
unsigned shortnamelen)
L4_NOTHROW;
175l4_debugger_query_log_name_u(
l4_cap_idx_t cap,
unsigned idx,
176 char *name,
unsigned namelen,
177 char *shortname,
unsigned shortnamelen,
198l4_debugger_switch_log_u(
l4_cap_idx_t cap,
const char *name,
int on_off,
203 L4_DEBUGGER_NAME_SET_OP = 0UL,
204 L4_DEBUGGER_GLOBAL_ID_OP = 1UL,
205 L4_DEBUGGER_KOBJ_TO_ID_OP = 2UL,
206 L4_DEBUGGER_QUERY_LOG_TYPEID_OP = 3UL,
207 L4_DEBUGGER_SWITCH_LOG_OP = 4UL,
208 L4_DEBUGGER_NAME_GET_OP = 5UL,
209 L4_DEBUGGER_QUERY_LOG_NAME_OP = 6UL,
214 L4_DEBUGGER_SWITCH_LOG_ON = 1,
215 L4_DEBUGGER_SWITCH_LOG_OFF = 0,
236__strcpy_maxlen(
char *dst,
char const *src,
unsigned maxlen)
242 for (i = 0; i < maxlen - 1 && src[i]; ++i)
254 l4_utcb_mr_u(utcb)->
mr[0] = L4_DEBUGGER_NAME_SET_OP;
255 i = __strcpy_maxlen((
char *)&l4_utcb_mr_u(utcb)->mr[1], name,
256 (L4_UTCB_GENERIC_DATA_SIZE - 2) *
sizeof(
l4_umword_t));
258 return l4_invoke_debugger(cap,
l4_msgtag(0, 1 + i, 0, 0), utcb);
264 l4_utcb_mr_u(utcb)->
mr[0] = L4_DEBUGGER_GLOBAL_ID_OP;
265 if (l4_error_u(l4_invoke_debugger(cap,
l4_msgtag(0, 1, 0, 0), utcb), utcb))
267 return l4_utcb_mr_u(utcb)->
mr[0];
273 l4_utcb_mr_u(utcb)->
mr[0] = L4_DEBUGGER_KOBJ_TO_ID_OP;
274 l4_utcb_mr_u(utcb)->
mr[1] = kobjp;
275 if (l4_error_u(l4_invoke_debugger(cap,
l4_msgtag(0, 2, 0, 0), utcb), utcb))
277 return l4_utcb_mr_u(utcb)->
mr[0];
281l4_debugger_query_log_typeid_u(
l4_cap_idx_t cap,
const char *name,
287 l4_utcb_mr_u(utcb)->
mr[0] = L4_DEBUGGER_QUERY_LOG_TYPEID_OP;
288 l4_utcb_mr_u(utcb)->
mr[1] = idx;
289 i = __strcpy_maxlen((
char *)&l4_utcb_mr_u(utcb)->mr[2], name, 32);
291 e = l4_error_u(l4_invoke_debugger(cap,
l4_msgtag(0, 2 + i, 0, 0), utcb), utcb);
294 return l4_utcb_mr_u(utcb)->
mr[0];
298l4_debugger_query_log_name_u(
l4_cap_idx_t cap,
unsigned idx,
299 char *name,
unsigned namelen,
300 char *shortname,
unsigned shortnamelen,
305 l4_utcb_mr_u(utcb)->
mr[0] = L4_DEBUGGER_QUERY_LOG_NAME_OP;
306 l4_utcb_mr_u(utcb)->
mr[1] = idx;
307 e = l4_error_u(l4_invoke_debugger(cap,
l4_msgtag(0, 2, 0, 0), utcb), utcb);
310 n = (
char const *)&l4_utcb_mr_u(utcb)->
mr[0];
311 __strcpy_maxlen(name, n, namelen);
312 __strcpy_maxlen(shortname, n + __builtin_strlen(n) + 1, shortnamelen);
318l4_debugger_switch_log_u(
l4_cap_idx_t cap,
const char *name,
int on_off,
322 l4_utcb_mr_u(utcb)->
mr[0] = L4_DEBUGGER_SWITCH_LOG_OP;
323 l4_utcb_mr_u(utcb)->
mr[1] = on_off;
324 i = __strcpy_maxlen((
char *)&l4_utcb_mr_u(utcb)->mr[2], name, 32);
326 return l4_invoke_debugger(cap,
l4_msgtag(0, 2 + i, 0, 0), utcb);
330l4_debugger_get_object_name_u(
l4_cap_idx_t cap,
unsigned id,
331 char *name,
unsigned size,
335 l4_utcb_mr_u(utcb)->
mr[0] = L4_DEBUGGER_NAME_GET_OP;
336 l4_utcb_mr_u(utcb)->
mr[1] = id;
337 t = l4_invoke_debugger(cap,
l4_msgtag(0, 2, 0, 0), utcb);
338 __strcpy_maxlen(name, (
char const *)&l4_utcb_mr_u(utcb)->mr[0], size);
347 return l4_debugger_set_object_name_u(cap, name,
l4_utcb());
353 return l4_debugger_global_id_u(cap,
l4_utcb());
359 return l4_debugger_kobj_to_id_u(cap, kobjp,
l4_utcb());
366 return l4_debugger_query_log_typeid_u(cap, name, idx,
l4_utcb());
371 char *name,
unsigned namelen,
372 char *shortname,
unsigned shortnamelen)
L4_NOTHROW
374 return l4_debugger_query_log_name_u(cap, idx, name, namelen,
375 shortname, shortnamelen,
l4_utcb());
382 return l4_debugger_switch_log_u(cap, name, on_off,
l4_utcb());
389 return l4_debugger_get_object_name_u(cap,
id, name, size,
l4_utcb());
L4 compiler related defines.
unsigned long l4_umword_t
Unsigned machine word.
unsigned long l4_addr_t
Address type.
unsigned long l4_cap_idx_t
Capability selector type.
l4_msgtag_t l4_debugger_get_object_name(l4_cap_idx_t cap, unsigned id, char *name, unsigned size) L4_NOTHROW
Get name of the kernel object with Id id.
long l4_debugger_query_log_typeid(l4_cap_idx_t cap, const char *name, unsigned idx) L4_NOTHROW
Query the log-id for a log type.
unsigned long l4_debugger_kobj_to_id(l4_cap_idx_t cap, l4_addr_t kobjp) L4_NOTHROW
Get the globally unique ID of the object behind the kobject pointer.
long l4_debugger_query_log_name(l4_cap_idx_t cap, unsigned idx, char *name, unsigned namelen, char *shortname, unsigned shortnamelen) L4_NOTHROW
Query the name of a log type given the ID.
l4_msgtag_t l4_debugger_set_object_name(l4_cap_idx_t cap, const char *name) L4_NOTHROW
Set the name of a kernel object.
unsigned long l4_debugger_global_id(l4_cap_idx_t cap) L4_NOTHROW
Get the globally unique ID of the object behind a capability.
l4_msgtag_t l4_debugger_switch_log(l4_cap_idx_t cap, const char *name, int on_off) L4_NOTHROW
Set or unset log.
unsigned l4_bytes_to_mwords(unsigned size) L4_NOTHROW
Determine how many machine words (l4_umword_t) are required to store a buffer of 'size' bytes.
l4_msgtag_t l4_msgtag(long label, unsigned words, unsigned items, unsigned flags) L4_NOTHROW
Create a message tag from the specified values.
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
l4_utcb_t * l4_utcb(void) L4_NOTHROW L4_PURE
Get the UTCB address.
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
#define L4_INLINE
L4 Inline function attribute.
Kernel object system calls.
Message tag data structure.
l4_umword_t mr[L4_UTCB_GENERIC_DATA_SIZE]
Message registers.