From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Patrick Mahan Newsgroups: gmane.emacs.help Subject: Re: Automatically modifying the gud-gdb command line Date: Tue, 23 Jun 2020 14:25:22 -0700 Message-ID: References: <87o8p95xo9.fsf@ebih.ebihd> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="70973"; mail-complaints-to="usenet@ciao.gmane.io" To: Emanuel Berg , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 23 23:26:00 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jnqQa-000IKx-MU for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 23 Jun 2020 23:26:00 +0200 Original-Received: from localhost ([::1]:56374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnqQZ-0001gR-Ob for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 23 Jun 2020 17:25:59 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnqQC-0001gL-7O for help-gnu-emacs@gnu.org; Tue, 23 Jun 2020 17:25:36 -0400 Original-Received: from mail-ua1-x92e.google.com ([2607:f8b0:4864:20::92e]:46265) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jnqQA-0000yf-9X for help-gnu-emacs@gnu.org; Tue, 23 Jun 2020 17:25:35 -0400 Original-Received: by mail-ua1-x92e.google.com with SMTP id i15so14434uah.13 for ; Tue, 23 Jun 2020 14:25:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=qylUZWVLmQ+G9v+oWbSxt82yv/o6eejA0wbGm7WAB08=; b=fB5jOOHuZnY7xdwhcBcGrEOvausboHpsTzkdROqpfWCbyrd4/yQe/YpprQXxAXpef/ lyGWZUlcDSrw9mmHa3khkFbo3zxoZ/0CEioA8nuLbsi6UtULXPiiv7DbUaB+IG1OJh0k gGq8g82TJo0QikPx8d89g5IIrnxSPEGeLn1JOZZSOVjPsMdjn5lOD4P9jGj0oexAwS9G JsKe8mhaEjLOQR01aPX5TLhjyb/QUHJaU7caQ/ewFHs4A8QIxlsgl2YYny6ogx5FM6eL KgmYKb4KXri51OJDkLAkrbyJTwW8nZiQHxdQV+nXhWyAJr+IzxEoNfdSwVoI9wotjzl4 vIJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=qylUZWVLmQ+G9v+oWbSxt82yv/o6eejA0wbGm7WAB08=; b=JYXW3HX9nTVBwKWAZR/yUGjW7aSyMrZRckxv/cz7fz5zTJzrZjkwxAtT6bBWARsGqn A86gF+3mx5ojcJf2MkE1Hngp288GaFFBtVntO51Knoma/KS+GjVld56Kvfo829McBykM vLIQ5EJgkU2/ihxwQU7XQ2hgYCVbnCOE8ABL9g2Jt3MCeRne9BgLzMhMs3fD6xX02uoN kMSTUYb8CgT2Rhv7hLl/nicS7DOBG7rn0BNwyD/bgIeK+weShw33wCpgqy4Y+WWjk5/+ swVIrZC0W0SxzTS6xQN7pdWMIBaCOZQ64KttPIT3X0aoPF4N4hcnc2R/B5w1qN7TWm4b ttMQ== X-Gm-Message-State: AOAM533kd8eZEh+ygV5MMbmcu07jfH5VVrnjQ0ZeXBJ6K/KuqjOW4DeK 9omaPuZStsN1RX5DjQFdqtR2pgAO9ZZG5u50uz0= X-Google-Smtp-Source: ABdhPJxZQ9DemwJ9OUSdjDHXMz/i11ELGYeVoy16g0hGbyzG3MAhCOuOSgU13xifFWRNKpX0FjLesZw4h9JB591xiEo= X-Received: by 2002:ab0:6445:: with SMTP id j5mr15231864uap.26.1592947533142; Tue, 23 Jun 2020 14:25:33 -0700 (PDT) In-Reply-To: <87o8p95xo9.fsf@ebih.ebihd> Received-SPF: pass client-ip=2607:f8b0:4864:20::92e; envelope-from=plmahan@gmail.com; helo=mail-ua1-x92e.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:123431 Archived-At: On Tue, Jun 23, 2020 at 1:35 PM Emanuel Berg via Users list for the GNU Emacs text editor wrote: > Patrick Mahan wrote: > > > I would like to automate this process (can > > I pre-config the command line used by gud-gdb?) so > > I can possibly turn this into a simple turnkey > > procedure > > Can't you do it with gdb aliases? > > (info "(gdb) Aliases") > > or > > > https://www.zeuthen.desy.de/dv/documentation/unixguide/infohtml/gdb/Aliases.html > > No, that is not what I am looking to do. I am looking to change the actual gdb invocation command automatically as opposed to manually. For example, if I have a crash report from a customer, it consists of (among other things) the image that crashed and the core file. I have a shell script that pulls some symbols (using nm) from the image to determine which source release branch, etc, and uses this information to generate a gdb init script. Say I am debugging our routerd process, I would have the routerd ELF image and the core file. I then invoke gdb from inside emacs using 'M-x gud-gdb '. This produces the prompt: 'Run gud-gdb (like this): gdb --fullname routerd' I then manually modify that to be 'Run gud-gdb (like this): gdb --fullname -x routerd.gdbinit routerd core.1234' hit enter and gdb is launched with the GUD front-end and my symbols are loaded, all .so are found, etc. I can then begin my debugging, usually by first doing a 'info threads'. But what I am trying to achieve is a way to just have 'M-x gud-gdb ' prompt with 'Run gud-gdb (like this): gdb --fullname routerd.gdbinit routerd core.1234'. The caveat being that I only want the changes if those files exist in the local directory. Looking at the gud-gdb command in I see that the prompt is coming from gud-query-cmdline: '(interactive (list (gud-query-cmdline 'gud-gdb)))'. I see there is a global variable I can customize 'gud-gud-gdb-command-name' that is initially set to "gdb --fullname". I do not see any hooks available to change that value on the fly, so I was planning to mod it before invoking gud-gdb. However, there does not seem to be a mechanism to add the 'core.1234' to the line as well short of modifying 'gud-query-cmdline'. So I am looking for suggestions ;-) Thanks, Patrick > -- > underground experts united > http://user.it.uu.se/~embe8573 > https://dataswamp.org/~incal > > >