From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32362 invoked by alias); 2 Feb 2014 22:08:23 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 32352 invoked by uid 89); 2 Feb 2014 22:08:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-we0-f176.google.com Received: from mail-we0-f176.google.com (HELO mail-we0-f176.google.com) (74.125.82.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sun, 02 Feb 2014 22:08:21 +0000 Received: by mail-we0-f176.google.com with SMTP id q58so1470680wes.21 for ; Sun, 02 Feb 2014 14:08:18 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.180.108.130 with SMTP id hk2mr6532980wib.16.1391378898154; Sun, 02 Feb 2014 14:08:18 -0800 (PST) Received: by 10.194.17.104 with HTTP; Sun, 2 Feb 2014 14:08:18 -0800 (PST) Date: Sun, 02 Feb 2014 22:08:00 -0000 Message-ID: Subject: Fun with LD_PRELOAD From: Doug Evans To: =?ISO-8859-1?Q?Ludovic_Court=E8s?= , guile-user@gnu.org, "gdb-patches@sourceware.org" Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes X-SW-Source: 2014-02/txt/msg00008.txt.bz2 Hi. Here's my system-call wrapping module for gdb+guile. At this point it's just a prototype, and an initial one at that. It's kinda useful to see the system call tracing amongst gdb's own debug output, but my real goal is to explore ways of exercising gdb that are otherwise harder to do. With this I can script what happens when gdb does ptrace,waitpid,tkill,etc. Whether this exploration yields anything useful ... TBD. git clone git@github.com:xdje42/wrap-syscall.git To run the example: GDB=/path/to/gdb-with-guile ./configure make make run --> ... waitpid (-1, 140736922396708, -2147483647) -> (42816 . 0), 1407 LNW: waitpid(-1, ...) returned 42816, ERRNO-OK LLW: waitpid 42816 received Trace/breakpoint trap (stopped) ptrace (3 (PTRACE_PEEKUSER), 42816, 896, 0) -> (16384 . 0) syscall (200 (tkill), 42816, 0) -> (0 . 0) LLTA: KILL(SIG0) Thread 0x7f03c7d4a700 (LWP 42816) (OK) LLW: Candidate event Trace/breakpoint trap (stopped) in Thread 0x7f03c7d4a700 (LWP 42816). SC: kill Thread 0x7f03c74f9700 (LWP 42817) **** Injecting SIGUSR1 to 42817 ... syscall (200 (tkill), 42817, 19 (SIGSTOP)) -> (0 . 0) SC: lwp kill 0 ERRNO-OK SC: kill Thread 0x7f03c6ca8700 (LWP 42818) **** syscall (200 (tkill), 42818, 19 (SIGSTOP)) -> (0 . 0) SC: lwp kill 0 ERRNO-OK SC: kill Thread 0x7f03c6457700 (LWP 42819) **** syscall (200 (tkill), 42819, 19 (SIGSTOP)) -> (0 . 0) SC: lwp kill 0 ERRNO-OK SC: kill Thread 0x7f03c5c06700 (LWP 42820) **** syscall (200 (tkill), 42820, 19 (SIGSTOP)) -> (0 . 0) SC: lwp kill 0 ERRNO-OK SC: kill Thread 0x7f03c8533740 (LWP 42813) **** syscall (200 (tkill), 42813, 19 (SIGSTOP)) -> (0 . 0) SC: lwp kill 0 ERRNO-OK waitpid (42817, 140736922396252, 1) -> (-1 . 10), 0 waitpid (42817, 140736922396252, -2147483647) -> (42817 . 0), 2687 WL: waitpid Thread 0x7f03c74f9700 (LWP 42817) received User defined signal 1 (stopped) ptrace (3 (PTRACE_PEEKUSER), 42817, 896, 0) -> (0 . 0) SWC: Pending event User defined signal 1 (stopped) in Thread 0x7f03c74f9700 (LWP 42817) ...