From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: "otadmor ." Newsgroups: gmane.emacs.help Subject: Re: Executing Emacs commands when a gdb breakpoint is hit Date: Tue, 7 Apr 2020 23:21:46 +0300 Message-ID: References: <83o8uwvekv.fsf@gnu.org> <831rrrv2vq.fsf@gnu.org> <83d0batene.fsf@gnu.org> <83ftg5s2p2.fsf@gnu.org> 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="66962"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Eli Zaretskii Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Apr 07 22:22:23 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 1jLujl-000HFl-Il for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 07 Apr 2020 22:22:21 +0200 Original-Received: from localhost ([::1]:52938 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLujk-0000Ep-LD for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 07 Apr 2020 16:22:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57067) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLujS-0000EW-QZ for help-gnu-emacs@gnu.org; Tue, 07 Apr 2020 16:22:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLujR-00042y-FT for help-gnu-emacs@gnu.org; Tue, 07 Apr 2020 16:22:02 -0400 Original-Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]:41707) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jLujP-00040d-JK; Tue, 07 Apr 2020 16:21:59 -0400 Original-Received: by mail-lf1-x130.google.com with SMTP id z23so3402004lfh.8; Tue, 07 Apr 2020 13:21:59 -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 :cc; bh=w6fm69HI/3D2PnMCMm7TBgaleDOgBFIxUJ5PfkVbG9Q=; b=p99jXBNDOvmwIXM59owIG4hzhdGw6e9zgEX/KdHUBjhnkWvdlGClvbUQrqIZb+5GaP RSv0k4UpKcjr89BimL4hSvoPArlsMerACLZynMgXCteJENFkpBn5zs7Ng9Q4E/ycUmI4 cBe/wTbAkifD/PBKxumovJkQ/r6TBHsztI1Y0/kpAiT0rhiSMHQv8lweCCfy0UNFCXQy q+kMiOkmSksbJygy85mAXPUkGZqbKbiyajqDq7iurVBP7Ckx8hXxG2o6+oRLot/LpMHl l9erugtQPBkOsO5YyoKjEGaJxvwg03jTgTNoulNMO7Crg7HfJBofzBXkAoh6H682ibJo IVgA== 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:cc; bh=w6fm69HI/3D2PnMCMm7TBgaleDOgBFIxUJ5PfkVbG9Q=; b=Nyrq0wpl5G3hA7ZzB8Uk3krNZYD3DfEidXmrXvVqye0WvSCVVhAYEI9mIYrH/tbh9F OQzd1wlATmdORrOV/ybFjdZwDkWAmx1XGfC4Yfxl0JY735dIlPPxBXPY4JGT4O/aYE7Z sz6VeB6MloSfhdhmnr7YwmbVhN8j8TecpFBeaTULXGYYcs9AL/8hQQ2H0h5MTcPnX7V1 omC5qDa85rNshzsTXgFiMWoyj5wfUqhgJFjmVWxTUqklDcLSxsnaPavcaKhucWTsD+U5 Vuq3xxKSJK9N/sldzC/bMBgvY/pmcLrOuF94QTrmSGLGuUTNTEETzS65tybG5MBV8A1x jCig== X-Gm-Message-State: AGi0Puacd0LecbVF/r8Er7LkfloqHn8v8rz+NLsEQhY6kmfIs508s5hp Z3mKHyhhmAT8lRkgTOfPLls1ekNrGTzx1T7aq5IfMvGa X-Google-Smtp-Source: APiQypLe3nJsPMxOXrGw7Rfj0LlhY+xnJVnCmcW3yB98dce0D3YD6ZmzCvecUuk30K+2/eLFOpGv6mj91SLBESeUDYk= X-Received: by 2002:a19:6a06:: with SMTP id u6mr2448879lfu.140.1586290917272; Tue, 07 Apr 2020 13:21:57 -0700 (PDT) In-Reply-To: <83ftg5s2p2.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::130 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:122761 Archived-At: See example in https://github.com/otadmor/emacs-conf/blob/master/gdb.gif On Fri, Jan 24, 2020 at 10:01 AM Eli Zaretskii wrote: > > > From: Skip Montanaro > > Date: Thu, 23 Jan 2020 15:00:16 -0600 > > Cc: Help GNU Emacs > > > > But in general, I must admit I find this design somewhat strange. GDB > > offers you 3 extension languages: the CLI scripting, Python, and Guile > > Scheme. Why not use one of these to do what you want? this is how the > > GDB developers intended for you to extend the debugger for doing these > > kinds of jobs. If you use Guile, you could even write code that is > > almost Emacs Lisp ;-) > > > > Note that I'm not really trying to script GDB. I'm trying to adjust the display in Emacs of the file which is being > > compiled. It seems to me that the proper language for that is ELisp. > > Emacs displays stuff by following the responses from GDB. So > injecting such responses (by scripting GDB) will eventually allow you > to solve your problem, either entirely in the scripting commands, or > if customizing what Emacs does via the existing hooks. > > My point is that you shouldn't ask yourself "how do I run an Emacs > function when a breakpoint is hit", because there's no way of doing > that. This question encourages the line of thinking that leads you to > write code that cannot work well, because this line of thinking is > based on incorrect assumptions. > > > If I had (for > > example) two different stop functions in my list (I don't currently), it's not clear how I'd guarantee the two > > functions didn't step on one anothers' toes. > > The hook function receives the parsed MI response as its argument, so > each function can decide whether it does anything in each case. > -- Gretz, Ofir Tadmor ICQ: 77685691 Mail: otadmor@gmail.com