Changeset 80487bc5 in mainline for kernel/generic/src/udebug/udebug_ops.c
- Timestamp:
- 2010-01-25T21:40:13Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e515b21a
- Parents:
- 0d21b53
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/udebug/udebug_ops.c
r0d21b53 r80487bc5 449 449 * this function will fail with an EINVAL error code. 450 450 * 451 * @param buffer The buffer for storing thread hashes. 451 * @param t Thread where call arguments are to be read. 452 * @param buffer Place to store pointer to new buffer. 453 * @return EOK on success, ENOENT if @a t is invalid, EINVAL 454 * if thread state is not valid for this operation. 452 455 */ 453 456 int udebug_args_read(thread_t *t, void **buffer) … … 481 484 } 482 485 486 /** Read the register state of the thread. 487 * 488 * The contents of the thread's istate structure are copied to a newly 489 * allocated buffer and a pointer to it is written to @a buffer. The size of 490 * the buffer will be sizeof(istate_t). 491 * 492 * Currently register state cannot be read if the thread is inside a system 493 * call (as opposed to an exception). This is an implementation limit. 494 * 495 * @param t Thread whose state is to be read. 496 * @param buffer Place to store pointer to new buffer. 497 * @return EOK on success, ENOENT if @a t is invalid, EINVAL 498 * if thread is not in valid state, EBUSY if istate 499 * is not available. 500 */ 501 int udebug_regs_read(thread_t *t, void **buffer) 502 { 503 istate_t *state, *state_buf; 504 int rc; 505 506 /* Prepare a buffer to hold the data. */ 507 state_buf = malloc(sizeof(istate_t), 0); 508 509 /* On success, this will lock t->udebug.lock */ 510 rc = _thread_op_begin(t, false); 511 if (rc != EOK) { 512 return rc; 513 } 514 515 state = t->udebug.uspace_state; 516 if (state == NULL) { 517 _thread_op_end(t); 518 return EBUSY; 519 } 520 521 /* Copy to the allocated buffer */ 522 memcpy(state_buf, state, sizeof(istate_t)); 523 524 _thread_op_end(t); 525 526 *buffer = (void *) state_buf; 527 return 0; 528 } 529 483 530 /** Read the memory of the debugged task. 484 531 *
Note:
See TracChangeset
for help on using the changeset viewer.