public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Maxim Dementyev <mdementyev@fluendo.com>
To: Nick Clifton <nickc@redhat.com>
Cc: binutils@sourceware.org
Subject: Re: readelf --string-dump analog for objdump
Date: Mon, 22 Jan 2024 19:03:43 +0100	[thread overview]
Message-ID: <CAGp1TcEdP-J6-92PJZ5JiupQpYVj94-evRTZdSNovMkBa920hw@mail.gmail.com> (raw)
In-Reply-To: <154bbbef-3957-402d-8adb-27f60fc86ca7@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1493 bytes --]

On Mon, Jan 22, 2024 at 6:42 PM Nick Clifton <nickc@redhat.com> wrote:

> > Or is there a solution without parsing the hexdump format and
> > restoring these printable strings?
>
> I take it that you need to restrict the output to strings found in
> just one section ?  (Otherwise you could use the "strings" tool).
>
> Actually talking of the strings program it might be a lot easier
> to augment this tool to restrict its output to a specified section.
> It already has a function called strings_a_section() which decides
> if a given section should be scanned.  It would not take much to
> enhance this function to test for a named section...
>

Thanks for your suggestions, Nick!

In fact, as Jan already mentioned, I can get the contents
of the named section with the help of
objcopy --dump-section secname=secoutfile ...

And I need redirect the output to null (I don't need it),
because I cannot get raw output for this section
by using --output-target, see my reply
https://sourceware.org/pipermail/binutils/2024-January/132041.html

This solutions needs an intermediate file in the comparison
with non-platform-independent solution, but more simple:
readelf -p secname | grep sometext

And I don't need the strings utility, because
I know the content of this section is a ASCII text with spaces
that was added with the command:
objcopy --add-section secname=secfile --set-section-flags
secname=noload,readonly ...

Regards,
Max


>

-- 


      reply	other threads:[~2024-01-22 18:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-22 10:43 Maxim Dementyev
2024-01-22 10:58 ` Jan Beulich
2024-01-22 12:11   ` Maxim Dementyev
2024-01-22 12:19     ` Jan Beulich
2024-01-22 17:19       ` Maxim Dementyev
2024-01-23  7:41         ` Jan Beulich
2024-01-22 17:42 ` Nick Clifton
2024-01-22 18:03   ` Maxim Dementyev [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGp1TcEdP-J6-92PJZ5JiupQpYVj94-evRTZdSNovMkBa920hw@mail.gmail.com \
    --to=mdementyev@fluendo.com \
    --cc=binutils@sourceware.org \
    --cc=nickc@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).