From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Tornabene Newsgroups: gmane.lisp.guile.user Subject: argument(s) for "make-command" in guile extension for gdb Date: Sun, 5 Feb 2023 15:38:50 -0600 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19544"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-user Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sun Feb 05 22:39:40 2023 Return-path: Envelope-to: guile-user@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 1pOmjc-0004vo-3C for guile-user@m.gmane-mx.org; Sun, 05 Feb 2023 22:39:40 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOmj6-0005YX-Pk; Sun, 05 Feb 2023 16:39:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pOmj4-0005Xu-J6 for guile-user@gnu.org; Sun, 05 Feb 2023 16:39:06 -0500 Original-Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pOmj2-0006P1-Js for guile-user@gnu.org; Sun, 05 Feb 2023 16:39:06 -0500 Original-Received: by mail-ej1-x631.google.com with SMTP id k4so29241681eje.1 for ; Sun, 05 Feb 2023 13:39:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=2ZCJ86xsEZyTdnbgdjwYIB84f0M9ukQTvAxbry/mZCo=; b=qoAhNTkvlyqg1lGWpu35cCHE6UbYxGYSgtqX8LMeuuBnphuiNvLQRbbcyy9sLh6ySC AAWqSSia3udbFofWZM+uSku6tnZDmTR0Ttkwxbqr/nLcgUd2IlrwYlXXDIT5KppQ0JZc LXOPlKDckG+fkVsQxkKYYWNUG4JoWlhoHudSKtPjAih8ipyhbihbDFNty9VjOM7A4qZ/ AsAoCNqJ5Rw3YrPI/+0sIcUHfujOh00EqVct0ZPYp5c4Veyfy0qzI6Wifh7Lj5LJ8kEt LtcIwBwk+vBkL4nupJBq+NNfRrG2gKDr/dlHvRoHVoZz7pnK6U2u3ZszqmKc94ezo24c mZ5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=2ZCJ86xsEZyTdnbgdjwYIB84f0M9ukQTvAxbry/mZCo=; b=DZjxRH6k38SrTA5T7jU7MNtz0WPaTR5Gv9x0LwVe3L6o9w9Uaf8HWlSb5p2/76VkSS 9kI48AhwkZeAtuWRWJyof8aqeqmUQHpEp7T3w0Eb05wlYM+d++rBrY3B5zjGwsqBN7BQ cSQCqdzebXLEB7z0JMcaYMlysGRNQVsq98Qq56xgVF/uZ32tmPpH80kxAPJdgbKVYAag Mtsuti7FrfsJfhs0vxSUZVPDswn7S1+MLaVhSBH4yA57n74PBjoIJ+Boi6uZKnEIf1Xh YgLq4tw1ektktTdflxioInmWm1xJD0bsZQxdAP4VZIPuKkpNIsm5dbazLTsbAVROaZiZ PG3Q== X-Gm-Message-State: AO0yUKXZUu/X7JXbxNsQ1ao/sQwwJI6OP2fg6D5/jr7K0bJRREaJR6yo hwXzOWAJ56SzignKvLHkQTLzlcTEA02VCsZqt2PXqIaFN1A= X-Google-Smtp-Source: AK7set8M+iOe5g2+V+TzlVFEhrqMXICk27ITyiOA9MmyyxLYZol59NXKlGstLTuZTXOND1pacjWoQJ+JxuL3wzfn63Q= X-Received: by 2002:a17:906:1810:b0:886:221b:44e3 with SMTP id v16-20020a170906181000b00886221b44e3mr4429310eje.40.1675633142056; Sun, 05 Feb 2023 13:39:02 -0800 (PST) Received-SPF: pass client-ip=2a00:1450:4864:20::631; envelope-from=d.t.peters777@gmail.com; helo=mail-ej1-x631.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:18887 Archived-At: Hey all, asked on irc but didn't get any bites, read some of the source and didn't immediately make sense of it (skimmed the source more like it) so I'm trying here: I'm writing an extension for GDB using guile and while testing out different code snippets I've hit a wall trying to figure out how to pass in multiple arguments to a command created by make-command. https://sourceware.org/gdb/onlinedocs/gdb/Commands-In-Guile.html#Commands-In-Guile In the docs #:invoke (lambda (self args from-tty) is the argument list and "args" is denoted as a representation of the arguments (plural) as "a string" passed to the new command. So far I've been able to create a command that takes a single argument, passed as an unquoted string or symbol in the "args" position, but if I try to pass a string, or multiple arguments, or quote them, or quote a list containing multiple args as a list of strings or symbols, nothing seems to work. As usual I suspect that there is a simple solution to this I'm missing but at this point I'm at a loss as to how to create a command that takes multiple arguments. Any help or direction would be appreciated. as an example, I've taken the documentation code for disassembly in guile and attempted to adapt it as a straight forward guile-implemented command: Here's the code: ;;; the function that the command calls (define (multi-dis reg size) (let* ((wreg (simple-format #f "$~A" reg)) (nreg (value->integer (parse-and-eval wreg))) (mem (open-memory #:start nreg)) (bv (get-bytevector-n mem size)) (bv-port (open-bytevector-input-port bv)) (arch (current-arch)) (dis (arch-disassemble arch nreg #:port bv-port #:offset nreg)) (one (car dis))) (format #t "this is the first value of your disassembly ~x \n" (assq-ref one 'address)) (simple-format #t "this is the second value of your disassembly ~A \n" (assq-ref one 'asm)))) ;;; the attempted command definition with incorrect arg list to demonstrate (register-command! (make-command "m-dis" #:command-class COMMAND_OBSCURE #:invoke (lambda (self reg size) (multi-dis reg size)))) this is the only version I wrote that would compile, but it still failed, with the second argument producing an unnamed " a syntax error in expression, near `10' where the command at the gdb interpreter was (gdb) m-dis rax 10 other attempts included those listed above #:invoke (lambda (self "reg size" from-tty) #:invoke (lambda (self '(reg size) from-tty) etc... All of the above resulted in "bad argument list" errors being thrown on attempted compilation.