diff options
author | Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> | 2018-06-13 11:05:51 +0200 |
---|---|---|
committer | Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> | 2018-06-13 11:05:51 +0200 |
commit | 62c808aef64d77d5585f54c792ebe3f388a960a9 (patch) | |
tree | c6e4351c1823b12e3af789bf3ebf8419f0063d5f /gdb/procfs.c | |
parent | c75c496d6db058628694329fed8a40fffb17fb54 (diff) | |
download | gdb-62c808aef64d77d5585f54c792ebe3f388a960a9.zip gdb-62c808aef64d77d5585f54c792ebe3f388a960a9.tar.gz gdb-62c808aef64d77d5585f54c792ebe3f388a960a9.tar.bz2 |
Fix procfs.c compilation
procfs.c currently doesn't compile on Solaris:
/vol/src/gnu/gdb/gdb/local/gdb/procfs.c: In function `void _initialize_procfs()':
/vol/src/gnu/gdb/gdb/local/gdb/procfs.c:3734:15: error: invalid initialization of reference of type `const target_info&' from expression of type `procfs_target*'
add_target (&the_procfs_target);
^~~~~~~~~~~~~~~~~~
In file included from /vol/src/gnu/gdb/gdb/local/gdb/inferior.h:40,
from /vol/src/gnu/gdb/gdb/local/gdb/procfs.c:24:
/vol/src/gnu/gdb/gdb/local/gdb/target.h:2305:13: note: in passing argument 1 of `void add_target(const target_info&, void (*)(const char*, int), void (*)(cmd_list_element*, completion_tracker&, const char*, const char*))'
extern void add_target (const target_info &info,
^~~~~~~~~~
/vol/src/gnu/gdb/gdb/local/gdb/procfs.c: In member function `virtual char* procfs_target::make_corefile_notes(bfd*, int*)':
/vol/src/gnu/gdb/gdb/local/gdb/procfs.c:3898:16: error: too many arguments to function `gdb::optional<std::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > > > target_read_alloc(target_ops*, target_object, const char*)'
NULL, &auxv);
^
In file included from /vol/src/gnu/gdb/gdb/local/gdb/inferior.h:40,
from /vol/src/gnu/gdb/gdb/local/gdb/procfs.c:24:
/vol/src/gnu/gdb/gdb/local/gdb/target.h:341:40: note: declared here
extern gdb::optional<gdb::byte_vector> target_read_alloc
^~~~~~~~~~~~~~~~~
/vol/src/gnu/gdb/gdb/local/gdb/procfs.c:3898:16: error: cannot convert `gdb::optional<std::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > > >' to `int' in assignment
NULL, &auxv);
^
Fixed as follows. Built and ran make check on 64-bit Solaris 11.5/x86
(amd64-pc-solaris2.11) only.
* procfs.c (_initialize_procfs): Use add_inf_child_target.
(procfs_target::make_corefile_notes): Adjust to new
target_read_alloc return type.
Diffstat (limited to 'gdb/procfs.c')
-rw-r--r-- | gdb/procfs.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/gdb/procfs.c b/gdb/procfs.c index 082f5d4..8b09eca 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -3731,7 +3731,7 @@ _initialize_procfs (void) add_com ("proc-untrace-exit", no_class, proc_untrace_sysexit_cmd, _("Cancel a trace of exits from the syscall.")); - add_target (&the_procfs_target); + add_inf_child_target (&the_procfs_target); } /* =================== END, GDB "MODULE" =================== */ @@ -3851,8 +3851,6 @@ procfs_target::make_corefile_notes (bfd *obfd, int *note_size) char *note_data = NULL; char *inf_args; struct procfs_corefile_thread_data thread_args; - gdb_byte *auxv; - int auxv_len; enum gdb_signal stop_signal; if (get_exec_file (0)) @@ -3894,14 +3892,12 @@ procfs_target::make_corefile_notes (bfd *obfd, int *note_size) &thread_args); note_data = thread_args.note_data; - auxv_len = target_read_alloc (current_top_target (), TARGET_OBJECT_AUXV, - NULL, &auxv); - if (auxv_len > 0) - { - note_data = elfcore_write_note (obfd, note_data, note_size, - "CORE", NT_AUXV, auxv, auxv_len); - xfree (auxv); - } + gdb::optional<gdb::byte_vector> auxv = + target_read_alloc (current_top_target (), TARGET_OBJECT_AUXV, NULL); + if (auxv && !auxv->empty ()) + note_data = elfcore_write_note (obfd, note_data, note_size, + "CORE", NT_AUXV, auxv->data (), + auxv->size ()); return note_data; } |