From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on starla X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Received: from nue.mailmanlists.eu (nue.mailmanlists.eu [94.130.110.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id BCA831F406 for ; Thu, 30 Nov 2023 12:33:08 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; secure) header.d=ml.ruby-lang.org header.i=@ml.ruby-lang.org header.a=rsa-sha256 header.s=mail header.b=f7Cgkt5N; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=qSV5HiZf; dkim-atps=neutral Received: from nue.mailmanlists.eu (localhost [127.0.0.1]) by nue.mailmanlists.eu (Postfix) with ESMTP id 04146815BE; Thu, 30 Nov 2023 12:32:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1701347579; bh=TgFzYg//P68kXQVbeL+fFp0Hm5K53FoMNEcgSDMy8Oo=; h=Date:References:To:Reply-To:Subject:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From:Cc:From; b=f7Cgkt5NmgVttOE/9PAdpp95Vclvg0vRxxFcSK+iic83SUOdOrmabqkolbTq17qfU 7j9bRN0UcsCkgCnJP0tujwR57A/+4fhXK50ZJzUNocyr87HYssRcOwxvnI5PxnGL3v 9r0LpAoAj2XEN6eIUHQCS6qztFzPnelpclWpUzqA= Received: from csnrwnwx.outbound-mail.sendgrid.net (csnrwnwx.outbound-mail.sendgrid.net [198.37.146.154]) by nue.mailmanlists.eu (Postfix) with ESMTPS id 4D34C81591 for ; Thu, 30 Nov 2023 12:32:55 +0000 (UTC) Authentication-Results: nue.mailmanlists.eu; dkim=pass (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=qSV5HiZf; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ruby-lang.org; h=from:references:subject:mime-version:content-type: content-transfer-encoding:list-id:to:cc:content-type:from:subject:to; s=s1; bh=AwrMJK8S6Oqg5Fvw4COjw5bxrMjsqtscPj+7LTBNxRw=; b=qSV5HiZfLFgXupU4TuypTKLbJG2d+2O9oC1UjIfp/Psum85e5r2OxFvc68blBggE8gFq x9xljefE0kPTwbxZ+SPLUvKQRkhsWN8VL7OgqTyh8ivD9Rw+rSOP3X5IBzgu2ZWXkF3TTf H4xtsB88LIx6W1aM0dP0Sq8XTled7VuTbEPb3Edm7nPGcpszn4oG8belGbFNvW0hnjGqrx X8gre9zV0Vg/MBMgYXo71dEP9rT9JUDKp6zl9SWr0iXOMUYNlsJw6Rq/o+F7bdRvJwu14z Nu35W1LTDfq8rC0c6peTPuQ1gJ23albMKU7eVtFS47bl48N47HTFeIjT17wVM5ow== Received: by filterdrecv-5bbdbb56cd-hwvxf with SMTP id filterdrecv-5bbdbb56cd-hwvxf-1-656880F5-9 2023-11-30 12:32:53.211254536 +0000 UTC m=+3779582.426236820 Received: from herokuapp.com (unknown) by geopod-ismtpd-0 (SG) with ESMTP id aZEBIvUrRM6663_VU1ZCCg for ; Thu, 30 Nov 2023 12:32:53.090 +0000 (UTC) Date: Thu, 30 Nov 2023 12:32:53 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 19117 X-Redmine-Issue-Author: byroot X-Redmine-Sender: Eregon X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-Redmine-MailingListIntegration-Message-Ids: 92084 X-SG-EID: =?us-ascii?Q?DvL3W2Xo+Vk=2FeUn3F50L=2FNc8u9NqZCnbE0mXZHiyye4R1YZg=2FtAFc0SAFzpcS=2F?= =?us-ascii?Q?Zcr7BqPN=2FYCcMZBMITNeIci9STxYay0JAJWPbek?= =?us-ascii?Q?rFR+qVEjfyRnt6hoEU3UGbQduGip9tWa4htc4VE?= =?us-ascii?Q?K1dZsPUTl=2FQHorhkC2r5WyEsOLXPL96zcpL6dc7?= =?us-ascii?Q?Bg5BbmCuYV6poheFMOl+13Zc+RoCNwuonjWgLDj?= =?us-ascii?Q?S5Zq1vmcXa=2F8vm+D+n3GmJC=2FXXXvTPwBHqbGJ+X?= =?us-ascii?Q?c1WPGQpqCIA94YVs4USSA=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== Message-ID-Hash: X6QRFUAJQ2VCX6F7WHKREGQ5YGCMVLK6 X-Message-ID-Hash: X6QRFUAJQ2VCX6F7WHKREGQ5YGCMVLK6 X-MailFrom: bounces+313651-b711-ruby-core=ml.ruby-lang.org@em5188.ruby-lang.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list Reply-To: Ruby developers Subject: [ruby-core:115546] [Ruby master Feature#19117] Include the method owner in backtraces, not just the method name List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "Eregon (Benoit Daloze) via ruby-core" Cc: "Eregon (Benoit Daloze)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #19117 has been updated by Eregon (Benoit Daloze). mame (Yusuke Endoh) wrote in #note-21: > * How much impact does exception generation have on performance? (Each frame of the backtrace needs to maintain self) That's a good point. While the method name can be stored in the bytecode or so, not so much for the module name (especially since it can get a proper name later). In many cases it can be known statically or is the same when defining the method, but not always (e.g. `MyStruct = Struct.new(:x) { def foo; end; }`). Maybe we should only use this notation when the module name is known statically? ---------------------------------------- Feature #19117: Include the method owner in backtraces, not just the method name https://bugs.ruby-lang.org/issues/19117#change-105481 * Author: byroot (Jean Boussier) * Status: Open * Priority: Normal * Target version: 3.4 ---------------------------------------- ``` module Foo class Bar def inspect 1 + '1' end end end p Foo::Bar.new ``` This code produce the following backtrace: ``` /tmp/foo.rb:4:in `+': String can't be coerced into Integer (TypeError) from /tmp/foo.rb:4:in `inspect' from /tmp/foo.rb:9:in `p' from /tmp/foo.rb:9:in `
' ``` This works, but on large codebases and large backtraces the method name isn't always all that revealing, most of the time you need to open many of the locations listed in the backtrace to really understand what is going on. I propose that we also include the owner name: ``` /tmp/foo.rb:4:in `Integer#+': String can't be coerced into Integer (TypeError) from /tmp/foo.rb:4:in `Foo::Bar#inspect' from /tmp/foo.rb:9:in `Kernel#p' from /tmp/foo.rb:9:in `
' ``` I believe that in many case it would allow to much better understand the backtrace without having to jump back and forth between it and the source code. This is inspired by @ivoanjo 's `backtracie` gem: https://github.com/ivoanjo/backtracie -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/