From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x241.google.com (mail-oi1-x241.google.com [IPv6:2607:f8b0:4864:20::241]) by sourceware.org (Postfix) with ESMTPS id 1D7BB3951C6B for ; Fri, 17 Jul 2020 16:11:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1D7BB3951C6B Received: by mail-oi1-x241.google.com with SMTP id t4so8407772oij.9 for ; Fri, 17 Jul 2020 09:11:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=m/4Hr1QetcR3L6go6UH/PMBRYMdRPBwPF6SexCkmCHI=; b=Xouj86EtiLQs+eXo1kmacTbS9Qdx6AbG1MmUcv1Q+JSXiAaq8a84KRVoAUL4BCQxie kp5JW/w886VzKUfpeLi/19kN3XKPbni19Wn5HSBbSvn3xah6l/pWEoO46NnbnXFYRLoX vpJB8Z51bMBMgRz6bUJcPjAeTu2X+98JFs5pq0aFgfN//pll8M0b3kZvDm/xY/GANBuQ 1Tkz2bkuR6yShGW7VaBRN9w8A4fKAK2xQuLzgvWRZu7hHwCfnNPRO9V/kqgH85ZCYc3X FdEeZHqaC56vPqWGdIIv2JuCyVXBj3oZ1K6LIY0ht04A3CArjma0e/IJtGbOtgrPoWG+ p2hA== X-Gm-Message-State: AOAM532rIQK5IGXbBuCalNgpTYmZtwD1sq9o7qlXnVTnpCD6sCpgmhAD vrK5Jl43MWuXNmLJDJ3EudkoLRktLS3Uu9q4xQc5O0IQ X-Google-Smtp-Source: ABdhPJzCdSsiQN2o9Uy3H6oNtSBGUAT7hyWVXsV1tNHoOuedA1J8cz/4R9Xrc287JobGjFq/yEOqvax/t1iJb1xXaik= X-Received: by 2002:aca:b689:: with SMTP id g131mr8250301oif.62.1595002314097; Fri, 17 Jul 2020 09:11:54 -0700 (PDT) MIME-Version: 1.0 From: Reuben Thomas Date: Fri, 17 Jul 2020 17:11:43 +0100 Message-ID: Subject: Adding Python files to be autoloaded for a particular architecture To: gdb@sourceware.org X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jul 2020 16:11:57 -0000 I have implemented gdb/binutils support for a new architecture (more on that if & when I get it into a state in which it might be mergeable), and I would like to have some Python loaded by default, to cope with an unusual feature of the architecture (it's a stack machine, and gdb doesn't seem to support stacks directly, so I added some Python routines to print out and modify the stack). This seems to be a suitable candidate for SYSTEM_GDBINIT_FILES. But if I simply add a file to `SYSTEM_GDBINIT_FILES` in `gdb/data-directory/Makefile.in`, and then configure with --with-system-gdbinit-dir=$pkgdatadir/system-gdbinit then all of the files are installed (there are already two existing files, `elinos.py` and `wrs-linux.py`) and loaded when gdb starts up. This causes errors, as `wrs-linux.py` in particular expects to find an environment variable which I have not set. So I wonder how I should do this? Ideally, I would like to load a file when gdb is configured for my new architecture, but I can't find a mechanism for that. I tried running `make SYSTEM_GDBINIT_FILES="my_file.py", but this environment variable does not get passed to make in `data-directory`, so has no effect unless I specifically run `make` in that directory. Apologies if I've overlooked something obvious. I have been impressed that so far I have been able to add a new backend with gdb/ld/gas/bfd/opcodes support with no documentation (well, I did cheat a bit, and referred to the defunct Internals manual; but on the whole the code is fairly clearly laid out, and simply picking an existing architecture and finding all references to it provided enough guidance). -- https://rrt.sc3d.org