diff options
author | Tom Tromey <tromey@adacore.com> | 2020-06-15 06:28:09 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2020-06-15 06:28:10 -0600 |
commit | 669203174311c5be76744a879563c697cd479853 (patch) | |
tree | 77b21ddbec4501e2cf04dafd9987a347d66e8cc2 /gdb/windows-nat.c | |
parent | a5d871ddaf2aa8462922ed25b0c0dc7f02128cb9 (diff) | |
download | fsf-binutils-gdb-669203174311c5be76744a879563c697cd479853.zip fsf-binutils-gdb-669203174311c5be76744a879563c697cd479853.tar.gz fsf-binutils-gdb-669203174311c5be76744a879563c697cd479853.tar.bz2 |
Change target_read_string API
This simplifies the target_read_string API a bit.
Note that some code was using safe_strerror on the error codes
returned by target_read_string. It seems to me that this is incorrect
(if it was ever correct, it must have been quite a long time ago).
gdb/ChangeLog
2020-06-15 Tom Tromey <tromey@adacore.com>
* windows-nat.c (windows_nat::handle_output_debug_string):
Update.
(windows_nat::handle_ms_vc_exception): Update.
* target.h (target_read_string): Change API.
* target.c (target_read_string): Change API.
* solib-svr4.c (open_symbol_file_object, svr4_read_so_list):
Update.
* solib-frv.c (frv_current_sos): Update.
* solib-dsbt.c (dsbt_current_sos): Update.
* solib-darwin.c (darwin_current_sos): Update.
* linux-thread-db.c (inferior_has_bug): Update.
* expprint.c (print_subexp_standard): Update.
* ada-lang.c (ada_main_name, ada_tag_name_from_tsd)
(ada_exception_message_1): Update.
Diffstat (limited to 'gdb/windows-nat.c')
-rw-r--r-- | gdb/windows-nat.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 3452f6c..c3a4bdc 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -985,13 +985,13 @@ signal_event_command (const char *args, int from_tty) int windows_nat::handle_output_debug_string (struct target_waitstatus *ourstatus) { - gdb::unique_xmalloc_ptr<char> s; int retval = 0; - if (!target_read_string - ((CORE_ADDR) (uintptr_t) current_event.u.DebugString.lpDebugStringData, - &s, 1024, 0) - || !s || !*(s.get ())) + gdb::unique_xmalloc_ptr<char> s + = (target_read_string + ((CORE_ADDR) (uintptr_t) current_event.u.DebugString.lpDebugStringData, + 1024)); + if (s == nullptr || !*(s.get ())) /* nothing to do */; else if (!startswith (s.get (), _CYGWIN_SIGNAL_STRING)) { @@ -1216,10 +1216,8 @@ windows_nat::handle_ms_vc_exception (const EXCEPTION_RECORD *rec) if (named_thread != NULL) { int thread_name_len; - gdb::unique_xmalloc_ptr<char> thread_name; - - thread_name_len = target_read_string (thread_name_target, - &thread_name, 1025, NULL); + gdb::unique_xmalloc_ptr<char> thread_name + = target_read_string (thread_name_target, 1025, &thread_name_len); if (thread_name_len > 0) { thread_name.get ()[thread_name_len - 1] = '\0'; |