From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 66838 invoked by alias); 17 Nov 2017 16:11:04 -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 66822 invoked by uid 89); 17 Nov 2017 16:11:04 -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,KB_WAM_FROM_NAME_SINGLEWORD,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.2 spammy=enlighten X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 17 Nov 2017 16:11:02 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 3D3A111639F; Fri, 17 Nov 2017 11:11:01 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id gCsKq+bkUDq6; Fri, 17 Nov 2017 11:11:01 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 0D77C116397; Fri, 17 Nov 2017 11:11:01 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 4715A87459; Fri, 17 Nov 2017 08:10:59 -0800 (PST) Date: Fri, 17 Nov 2017 16:11:00 -0000 From: Joel Brobecker To: Yubin Ruan Cc: gdb@sourceware.org Subject: Re: how GDB use ptrace to return from a function Message-ID: <20171117161059.3oxfgipkgknfymrm@adacore.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-SW-Source: 2017-11/txt/msg00011.txt.bz2 > I don't know whether GDB is using this kind of technique. If anyone > know that, can you enlighten me, and probably point me to the source? GDB sets the call up so that the return address is at specific location (usually the program's entry point, but that's arch- dependent), and then places a breakpoint at that address. It then knows, when receiving the corresponding breakpoint event, that a breakpoint at that address corresponds to the end of the function that we called. -- Joel