From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29458 invoked by alias); 15 Dec 2014 09:44: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 29444 invoked by uid 89); 15 Dec 2014 09:44:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: smtp3.ugent.be Received: from smtp3.ugent.be (HELO smtp3.ugent.be) (157.193.49.127) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 15 Dec 2014 09:44:55 +0000 Received: from localhost (mcheck3.ugent.be [157.193.71.89]) by smtp3.ugent.be (Postfix) with ESMTP id E3D09C60A; Mon, 15 Dec 2014 10:44:52 +0100 (CET) Received: from smtp3.ugent.be ([IPv6:::ffff:157.193.49.127]) by localhost (mcheck3.UGent.be [::ffff:157.193.43.11]) (amavisd-new, port 10024) with ESMTP id gsCJLcl9MVJo; Mon, 15 Dec 2014 10:44:52 +0100 (CET) Received: from mail.elis.ugent.be (mail.elis.UGent.be [157.193.206.48]) by smtp3.ugent.be (Postfix) with ESMTP id 61DCDC609; Mon, 15 Dec 2014 10:44:52 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail.elis.ugent.be (Postfix) with ESMTP id 528E9918F18; Mon, 15 Dec 2014 10:44:52 +0100 (CET) Received: from mail.elis.ugent.be ([127.0.0.1]) by localhost (mail.elis.ugent.be [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id stoDCuVcyEcM; Mon, 15 Dec 2014 10:44:52 +0100 (CET) Received: from bigmac.elis.UGent.be (bigmac.elis.UGent.be [157.193.206.33]) by mail.elis.ugent.be (Postfix) with ESMTP id 364CF918F16; Mon, 15 Dec 2014 10:44:52 +0100 (CET) Cc: gdb@sourceware.org Message-Id: From: Jonas Maebe To: navin p In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v936) Subject: Re: SIGILL under gdb for AIX 64 bit binaries Date: Mon, 15 Dec 2014 09:44:00 -0000 References: X-j-chkmail-Enveloppe: 548EAD94.004 from mail.elis.UGent.be/mail.elis.UGent.be/157.193.206.48/mail.elis.ugent.be/ X-j-chkmail-Score: MSGID : 548EAD94.004 on smtp3.ugent.be : j-chkmail score : . : R=. U=. O=. B=0.000 -> S=0.000 X-j-chkmail-Status: Ham X-IsSubscribed: yes X-SW-Source: 2014-12/txt/msg00023.txt.bz2 On 15 Dec 2014, at 09:12, navin p wrote: > When i run a program on command line it runs fine. But when i > run it gdb it gives me a SIGILL. > I know that is a problem with the code because dbx for AIX also > gives the SIGILL instruction. > But i've been not able to convince people in my organization it > is a problem with code. Executing an instruction is a standard technique to determine whether the cpu supports it (e.g. to detect whether an ARM cpu supports prefetching instructions). The way this works is that the program installs a signal handler for the SIGILL signal, executes the potentially unsupported instruction, and sets a global variable inside the signal handler, and then returns to the instruction after the unsupported instruction. So by checking that variable after attempting to execute that instruction, you can know whether the cpu supported it or not. > What they do is they 'c' (continue) in gdb when it hits a > SIGILL and keep on continuing 2 times until it crashes somewhere else > in the code. > > I wanted to know these 2 questions : > > 1) Once it hits a SIGILL can we continue and go to the next > crash and so on ? Is this valid . > > 2) How does gdb allow to continue on a SIGILL ? type handle SIGILL You will see something like Signal Stop Print Pass to program Description SIGILL Yes Yes Yes Illegal instruction "Stop = Yes" means that gdb will stop when the program triggers a SIGILL. "Print = Yes" means that gdb will print a message telling you that it stopped because of a SIGILL. "Pass to program = Yes" means that after you continue the execution, the SIGILL will be passed on to the program itself, so that its SIGILL handler will be executed. If it did not install a SIGILL handler, it will simply be killed. This means that if your program keeps executing once you continue after receiving a SIGILL, it handled the SIGILL in a signal handler and continued normally. As a result, it's probably expected behaviour. Jonas