diff options
author | Pedro Alves <palves@redhat.com> | 2008-05-05 16:41:42 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2008-05-05 16:41:42 +0000 |
commit | b3dc826bc7308d6e556424dd369d57fe8acc8a96 (patch) | |
tree | 17e960e4f3e57d670aac29f651c665280511c3e8 /gdb | |
parent | 6528a9eabd6d3d739edec32fad1e5c58c380ae11 (diff) | |
download | gdb-b3dc826bc7308d6e556424dd369d57fe8acc8a96.zip gdb-b3dc826bc7308d6e556424dd369d57fe8acc8a96.tar.gz gdb-b3dc826bc7308d6e556424dd369d57fe8acc8a96.tar.bz2 |
* infcmd.c (step_1): Put thread id on the stack to avoid possible
NULL dereferencing.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/infcmd.c | 14 |
2 files changed, 9 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 05a741b..7c3c75b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2008-05-05 Pedro Alves <pedro@codesourcery.com> + + * infcmd.c (step_1): Put thread id on the stack to avoid possible + NULL dereferencing. + 2008-05-05 Luis Machado <luisgpm@br.ibm.com> * symfile.c (reread_symbols): Update objfile's entry point. diff --git a/gdb/infcmd.c b/gdb/infcmd.c index b75c524..f5d7c50 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -706,7 +706,7 @@ step_1 (int skip_subroutines, int single_inst, char *count_string) struct frame_info *frame; struct cleanup *cleanups = make_cleanup (null_cleanup, NULL); int async_exec = 0; - int *thread_p = NULL; + int thread = -1; ERROR_NO_INFERIOR; @@ -730,17 +730,12 @@ step_1 (int skip_subroutines, int single_inst, char *count_string) if (!single_inst || skip_subroutines) /* leave si command alone */ { - thread_p = xmalloc (sizeof (int)); - make_cleanup (xfree, thread_p); - if (in_thread_list (inferior_ptid)) - *thread_p = pid_to_thread_id (inferior_ptid); - else - *thread_p = -1; + thread = pid_to_thread_id (inferior_ptid); set_longjmp_breakpoint (); - make_cleanup (delete_longjmp_breakpoint_cleanup, thread_p); + make_cleanup (delete_longjmp_breakpoint_cleanup, &thread); } /* In synchronous case, all is well, just use the regular for loop. */ @@ -801,11 +796,10 @@ which has no line number information.\n"), name); and handle them one at the time, through step_once(). */ else { - step_once (skip_subroutines, single_inst, count, *thread_p); + step_once (skip_subroutines, single_inst, count, thread); /* We are running, and the continuation is installed. It will disable the longjmp breakpoint as appropriate. */ discard_cleanups (cleanups); - xfree (thread_p); } } |