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,
224 L4_DEBUGGER_NAME_SET_OP = 0UL,
225 L4_DEBUGGER_GLOBAL_ID_OP = 1UL,
226 L4_DEBUGGER_KOBJ_TO_ID_OP = 2UL,
227 L4_DEBUGGER_QUERY_LOG_TYPEID_OP = 3UL,
228 L4_DEBUGGER_SWITCH_LOG_OP = 4UL,
229 L4_DEBUGGER_NAME_GET_OP = 5UL,
230 L4_DEBUGGER_QUERY_LOG_NAME_OP = 6UL,
231 L4_DEBUGGER_ADD_IMAGE_INFO_OP = 7UL,
236 L4_DEBUGGER_SWITCH_LOG_ON = 1,
237 L4_DEBUGGER_SWITCH_LOG_OFF = 0,
258__strcpy_maxlen(
char *dst,
char const *src,
unsigned maxlen)
264 for (i = 0; i < maxlen - 1 && src[i]; ++i)
276 l4_utcb_mr_u(utcb)->
mr[0] = L4_DEBUGGER_NAME_SET_OP;
277 i = __strcpy_maxlen((
char *)&l4_utcb_mr_u(utcb)->mr[1], name,
278 (L4_UTCB_GENERIC_DATA_SIZE - 2) *
sizeof(
l4_umword_t));
280 return l4_invoke_debugger(cap,
l4_msgtag(0, 1 + i, 0, 0), utcb);
286 l4_utcb_mr_u(utcb)->
mr[0] = L4_DEBUGGER_GLOBAL_ID_OP;
287 if (l4_error_u(l4_invoke_debugger(cap,
l4_msgtag(0, 1, 0, 0), utcb), utcb))
289 return l4_utcb_mr_u(utcb)->
mr[0];
295 l4_utcb_mr_u(utcb)->
mr[0] = L4_DEBUGGER_KOBJ_TO_ID_OP;
296 l4_utcb_mr_u(utcb)->
mr[1] = kobjp;
297 if (l4_error_u(l4_invoke_debugger(cap,
l4_msgtag(0, 2, 0, 0), utcb), utcb))
299 return l4_utcb_mr_u(utcb)->
mr[0];
303l4_debugger_query_log_typeid_u(
l4_cap_idx_t cap,
const char *name,
309 l4_utcb_mr_u(utcb)->
mr[0] = L4_DEBUGGER_QUERY_LOG_TYPEID_OP;
310 l4_utcb_mr_u(utcb)->
mr[1] = idx;
311 i = __strcpy_maxlen((
char *)&l4_utcb_mr_u(utcb)->mr[2], name, 32);
313 e = l4_error_u(l4_invoke_debugger(cap,
l4_msgtag(0, 2 + i, 0, 0), utcb), utcb);
316 return l4_utcb_mr_u(utcb)->
mr[0];
320l4_debugger_query_log_name_u(
l4_cap_idx_t cap,
unsigned idx,
321 char *name,
unsigned namelen,
322 char *shortname,
unsigned shortnamelen,
327 l4_utcb_mr_u(utcb)->
mr[0] = L4_DEBUGGER_QUERY_LOG_NAME_OP;
328 l4_utcb_mr_u(utcb)->
mr[1] = idx;
329 e = l4_error_u(l4_invoke_debugger(cap,
l4_msgtag(0, 2, 0, 0), utcb), utcb);
332 n = (
char const *)&l4_utcb_mr_u(utcb)->
mr[0];
333 __strcpy_maxlen(name, n, namelen);
334 __strcpy_maxlen(shortname, n + __builtin_strlen(n) + 1, shortnamelen);
340l4_debugger_switch_log_u(
l4_cap_idx_t cap,
const char *name,
int on_off,
344 l4_utcb_mr_u(utcb)->
mr[0] = L4_DEBUGGER_SWITCH_LOG_OP;
345 l4_utcb_mr_u(utcb)->
mr[1] = on_off;
346 i = __strcpy_maxlen((
char *)&l4_utcb_mr_u(utcb)->mr[2], name, 32);
348 return l4_invoke_debugger(cap,
l4_msgtag(0, 2 + i, 0, 0), utcb);
352l4_debugger_get_object_name_u(
l4_cap_idx_t cap,
unsigned id,
353 char *name,
unsigned size,
357 l4_utcb_mr_u(utcb)->
mr[0] = L4_DEBUGGER_NAME_GET_OP;
358 l4_utcb_mr_u(utcb)->
mr[1] = id;
359 t = l4_invoke_debugger(cap,
l4_msgtag(0, 2, 0, 0), utcb);
360 __strcpy_maxlen(name, (
char const *)&l4_utcb_mr_u(utcb)->mr[0], size);
369 l4_utcb_mr_u(utcb)->
mr[0] = L4_DEBUGGER_ADD_IMAGE_INFO_OP;
370 l4_utcb_mr_u(utcb)->
mr[1] = base;
371 i = __strcpy_maxlen((
char *)&l4_utcb_mr_u(utcb)->mr[2], name,
372 (L4_UTCB_GENERIC_DATA_SIZE - 3) *
sizeof(
l4_umword_t));
374 return l4_invoke_debugger(cap,
l4_msgtag(0, 2 + i, 0, 0), utcb);
382 return l4_debugger_set_object_name_u(cap, name,
l4_utcb());
388 return l4_debugger_global_id_u(cap,
l4_utcb());
394 return l4_debugger_kobj_to_id_u(cap, kobjp,
l4_utcb());
401 return l4_debugger_query_log_typeid_u(cap, name, idx,
l4_utcb());
406 char *name,
unsigned namelen,
407 char *shortname,
unsigned shortnamelen)
L4_NOTHROW
409 return l4_debugger_query_log_name_u(cap, idx, name, namelen,
410 shortname, shortnamelen,
l4_utcb());
417 return l4_debugger_switch_log_u(cap, name, on_off,
l4_utcb());
424 return l4_debugger_get_object_name_u(cap,
id, name, size,
l4_utcb());
431 return l4_debugger_add_image_info_u(cap, base, name,
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.
l4_msgtag_t l4_debugger_add_image_info(l4_cap_idx_t cap, l4_addr_t base, const char *name) L4_NOTHROW
Add loaded image information for a task.
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.