From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29237 invoked by alias); 21 Jul 2009 05:43:48 -0000 Received: (qmail 29228 invoked by uid 22791); 21 Jul 2009 05:43:47 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.33.17) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 21 Jul 2009 05:43:41 +0000 Received: from zps76.corp.google.com (zps76.corp.google.com [172.25.146.76]) by smtp-out.google.com with ESMTP id n6L5hZIc002349 for ; Tue, 21 Jul 2009 06:43:36 +0100 Received: from qw-out-2122.google.com (qwd5.prod.google.com [10.241.193.197]) by zps76.corp.google.com with ESMTP id n6L5hW00000827 for ; Mon, 20 Jul 2009 22:43:33 -0700 Received: by qw-out-2122.google.com with SMTP id 5so912015qwd.23 for ; Mon, 20 Jul 2009 22:43:32 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.99.66 with SMTP id t2mr1007906qcn.38.1248155012458; Mon, 20 Jul 2009 22:43:32 -0700 (PDT) In-Reply-To: <6D19CA8D71C89C43A057926FE0D4ADAA07BFFFFB@ecamlmw720.eamcs.ericsson.se> References: <6D19CA8D71C89C43A057926FE0D4ADAA07BFFFFB@ecamlmw720.eamcs.ericsson.se> Date: Tue, 21 Jul 2009 05:43:00 -0000 Message-ID: <8ac60eac0907202243m6cecfc75laa21dee368e52193@mail.gmail.com> Subject: Re: Segfault in user command From: Paul Pluzhnikov To: Marc Khouzam Cc: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-IsSubscribed: yes 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 X-SW-Source: 2009-07/txt/msg00152.txt.bz2 On Mon, Jul 20, 2009 at 7:08 PM, Marc Khouzam wr= ote: > I was trying to use 'interpreter-exec mi' inside a user-defined command, > and GDB segfaulted (session below). =A0It is today's version of GDB. The problem is that in cli/cli-script.c, execute_user_command(), instream is set to NULL: 312 /* Set the instream to 0, indicating execution of a 313 user-defined function. */ 314 make_cleanup (do_restore_instream_cleanup, instream); 315 instream =3D (FILE *) 0; and later used for fileno(): #0 0x00007ffff6ea19f0 in fileno_unlocked () from /lib/libc.so.6 #1 0x000000000051d2ff in gdb_setup_readline () at ../../src/gdb/event-top.c:1086 #2 0x00000000004aaa09 in mi_interpreter_resume (data=3D0x0) at ../../src/gdb/mi/mi-interp.c:107 #3 0x00000000005180d7 in interp_set (interp=3D0xa7a850, top_level=3D0) at ../../src/gdb/interps.c:197 #4 0x000000000051834e in interpreter_exec_cmd (args=3D, from_tty=3D) at ../../src/gdb/interps.c:398 #5 0x0000000000459984 in execute_command (p=3D0xb295fd "t", from_tty=3D0) at ../../src/gdb/top.c:442 #6 0x00000000004a2c04 in execute_control_command (cmd=3D0xb23c40) at ../../src/gdb/cli/cli-script.c:400 #7 0x00000000004a31ad in execute_user_command (c=3D0xb3fd60, args=3D0x0) at ../../src/gdb/cli/cli-script.c:324 > I had seen this in passing many moons ago, but today I told myself I > really should report it. =A0Should I open a bugzilla about it? Probably. I think every crash in GDB deserves a bugzilla entry. Cheers, --=20 Paul Pluzhnikov