From b13ae86ed0df158d2d4fed826ced5472bf104543 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Sat, 13 Sep 2014 01:27:46 +0200 Subject: [PATCH 2/3] ddb: add db_check_task_address_valid * ddb/db_task_thread.c (db_check_task_address_valid): New function. * ddb/db_task_thread.h (db_check_task_address_valid): New declaration. --- ddb/db_task_thread.c | 14 ++++++++++++++ ddb/db_task_thread.h | 1 + 2 files changed, 15 insertions(+) diff --git a/ddb/db_task_thread.c b/ddb/db_task_thread.c index edab17e..97c81c8 100644 --- a/ddb/db_task_thread.c +++ b/ddb/db_task_thread.c @@ -135,6 +135,20 @@ db_lookup_thread(target_thread) } /* + * check the address is a valid task address + */ +boolean_t +db_check_task_address_valid(const task_t task) +{ + if (db_lookup_task(task) < 0) { + db_printf("Bad task address 0x%x\n", task); + db_flush_lex(); + return(FALSE); + } else + return(TRUE); +} + +/* * check the address is a valid thread address */ boolean_t diff --git a/ddb/db_task_thread.h b/ddb/db_task_thread.h index cbb3680..18f1957 100644 --- a/ddb/db_task_thread.h +++ b/ddb/db_task_thread.h @@ -46,6 +46,7 @@ extern thread_t db_default_thread; /* default target thread */ extern int db_lookup_task(const task_t); extern int db_lookup_thread(const thread_t); extern int db_lookup_task_thread(const task_t, const thread_t); +extern boolean_t db_check_task_address_valid(const task_t); extern boolean_t db_check_thread_address_valid(const thread_t); extern boolean_t db_get_next_thread(thread_t *, int); extern void db_init_default_thread(void); -- 2.1.0