On 13-02-26 07:01 AM, Pedro Alves wrote: > Hi Aleksandar, > > Thanks for the patch. Thanks for looking at the patch. > > On 02/22/2013 06:38 PM, Aleksandar Ristovski wrote: >>> >>> Majority of the patch is refactoring to reuse code. > > I'm reading the patch, but one immediate question I have > is where did hex_encode/hex_decode and friends got refactored > from? It seems we end up with multiple functions to do the same > in both gdb and gdbserver, given the existence of bin2hex etc > in gdb and unhexify/hexify in gdbserver? apparently I was grepping *h files. I moved bin2hex and hex2bin to common-utils. New patch attached, along with documentation patch. Note there is a small change in linux-low.c in that new patch passes exactly note size instead of using PT_NOTE pheaders p_memsz. > >> The real change is >>> in gdbserver/linux-low.c. > --- Aleksandar ChangeLog followed by doc/ChangeLog DATE Aleksandar Ristovski * Makefile.in (HFILES_NO_SRCDIR): Add linux-maps.h and linux-maps.c. * 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. (fromhex): Moved from remote.c. (hex2bin): Ditto. (tohex): Ditto. (bin2hex): Ditto. * common/common-utils.h (strtoulst): Moved from utils.h. (tohex): New declaration. (fromhex): Ditto. (hex2bin): Ditto. (bin2hex): Ditto. * common/xml-utils.h (xml_hex_encode_text): Declare. * config/i386/linux.mk (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. * remote-utils.c (common-utils.h): Include. (fromhex): Moved to common-utils.c. (unhexify): Use hex2bin. (tohex): Moved to common-utils.c. (hexify): Use bin2hex. * 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. * remote.c (tohex): Remove forward declaration. (fromhex): Ditto. (hex2bin): Ditto. (bin2hex): Ditto. (fromhex): Move implementation to common-utils.c (hex2bin): Ditto. (tohex): Ditto. (bin2hex): Ditto. * tracepoint.c (hex2bin): Remove declaration. (bin2hex): 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. doc/ChangeLog: DATE Aleksandar Ristovski * gdb.texinfo (Library List Format for SVR4 Targets): New 'build-id' attribute, add it to the example and document it in DTD.