From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 118245 invoked by alias); 11 Mar 2018 20:54:31 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 118231 invoked by uid 89); 11 Mar 2018 20:54:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=suspended X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 11 Mar 2018 20:54:29 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id w2BKsMEt010764 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 11 Mar 2018 16:54:27 -0400 Received: by simark.ca (Postfix, from userid 112) id A390B1E7A4; Sun, 11 Mar 2018 16:54:22 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 7C3D51E4B0; Sun, 11 Mar 2018 16:54:20 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 11 Mar 2018 20:54:00 -0000 From: Simon Marchi To: LE GARREC Vincent Cc: gdb@sourceware.org Subject: Re: Run multiple parallel instances of gdb In-Reply-To: References: Message-ID: <4b04209db0308576e68320a5d22181e4@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.4 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Sun, 11 Mar 2018 20:54:22 +0000 X-IsSubscribed: yes X-SW-Source: 2018-03/txt/msg00028.txt.bz2 On 2018-03-11 16:15, LE GARREC Vincent wrote: > Hi everybody, > > I would like to sort crashes found by fuzzing. So I have around 1000 > files > that make my application crashes. I made a small program to run gdb and > to > extract backtraces to file. To increase speed, I run parallel > instances. > > Problem, with parallel instances, my program stopped. It doesn't > crashes, > it stops. I have to run "fg" from terminal to continue and it's > happening > very often. So actually, I'm running with single thread. > > Is it normal ? Did I do something wrong ? If you need more information, > I > can give you. > > Please find after simple steps to reproduce the case, > > Thanks for you advices, > > Vincent Le Garrec Hi Vincent, Do you get a "suspended (tty output)" message? If so, what you have is a background process trying to output on the terminal while the terminal has the "tostop" flag set. A simpler case to reproduce it is: $ gdb -batch -ex run --args /bin/echo salut & [1] 28223 $ [1] + 28223 suspended (tty output) gdb -q -batch -ex run --args /bin/echo salut I don't understand why though, because my terminal does not have "tostop" enabled: $ stty speed 38400 baud; line = 0; -brkint -imaxbel iutf8 So something in the process probably sets that flag... Anyway, one way to get around it is to change the terminal for the newly created inferiors, for example to /dev/null if you don't need them to do I/O on the terminal: $ gdb -batch -ex "tty /dev/null" -ex run --args /bin/echo salut & [1] 28276 $ [Inferior 1 (process 28285) exited normally] [1] + 28276 done gdb -q -batch -ex "tty /dev/null" -ex run --args /bin/echo salut One comment below: > [1] : crash program > main.c (in /tmp folder) > > int main() > { > int *t = 0xDEADBEEF; > *t = 1; > } > > Run it and it should crash. > > [2] : multiple execution of gdb > loopgdb.cpp > > #include > #include > #include > #include > #include > #include > #include > #include > > void run_gdb() > { > pid_t child_pid = fork(); > std::cout << "run" << std::endl; > if (child_pid != 0) > { > pid_t wait_pid; > { > wait_pid = waitpid(child_pid, nullptr, WNOHANG); > sleep(1); > } > while(wait_pid == 0); You are missing the "do" from your do/while, which results in an infinite loop here (if wait_pid is 0). Simon