From: "Bilal, Muhammad" <Muhammad_Bilal@mentor.com>
To: Tom Tromey <tromey@redhat.com>, "eliz@gnu.org" <eliz@gnu.org>,
"brobecker@adacore.com" <brobecker@adacore.com>,
"dje@google.com" <dje@google.com>,
"jan.kratochvil@redhat.com" <jan.kratochvil@redhat.com>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: [PATCH]13217 thread apply all detach throws a SEGFAULT
Date: Mon, 14 Jan 2013 13:38:00 -0000 [thread overview]
Message-ID: <97B73E257CC18646B0B5D3DD77DCBDD158EBC9@EU-MBX-02.mgc.mentorg.com> (raw)
In-Reply-To: <97B73E257CC18646B0B5D3DD77DCBDD158E8FD@EU-MBX-02.mgc.mentorg.com>
Hi,
I worked on bug#13217 "thread apply all detach throws a SEGFAULT " of gdb
and fixed this problem by making a Patch.
I am upstreaming of it
Actually when command "thread apply all detach" is applied then the function thread_apply_command (char *tidlist, int from_tty) in thread.c:1179 called a function init_thread_list (void)in thread.c:140
which makes the 'thread_list' struck to null so when for (tp = thread_list; tp; tp = tp->next) loop in thread_apply_command (char *tidlist, int from_tty) in thread.c:1179 iterates 2nd time it throws a segmentation fault when try to access the bogus value of
thread_list
so i have fixed this problem
I have written the test case for it also
I have worked on gdb-7.5.50.20121127 snapshot
1)
gdb/thread.c
diff -u thread.c new_thread.c > change_thread.c
------------PATCH---------------------------------------
--- thread.c 2012-07-27 05:52:36.000000000 +0500
+++ new_thread.c 2013-01-02 12:06:51.876346782 +0500
@@ -1203,6 +1203,8 @@
execute_command (cmd, from_tty);
strcpy (cmd, saved_cmd); /* Restore exact command used
previously. */
+ if(thread_list == NULL)
+ break;
}
do_cleanups (old_chain);
2)
gdb/testsuit/gdb.thread
-----------------------------------test------------------------------------
--- threadapply.exp 2013-01-14 16:30:25.000000000 +0500
+++ new_threadapply.exp 2013-01-14 16:39:07.000000000 +0500
@@ -63,3 +63,4 @@
gdb_test "up" ".*in main.*" "go up in the stack frame"
gdb_test "thread apply all print 1" "Thread ..*\\\$\[0-9]+ = 1.*Thread ..*\\\$\[0-9]+ = 1.*Thread ..*\\\$\[0-9]+ = 1.*Thread ..*\\\$\[0-9]+ = 1.*Thread ..*\\\$\[0-9]+ = 1.*Thread ..*\\\$\[0-9]+ = 1" "run a simple print command on all threads"
gdb_test "down" "#0.*thread_function.*" "go down and check selected frame"
+gdb_test "thread apply all detach" "Thread.*\nDetaching from.*" "detaching from all threads"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
please review it and add me sourceware.org
thanks
Bilal
next parent reply other threads:[~2013-01-14 13:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <97B73E257CC18646B0B5D3DD77DCBDD158E8FD@EU-MBX-02.mgc.mentorg.com>
2013-01-14 13:38 ` Bilal, Muhammad [this message]
2013-01-14 15:25 ` Yao Qi
2013-01-14 15:41 ` Jan Kratochvil
2013-01-14 15:46 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=97B73E257CC18646B0B5D3DD77DCBDD158EBC9@EU-MBX-02.mgc.mentorg.com \
--to=muhammad_bilal@mentor.com \
--cc=brobecker@adacore.com \
--cc=dje@google.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox