On 13-02-22 10:06 AM, Aleksandar Ristovski wrote: > Hello, > > This is related to: > http://sourceware.org/ml/gdb-patches/2013-01/msg00748.html. Changes from > this patch are needed to finish off the work started in that thread. > > As per Jan's request, this patch adds 'build-id' to the gdbserver > response. The value is hex encoded string representing > .note.gnu.build-id section of the corresponding shared library. > > Majority of the patch is refactoring to reuse code. The real change is > in gdbserver/linux-low.c. Something I missed in the original post: the intent was to make build-id optional; however, I missed to augument library-list-svr4.dtd, which is rectified in this patch. Also, added doc changes (separate patch also attached). The code difference between the original and this patch is in linux-low.c, build-id is now emitted only if build-id could be retrieved from the binary. --- Aleksandar New ChangeLog (added entry for library-list-svr4.dtd) followed by ChangeLog for doc: * Makefile.in (HFILES_NO_SRCDIR): Add linux-maps.h and linux-maps.c. * linux-tdep.c (linux-maps.h): Include. (read_mapping): Moved to linux-maps.c. (linux_find_memory_region_ftype): Moved to linux-maps.h. (linux_find_memory_regions_full): Moved to linux-maps.c. (linux_find_memory_regions): Check for fake_pid_p to match functionality of original linux_find_memory_regions_full. (linux_make_mappings_corefile_notes): Ditto. * utils.c (HIGH_BYTE_POSN): Moved to common-utils.c. (is_digit_in_base): Ditto. (digit_to_int): Ditto. (strtoulst): Ditto. * utils.h (strtoulst): Moved to common-utils.h. * common/common-utils.c (TARGET_CHAR_BIT): Define if not defined. (HOST_CHAR_BIT): Ditto. (ctype.h): Include. (string.h): Include. (assert.h): Include. (HIGH_BYTE_POSN): Moved from utils.c. (is_digit_in_base): Ditto. (digit_to_int): Ditto. (strtoulst): Ditto. (hchar): Hex charset for hex_encode. (hex_encode): New function. (decode_hex_ch): Ditto. (hex_decode): Ditto. * common/common-utils.h (strtoulst): Moved from utils.h. (hex_encode): New declaration. (hex_decode): Ditto. * common/linux-maps.c: New file. * common/linux-maps.h: New file. * common/xml-utils.h (xml_hex_encode_text): Declare. * config/i386/linux.mh (NATDEPFILES): Add linux-maps.o. * config/i386/linux64.mh (NATDEPFILES): Add linux-maps.o. * features/library-list-svr4.dtd (build-id): New attribute. * gdbserver/Makefile.in (linux-maps.o): New. * gdbserver/configure.srv (srv_tgtobj): Add linux-maps.o. * gdbserver/linux-low.c (linux-maps.h): Include. (find_memory_region_callback_data): New structure definition. (find_memory_region_callback): New forward declaration. (find_memory_region_callback): New function. (get_hex_build_id): New function. (linux_qxfer_libraries_svr4): Add hex encoded build-id to the reply. Doc ChangeLog: * gdb.texinfo (Library List Format for SVR4 Targets): New 'build-id' attribute, add it to the example and document it in DTD.