Replace remaining cleanups in fbsd-nat.c.
authorJohn Baldwin <jhb@FreeBSD.org>
Wed, 9 Aug 2017 22:24:46 +0000 (15:24 -0700)
committerJohn Baldwin <jhb@FreeBSD.org>
Wed, 9 Aug 2017 22:24:46 +0000 (15:24 -0700)
commite4a26669b914a1a1d519325b3bddf4bfe5078ea8
tree4b78a311a6cea41ddb59ea8820dd3d76b310674e
parent142311d325b962730f7d0247cc456f06e5c7b62b
Replace remaining cleanups in fbsd-nat.c.

- Use a custom deleter with std::unique_ptr to free() memory returned
  by kinfo_getvmmap().
- Use std::string with string_printf() to generate the pathname of the
  procfs 'map' file.
- Use gdb::byte_vector to manage the dynamic buffer for
  TARGET_OBJECT_AUXV and the dynamically allocated array of LWP IDs.

gdb/ChangeLog:

* fbsd-nat.c [HAVE_KINFO_GETVMMAP] (struct free_deleter): New.
(fbsd_find_memory_regions): Use free_deleter with std::unique_ptr.
[!HAVE_KINFO_GETVMMAP] (fbsd_find_memory_regions): Use std::string
for `mapfilename'.
(fbsd_xfer_partial): Use gdb::byte_vector.
(fbsd_add_threads): Likewise.
gdb/ChangeLog
gdb/fbsd-nat.c