New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update for current version #14

Merged
merged 25 commits into from Oct 8, 2011
Commits
Jump to file or symbol
Failed to load files and symbols.
+34 −5
Diff settings

Always

Just for now

Viewing a subset of changes. View all
Prev

leave terminated threads unmarked but delete corresponding

debug_context.
  • Loading branch information...
nobu committed Sep 16, 2011
commit 63d4066baa9dae5a4f80eee567cebd415c38cc2b
@@ -228,11 +228,31 @@ remove_from_locked(void)
return thread;
}
static int is_living_thread(VALUE thread);
static int
threads_table_mark_keyvalue(st_data_t key, st_data_t value, st_data_t tbl)
{
VALUE thread = id2ref((VALUE)key);
if (!value) {
return ST_CONTINUE;
}
rb_gc_mark((VALUE)value);
if (is_living_thread(thread)) {
rb_gc_mark(thread);
}
else {
st_insert((st_table *)tbl, key, 0);
}
return ST_CONTINUE;
}
static void
threads_table_mark(void* data)
{
threads_table_t *threads_table = (threads_table_t*)data;
rb_mark_tbl(threads_table->tbl);
st_table *tbl = threads_table->tbl;
st_foreach(tbl, threads_table_mark_keyvalue, (st_data_t)tbl);
}
static void
@@ -270,17 +290,23 @@ is_thread_alive(VALUE thread)
return th->status != THREAD_KILLED;
}
static int
is_living_thread(VALUE thread)
{
return rb_obj_is_kind_of(thread, rb_cThread) && is_thread_alive(thread);
}
static int
threads_table_check_i(st_data_t key, st_data_t value, st_data_t dummy)
{
VALUE thread;
thread = id2ref((VALUE)key);
if(!rb_obj_is_kind_of(thread, rb_cThread))
if(!value)
{
return ST_DELETE;
}
if(!is_thread_alive(thread))
thread = id2ref((VALUE)key);
if(!is_living_thread(thread))
{
return ST_DELETE;
}
@@ -592,7 +618,7 @@ thread_context_lookup(VALUE thread, VALUE *context, debug_context_t **debug_cont
}
thread_id = ref2id(thread);
Data_Get_Struct(rdebug_threads_tbl, threads_table_t, threads_table);
if(!st_lookup(threads_table->tbl, thread_id, context))
if(!st_lookup(threads_table->tbl, thread_id, context) || !*context)
{
if (create)
{
@@ -1308,6 +1334,9 @@ find_last_context_func(st_data_t key, st_data_t value, st_data_t result_arg)
{
debug_context_t *debug_context;
VALUE *result = (VALUE *)result_arg;
if(!value) {
return ST_CONTINUE;
}
Data_Get_Struct((VALUE)value, debug_context_t, debug_context);
if(debug_context->thnum == last_debugged_thnum)
{
ProTip! Use n and p to navigate between commits in a pull request.