From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1362 invoked by alias); 11 Mar 2018 21:37:58 -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 1352 invoked by uid 89); 11 Mar 2018 21:37:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*c:alternative X-HELO: mail-yw0-f177.google.com Received: from mail-yw0-f177.google.com (HELO mail-yw0-f177.google.com) (209.85.161.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 11 Mar 2018 21:37:56 +0000 Received: by mail-yw0-f177.google.com with SMTP id q184so4200582ywh.13 for ; Sun, 11 Mar 2018 14:37:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=3QO1DsLSBctsS5eWej4yLISs7C4XC5Drrub+cdesqpY=; b=mhfIesx2CTeRqB9mmdQ1d5D/ICMIFlgo4YoUrwA3CdjwxRXBb2ixRO6VMPpuACT7j4 XluocWadhHdxYhkr+d47u1xI0Azp2gktcGh+yOiHQHbiu/b/2nHfsFBDqoeJji6l40ck igro4Fapo/egZ17PGnJEx1U3bCJ9z0wvCisyLEP/UOkbXKbgbJ+o+CsSynLuQSzxP/ZD ueR+1Q02NeI5R+aA635w611lPyR25RkzJS0R2Dm4zZ7/Nax4ov6J2aEG4YzKocTXAg6g z0Jtdk2g0hw4ThvJTnKVnEklDrbEHwqeuYKZNiahXureqnJBEzTSRMfxO1HHQe1D/Vip 2fMw== X-Gm-Message-State: AElRT7EK0xHXr2jOgjKwVws1n2wv1G/+WcST4CNlChiPNDWaaZPUWIuN 3xTnii7g04WTJt4eLjyUoIM3B+0mjlhItCOSE3JPLVSTOpk= X-Google-Smtp-Source: AG47ELtMRIktk1Ep2oZCp8Ajr/GeZiYBkO8/cESts7+Qn1kkPlEF3sLSGXK05xVSq8ngqzpIOelCXlC+PLH7ffMElkE= X-Received: by 10.129.71.5 with SMTP id u5mr3473201ywa.114.1520804274462; Sun, 11 Mar 2018 14:37:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.129.152.199 with HTTP; Sun, 11 Mar 2018 14:37:34 -0700 (PDT) In-Reply-To: <4b04209db0308576e68320a5d22181e4@polymtl.ca> References: <4b04209db0308576e68320a5d22181e4@polymtl.ca> From: LE GARREC Vincent Date: Sun, 11 Mar 2018 21:37:00 -0000 Message-ID: Subject: Re: Run multiple parallel instances of gdb To: Simon Marchi Cc: gdb@sourceware.org Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-03/txt/msg00029.txt.bz2 I don't have a suspended message, it a stopped. But the behavior is the same. [1]+ Stopped ./loopgdb My stty: speed 38400 baud; line = 0; erase = ^H; -brkint -imaxbel iutf8 but your diagnostic is right. Adding the "-ex tty /dev/null" is perfect. I will do some search about this "tostop" flag. For the minimal testcase, I did it a bit fast but the "do" didn't missing in my code. Thanks for your advice, you really help me, Best regards, Vincent 2018-03-11 21:54 GMT+01:00 Simon Marchi : > 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 >