From d6ac292e5fecde8fe92f79e83c69d80766f57976 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 12 Apr 2023 16:27:01 -0400 Subject: gdb: remove two uses of obstack Remove uses of obstack in the code generating the libraries XML for Windows and AIX. Use std::string instead. I'm not able to test this change, unfortunately. Change-Id: I28480913337e3fe8d6c31e551626931e6b1367ef Approved-By: Tom Tromey --- gdb/windows-nat.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'gdb/windows-nat.c') diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index b446afd..b98efe8 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -2908,30 +2908,25 @@ windows_xfer_shared_libraries (struct target_ops *ops, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len) { - auto_obstack obstack; - const char *buf; - LONGEST len_avail; - if (writebuf) return TARGET_XFER_E_IO; - obstack_grow_str (&obstack, "\n"); + std::string xml = "\n"; for (windows_solib &so : windows_process.solibs) windows_xfer_shared_library (so.name.c_str (), (CORE_ADDR) (uintptr_t) so.load_addr, &so.text_offset, - current_inferior ()->arch (), &obstack); - obstack_grow_str0 (&obstack, "\n"); + current_inferior ()->arch (), xml); + xml += "\n"; - buf = (const char *) obstack_finish (&obstack); - len_avail = strlen (buf); + ULONGEST len_avail = xml.size (); if (offset >= len_avail) - len= 0; + len = 0; else { if (len > len_avail - offset) len = len_avail - offset; - memcpy (readbuf, buf + offset, len); + memcpy (readbuf, xml.data () + offset, len); } *xfered_len = (ULONGEST) len; -- cgit v1.1