From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28540 invoked by alias); 21 Mar 2014 16:24:52 -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 28530 invoked by uid 89); 21 Mar 2014 16:24:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: mail-la0-f50.google.com Received: from mail-la0-f50.google.com (HELO mail-la0-f50.google.com) (209.85.215.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 21 Mar 2014 16:24:50 +0000 Received: by mail-la0-f50.google.com with SMTP id y1so1820336lam.37 for ; Fri, 21 Mar 2014 09:24:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=1E12oGVeeB9oWHtRwS1AtDlrAXgjtc/FURfYlqSDWFg=; b=Gf4zVhbg6dlRIimJPNnta+UKF/K62qclMcNVY+tsVxzKR28fM6pJmCNsE8HLcJE8KP s9BnoCMwRxmRHU9urKSyUPWGEEPySTxLsTtsSgrGdDOHwePeesjiRML1smTAcFgE8RMt JNCdOsFPwU7/gJqT/dnPlTfMMrk7gmtmAX/n9w/u1jTf0zyDeMKoOI4ehsI0d6Bo5kAM fVBahfkS73TjBuL9tRdYt7w33zQOEIUnArtiU6AX2KkzuhsVLYD58Sxt0nvYvGXNor4i 96fVd9I1mlxM95QBMi2eg9xQIqSH+aUHG5tzh2VhC1gq0cFKowqygQz3CUeP362HyD4A b2lQ== X-Gm-Message-State: ALoCoQlzb7PDUOrlGbk4/ZjHe6kyvWorYJLURGEZCCTwDi7S6poJyTqOZmRKTwMCiAYwszNad9bT MIME-Version: 1.0 X-Received: by 10.152.42.230 with SMTP id r6mr11084559lal.32.1395419086128; Fri, 21 Mar 2014 09:24:46 -0700 (PDT) Received: by 10.112.9.40 with HTTP; Fri, 21 Mar 2014 09:24:46 -0700 (PDT) In-Reply-To: References: Date: Fri, 21 Mar 2014 16:24:00 -0000 Message-ID: Subject: Re: [PATCH] Small segfault fix when there is no python From: Daniel Gutson To: Doug Evans Cc: Sergio Durigan Junior , gdb-patches Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2014-03/txt/msg00523.txt.bz2 Thanks Doug and Sergio! Daniel. On Thu, Mar 20, 2014 at 2:52 PM, Doug Evans wrote: > On Thu, Mar 20, 2014 at 10:31 AM, Sergio Durigan Junior > wrote: >> On Thursday, March 20 2014, Daniel Gutson wrote: >> >>> Hi, >>> >>> the small attached patch prevents gdb to segfault when an extension >>> language definition has no ops, >>> which e.g. occurs when HAVE_PYTHON is not defined so >>> extension_language_python remains with ops in NULL. >>> This causes the line >>> if (extlang->ops->eval_from_control_command !=3D NULL) >>> (in eval_ext_lang_from_control_command) to dereference a null pointer. >> >> Hi Daniel, >> >> Thanks for the patch. This is a simple patch so it doesn't need a >> copyright assignment from you. However, if you intend to continue >> contributing to GDB, please e-mail me offlist and I can send you the >> papers to obtain the assignment. >> >> Just a few comments about formatting issues. >> >>> 2014-03-20 Daniel Gutson (daniel.gutson@tallertechnologies.com) >>> >>> gdb/ >>> * extension.c: (eval_ext_lang_from_control_command) Added check to >>> prevent dereference of null pointer. >> >> The ChangeLog format is wrong. Take a look at the ChangeLog file for >> lots of examples, but basically you need to write: >> >> 2014-03-20 Your Name >> >> * file.c (function): Added check to prevent blabla... >> >> Pay attention to the 2 spaces between the date, the name and the e-mail, >> and also to the TAB character indenting the description. >> >>> diff --git a/gdb/extension.c b/gdb/extension.c >>> index c2f502b..8357ee8 100644 >>> --- a/gdb/extension.c >>> +++ b/gdb/extension.c >>> @@ -342,11 +342,14 @@ eval_ext_lang_from_control_command (struct comman= d_line *cmd) >>> { >>> if (extlang->cli_control_type =3D=3D cmd->control_type) >>> { >>> - if (extlang->ops->eval_from_control_command !=3D NULL) >>> - { >>> - extlang->ops->eval_from_control_command (extlang, cmd); >>> - return; >>> - } >>> + if (extlang->ops !=3D NULL) >>> + { >>> + if (extlang->ops->eval_from_control_command !=3D NULL) >>> + { >>> + extlang->ops->eval_from_control_command (extlang, cmd); >>> + return; >>> + } >>> + } >> >> You could simplify this by writing: >> >> if (extlang->ops !=3D NULL && extlang->ops->eval_from_control_command = !=3D NULL) >> >> If you don't want to join the two "if"s, then you don't need to put the >> braces on the outter "if", because it has one single statement. >> >> The patch looks good to me, but I'm not a maintainer and can't approve >> it. >> >> Thanks, >> >> -- >> Sergio > > > I did an audit of all the uses of ->ops and think this is the only one I = missed. > I will commit with the needed changes. > Thanks for the patch! --=20 Daniel F. Gutson Chief Engineering Officer, SPD San Lorenzo 47, 3rd Floor, Office 5 C=F3rdoba, Argentina Phone: +54 351 4217888 / +54 351 4218211 Skype: dgutson