From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta040.useast.a.cloudfilter.net (omta040.useast.a.cloudfilter.net [44.202.169.39]) by sourceware.org (Postfix) with ESMTPS id 062C53858C53 for ; Wed, 7 Feb 2024 20:05:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 062C53858C53 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 062C53858C53 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707336318; cv=none; b=GzUd7/3vqw+U6CSme/s/+AK/izkOEpfWnrEJGmvqkt/1QFzrPWD4Hp3RiRBnLqYuS6tWcDt10j9U6BMNVqtBQKslFiE9uAOttYDgjLgo5dBW+fkG+j38v7QjW8w9tL+8VHiZHfchFNpYSBkIWBtaBSfAU0MOjZPihRZgIoOEECQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707336318; c=relaxed/simple; bh=kHKFPzD1p8A+vioBmOfXeBlePZFOLSP4eWS8sGRp4d0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ma/h01Pe9mPhhaOt4yQDpVmj/xNrGKgWY6Qnk853B4MR9ZWSgQ6CnL5irgf5UOCzgaFHNB614qaDKCAbudQAtCtEcQfMOoSHPpYNj1yaPRHNywwTgyRvXCsmFWMeNa8kwu9BtC+UuUj8Jdr6Te+7peucDq3X4zunBGTXvNZ3EHk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6002a.ext.cloudfilter.net ([10.0.30.222]) by cmsmtp with ESMTPS id XSRIrAZs3THHuXoAWrEOW6; Wed, 07 Feb 2024 20:05:16 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id XoAVrLU3pAlpAXoAVrWpUb; Wed, 07 Feb 2024 20:05:16 +0000 X-Authority-Analysis: v=2.4 cv=cJBDsUeN c=1 sm=1 tr=0 ts=65c3e27c a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=k7vzHIieQBIA:10 a=Qbun_eYptAEA:10 a=pGLkceISAAAA:8 a=P0flGKTokk6G2VTM-FsA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=swSXtSwqwDT4XwHpUMzDtjt5Z2/R7ilr4E2c0RcdEXc=; b=kC7QGjjC6baKKe/jLHmDqjFH7D ZzHnCzij0Op0Koc6qu5thTTGBUyhPopH/1J2dzDoTHU1eYXtIuB5EuELxZ5maEyGuV7zH9bZaGIJC 0wycpDmMk8kK/lvkvcugcXTeM; Received: from 97-122-68-157.hlrn.qwest.net ([97.122.68.157]:53556 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1rXoAV-0017pb-1A; Wed, 07 Feb 2024 13:05:15 -0700 From: Tom Tromey To: Simon Farre Cc: gdb-patches@sourceware.org, tom@tromey.org Subject: Re: [PATCH v3 3/5] [dap & linetable]: Change gdb.LineTableEntry & Add gdb.lookup_linetable References: <20240122133115.201205-1-simon.farre.cx@gmail.com> <20240122133115.201205-3-simon.farre.cx@gmail.com> X-Attribution: Tom Date: Wed, 07 Feb 2024 13:05:14 -0700 In-Reply-To: <20240122133115.201205-3-simon.farre.cx@gmail.com> (Simon Farre's message of "Mon, 22 Jan 2024 14:31:13 +0100") Message-ID: <8734u4avlx.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.68.157 X-Source-L: No X-Exim-ID: 1rXoAV-0017pb-1A X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-68-157.hlrn.qwest.net (murgatroyd) [97.122.68.157]:53556 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfABlKOhrebY176eOPW6Szl8JXAmghZzzfoFeT10VLElKIrXjIciIup3UI//lbulqtF/ogvoTmK2hcNHotRF/f7FT5ULWMMgESq2hfeAYox4eKeVzZ/Nn n4d0RcPZPuK7WIpcYmV4MmR8VUfTlACbuxeO1oskixTgmD9AXNk96glfGxNm+iLWh964VWmUVXMVL8I/fbE2FaV7W1ZrWeEKnD8= X-Spam-Status: No, score=-3016.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: >>>>> "Simon" == Simon Farre writes: Thanks for the patch. Simon> static PyObject * Simon> -build_line_table_tuple_from_pcs (int line, const std::vector &pcs) Simon> +build_line_table_tuple_from_pcs (int line, const symtab& sym, const std::vector &pcs) gdb uses a line length around 80, so this should be split. Also the "&" attaches to the "sym", not "symtab" -- this is also true for "*" in gdb, there's a few instances of this around. Simon> +/* Search for a symtab whose fullname contains FILENAME and return it's Simon> + linetable. */ Simon> +PyObject * Simon> +gdbpy_lookup_linetable_by_filename (PyObject *, PyObject *args, PyObject *kw) Simon> +{ Simon> + const char *arg = nullptr; Simon> + static const char *keywords[] = { "filename", nullptr }; Simon> + Simon> + if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s", keywords, &arg)) Simon> + { Simon> + return nullptr; Simon> + } Don't need the braces here. Simon> + Simon> + for (objfile *objfile : current_program_space->objfiles ()) Simon> + for (compunit_symtab *cu : objfile->compunits ()) Simon> + for (symtab *s : cu->filetabs ()) Simon> + { Simon> + const auto name = symtab_to_fullname (s); Simon> + Simon> + if (strstr (name, arg)) This doesn't seem like a great approach to me. Substring matching isn't how this kind of thing works elsewhere in gdb. Also this looping approach means that the symtab must somehow have already been expanded. Right now, the breakpointLocations request works by calling MI's -symbol-list-lines. This calls lookup_symtab, which in the end will try expanding CUs to find the desired symtab. Tom