From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 57A443858D39 for ; Mon, 19 Dec 2022 13:53:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 57A443858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671458033; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=542C2g1tOZD+my6b/TAWGt17HlB0F0QIRC5bzLq9e7Y=; b=U3hBuj8lUk8S/bmIERlXUEnpPX9rIbJdbZrLBhx4nnbaxDgGxgNCznC8iFB/JoelYGPxAd 9x2iKeF5v7Lg7hIS+pU2aH/VMdz9s4ugNU+9a2SM7Ez/DAt+vdHMNMAgMTCqFOzuYuUckE lUBwxPYXWAV4/eY0au2YPlWRksv8VS8= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-502-kf1_-JNIOtin30M9DhtSdQ-1; Mon, 19 Dec 2022 08:53:51 -0500 X-MC-Unique: kf1_-JNIOtin30M9DhtSdQ-1 Received: by mail-ed1-f69.google.com with SMTP id y20-20020a056402271400b0046c9a6ec30fso6581030edd.14 for ; Mon, 19 Dec 2022 05:53:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=542C2g1tOZD+my6b/TAWGt17HlB0F0QIRC5bzLq9e7Y=; b=WC9m5XsIFGsd6zf8wHeoFvJucXlqtOz4B4p7+rLDpfEcmF7IgTrybdbPYQGHx+mqOx HCc+3/t1kZNerf09rbv6EOYamRMwj2isp240K4Zt5NCkaxmMTuB9VfkGlHO2n+nXm4BG ROWtnQa09XX3tFmJqJSqfJ6NY4Sj0bu4CHguVvlLE0qC8fVfuSjurTPZ0RoD8qxaN0il XJQxxpgnpOlCiZibv/SCuyO5I5H08dDhr1iSN/8ey3SaGwAVNjkccqMx/00k+xlkI9sl 0InhYxBvUPRRjPG/XNhNfRNAtd1MPjIvc5y1mbXTrjp9XWVD8JLqp6WAaojf4ZhHC0b4 gulQ== X-Gm-Message-State: ANoB5pkaIzjprJT/nploY2OMEP/KeHl9ks6MpQIQ2yLDLJpLMfL4CZW8 Tpt9rTeuBERC3Wl3ITOcXcfd1mmmnv/D9y72BDTqUHmGMsk3Z/M9Vm1IHStybM8d1YZwxWyr8P/ 6RyPFmkIQGCrQunbtZ7SIwmeucDXL/nAZGlwRoHdyx56gQwSJCcjBqZVqbjIOUtISybfr X-Received: by 2002:a17:906:1c0c:b0:7c1:e7a:62e6 with SMTP id k12-20020a1709061c0c00b007c10e7a62e6mr35502065ejg.71.1671458030231; Mon, 19 Dec 2022 05:53:50 -0800 (PST) X-Google-Smtp-Source: AA0mqf6vB1eJ3Tg0oW4BgLcQwgTjsJIqzQWAzEHtO5FoX/mUqJfE++D9J9bmdM5wR6ldbigPnb7Nrg== X-Received: by 2002:a17:906:1c0c:b0:7c1:e7a:62e6 with SMTP id k12-20020a1709061c0c00b007c10e7a62e6mr35502048ejg.71.1671458029928; Mon, 19 Dec 2022 05:53:49 -0800 (PST) Received: from ulissedini.. ([81.56.11.23]) by smtp.gmail.com with ESMTPSA id t21-20020a056402021500b00463bc1ddc76sm4377476edv.28.2022.12.19.05.53.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Dec 2022 05:53:49 -0800 (PST) From: Maurizio Papini To: binutils@sourceware.org Cc: Maurizio Papini Subject: [PATCH 1/2] addr2line: new option -n to add a newline at the end Date: Mon, 19 Dec 2022 14:53:02 +0100 Message-Id: <20221219135303.116222-2-mpapini@redhat.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221219135303.116222-1-mpapini@redhat.com> References: <20221219135303.116222-1-mpapini@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --- binutils/addr2line.c | 11 +++++++++-- binutils/doc/binutils.texi | 5 +++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/binutils/addr2line.c b/binutils/addr2line.c index baf16716182..d9338e9f1ea 100644 --- a/binutils/addr2line.c +++ b/binutils/addr2line.c @@ -45,7 +45,7 @@ static bool with_functions; /* -f, show function names. */ static bool do_demangle; /* -C, demangle names. */ static bool pretty_print; /* -p, print on one line. */ static bool base_names; /* -s, strip directory names. */ - +static bool add_newline; /* -n, add a newline at the end. */ /* Flags passed to the name demangler. */ static int demangle_flags = DMGL_PARAMS | DMGL_ANSI; @@ -70,6 +70,7 @@ static struct option long_options[] = {"no-recursion-limit", no_argument, NULL, 'r'}, {"section", required_argument, NULL, 'j'}, {"target", required_argument, NULL, 'b'}, + {"add-newline", no_argument, NULL, 'n'}, {"help", no_argument, NULL, 'H'}, {"version", no_argument, NULL, 'V'}, {0, no_argument, 0, 0} @@ -102,6 +103,7 @@ usage (FILE *stream, int status) -C --demangle[=style] Demangle function names\n\ -R --recurse-limit Enable a limit on recursion whilst demangling. [Default]\n\ -r --no-recurse-limit Disable a limit on recursion whilst demangling\n\ + -n --add-newline Add a newline at the end of the output\n\ -h --help Display this information\n\ -v --version Display the program's version\n\ \n")); @@ -417,6 +419,8 @@ translate_addresses (bfd *abfd, asection *section) } } + if(add_newline) + printf("\n"); /* fflush() is essential for using this command as a server child process that reads addresses from a pipe and responds with line number information, processing one address at a @@ -505,7 +509,7 @@ main (int argc, char **argv) file_name = NULL; section_name = NULL; target = NULL; - while ((c = getopt_long (argc, argv, "ab:Ce:rRsfHhij:pVv", long_options, (int *) 0)) + while ((c = getopt_long (argc, argv, "ab:Ce:rRsfnHhij:pVv", long_options, (int *) 0)) != EOF) { switch (c) @@ -564,6 +568,9 @@ main (int argc, char **argv) case 'j': section_name = optarg; break; + case 'n': + add_newline = true; + break; default: usage (stderr, 1); break; diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi index c9d52d7c92f..0940708d77e 100644 --- a/binutils/doc/binutils.texi +++ b/binutils/doc/binutils.texi @@ -3976,6 +3976,7 @@ addr2line [@option{-a}|@option{--addresses}] [@option{-f}|@option{--functions}] [@option{-s}|@option{--basename}] [@option{-i}|@option{--inlines}] [@option{-p}|@option{--pretty-print}] + [@option{-n}|@option{--add-newline}] [@option{-j}|@option{--section=}@var{name}] [@option{-H}|@option{--help}] [@option{-V}|@option{--version}] [addr addr @dots{}] @@ -4102,6 +4103,10 @@ Make the output more human friendly: each location are printed on one line. If option @option{-i} is specified, lines for all enclosing scopes are prefixed with @samp{(inlined by)}. +@item -n +@itemx --add-newline +Add a newline at the end of the output. + @item -r @itemx -R @itemx --recurse-limit -- 2.38.1