binutils-gdb/gdbsupport
Simon Marchi 7a283d9cf5 gdbsupport, gdb: add read_text_file_to_string, use it in linux_common_core_of_thread
I would like to add more code to nat/linux-osdata.c that reads an entire
file from /proc or /sys and processes it as a string afterwards.  I
would like to avoid duplicating the somewhat error-prone code that reads
an entire file to a buffer.  I think we should have a utility function
that does that.

Add read_file_to_string to gdbsupport/filestuff.{c,h}, and make
linux_common_core_of_thread use it.  I want to make the new function
return an std::string, and because strtok doesn't play well with
std::string (it requires a `char *`, std::string::c_str returns a `const
char *`), change linux_common_core_of_thread to use std::string methods
instead.

Approved-By: Tom Tromey <tom@tromey.com>
Change-Id: I1793fda72a82969c28b944a84acb953f74c9230a
2022-11-08 16:50:52 -05:00
..
.dir-locals.el
.gitattributes
acinclude.m4
aclocal.m4
agent.cc
agent.h
alt-stack.h
array-view.h
ax.def
block-signals.h
break-common.h
btrace-common.cc internal_error: remove need to pass __FILE__/__LINE__ 2022-10-19 15:32:36 +01:00
btrace-common.h
buffer.cc
buffer.h
buildargv.h
byte-vector.h
ChangeLog-2020-2021
check-defines.el
cleanups.cc
cleanups.h
common-debug.cc
common-debug.h
common-defs.h [gdb] Add debug_{exp,val} 2022-08-05 08:09:57 +02:00
common-exceptions.cc internal_error: remove need to pass __FILE__/__LINE__ 2022-10-19 15:32:36 +01:00
common-exceptions.h
common-gdbthread.h
common-inferior.cc
common-inferior.h
common-regcache.cc
common-regcache.h
common-types.h
common-utils.cc internal_error: remove need to pass __FILE__/__LINE__ 2022-10-19 15:32:36 +01:00
common-utils.h
common.m4 gdb, gdbsupport: configure: factor out yes/no/auto value checking 2022-08-26 10:29:51 -04:00
compiler-type.m4
config.in
configure gdbsupport: re-generate configure 2022-10-09 21:27:37 -04:00
configure.ac gdbsupport: Fix config.status dependency 2022-09-08 11:03:12 +00:00
create-version.sh
def-vector.h
default-init-alloc.h
eintr.h
enum-flags.h
environ.cc
environ.h
errors.cc internal_error: remove need to pass __FILE__/__LINE__ 2022-10-19 15:32:36 +01:00
errors.h internal_error: remove need to pass __FILE__/__LINE__ 2022-10-19 15:32:36 +01:00
event-loop.cc internal_error: remove need to pass __FILE__/__LINE__ 2022-10-19 15:32:36 +01:00
event-loop.h gdbsupport/event-loop: add a timeout parameter to gdb_do_one_event 2022-08-18 11:56:38 +02:00
event-pipe.cc
event-pipe.h
fileio.cc gdbsupport: move fileio_errno_to_host to fileio.{h,cc} and rename 2022-09-21 14:11:03 -04:00
fileio.h gdbsupport: move fileio_errno_to_host to fileio.{h,cc} and rename 2022-09-21 14:11:03 -04:00
filestuff.cc gdbsupport, gdb: add read_text_file_to_string, use it in linux_common_core_of_thread 2022-11-08 16:50:52 -05:00
filestuff.h gdbsupport, gdb: add read_text_file_to_string, use it in linux_common_core_of_thread 2022-11-08 16:50:52 -05:00
filtered-iterator.h
format.cc
format.h
forward-scope-exit.h
function-view.h gdbsupport: add wrapper around result_of and invoke_result 2022-08-30 14:43:26 -04:00
gdb_assert.h internal_error: remove need to pass __FILE__/__LINE__ 2022-10-19 15:32:36 +01:00
gdb_binary_search.h
gdb_file.h
gdb_locale.h
gdb_obstack.cc
gdb_obstack.h
gdb_optional.h gdbsupport: fix gdb::optional compilation with C++11 && _GLIBCXX_DEBUG 2022-08-26 11:47:23 -04:00
gdb_proc_service.h
gdb_ref_ptr.h
gdb_regex.cc
gdb_regex.h
gdb_select.h
gdb_setjmp.h
gdb_signals.h
gdb_splay_tree.h
gdb_string_view.h
gdb_string_view.tcc
gdb_sys_time.h
gdb_tilde_expand.cc
gdb_tilde_expand.h
gdb_unique_ptr.h
gdb_unlinker.h
gdb_vecs.cc
gdb_vecs.h
gdb_wait.cc
gdb_wait.h
gdb-checked-static-cast.h gdbsupport: add checked_static_cast 2022-07-21 15:19:43 +01:00
gdb-dlfcn.cc
gdb-dlfcn.h
gdb-hashtab.cc
gdb-hashtab.h
gdb-safe-ctype.h
gdb-sigmask.h
gdb-xfree.h
hash_enum.h
host-defs.h
intrusive_list.h
invoke-result.h gdbsupport: add wrapper around result_of and invoke_result 2022-08-30 14:43:26 -04:00
iterator-range.h
job-control.cc
job-control.h
Makefile.am
Makefile.in gdbsupport: Fix config.status dependency 2022-09-08 11:03:12 +00:00
netstuff.cc
netstuff.h
new-op.cc
next-iterator.h
observable.h
offset-type.h
packed.h struct packed: Add fallback byte array implementation 2022-07-25 16:04:05 +01:00
parallel-for.h gdbsupport: add wrapper around result_of and invoke_result 2022-08-30 14:43:26 -04:00
pathstuff.cc gdbsupport: change path_join parameter to array_view<const char *> 2022-09-21 11:36:01 -04:00
pathstuff.h gdbsupport: change path_join parameter to array_view<const char *> 2022-09-21 11:36:01 -04:00
poison.h
preprocessor.h
print-utils.cc internal_error: remove need to pass __FILE__/__LINE__ 2022-10-19 15:32:36 +01:00
print-utils.h
ptid.cc
ptid.h
ptrace.m4
range-chain.h
README
refcounted-object.h
reference-to-pointer-iterator.h
rsp-low.cc
rsp-low.h
run-time-clock.cc
run-time-clock.h
safe-iterator.h
safe-strerror.cc
scope-exit.h
scoped_fd.h
scoped_ignore_signal.h
scoped_ignore_sigttou.h
scoped_mmap.cc
scoped_mmap.h
scoped_restore.h
search.cc
search.h
selftest.cc
selftest.h
selftest.m4
signals-state-save-restore.cc
signals-state-save-restore.h
signals.cc
symbol.h
tdesc.cc
tdesc.h
thread-pool.cc
thread-pool.h
traits.h
underlying.h
valid-expr.h
version.h
warning.m4
x86-xstate.h
xml-utils.cc
xml-utils.h

This is a helper library that is used by gdb and gdbserver.

To send patches, follow the gdb patch submission instructions in
../gdb/CONTRIBUTE.  For maintainers, see ../gdb/MAINTAINERS.