public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: Re: [PATCH 1/2] gdbsupport, gdb: add read_text_file_to_string, use it in linux_common_core_of_thread
Date: Tue, 08 Nov 2022 10:13:17 -0700	[thread overview]
Message-ID: <87edud5pzm.fsf@tromey.com> (raw)
In-Reply-To: <20221104155137.1463129-1-simon.marchi@efficios.com> (Simon Marchi via Gdb-patches's message of "Fri, 4 Nov 2022 11:51:36 -0400")

>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:

Simon> I would like to add more code to nat/linux-osdata.c that reads an entire
Simon> file from /proc or /sys and processes it as a string afterwards.  I
Simon> would like to avoid duplicating the somewhat error-prone code that reads
Simon> an entire file to a buffer.  I think we should have a utility function
Simon> that does that.

Makes sense.  source_cache::get_plain_source_lines could use this btw,
though it would need some change for error reporting.

Simon> +
Simon> +gdb::optional<std::string>
Simon> +read_text_file_to_string (const char *path)

Should have a comment.

 
Simon> +extern gdb::optional<std::string> read_text_file_to_string (const char *path);

Here too.


Tom

  parent reply	other threads:[~2022-11-08 17:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-04 15:51 Simon Marchi
2022-11-04 15:51 ` [PATCH 2/2] gdb/linux-nat: get core count using /sys/devices/system/cpu/possible Simon Marchi
2022-11-08 17:17   ` Tom Tromey
2022-11-08 17:13 ` Tom Tromey [this message]
2022-11-08 20:36   ` [PATCH 1/2] gdbsupport, gdb: add read_text_file_to_string, use it in linux_common_core_of_thread Simon Marchi
2022-11-08 21:48     ` Tom Tromey
2022-11-08 21:52       ` Simon Marchi

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=87edud5pzm.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.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).