From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32426 invoked by alias); 22 Apr 2014 14:39:07 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 32415 invoked by uid 89); 22 Apr 2014 14:39:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 22 Apr 2014 14:39:05 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s3MEd3xB019125 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Apr 2014 10:39:03 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s3MEd1kq029118; Tue, 22 Apr 2014 10:39:02 -0400 Message-ID: <53567F04.7030304@redhat.com> Date: Tue, 22 Apr 2014 14:39:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: "Metzger, Markus T" CC: "gdb-patches@sourceware.org" Subject: Re: [PATCH] btrace, vdso: add vdso target sections References: <1396601586-24380-1-git-send-email-markus.t.metzger@intel.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-04/txt/msg00431.txt.bz2 Not yet, sorry, but I will soon. I'm busy fixing a few regressions exposed by an earlier run control series. I think I have good fixes already, and should hopefully be posting them today or tomorrow... -- Pedro Alves On 04/22/2014 03:31 PM, Metzger, Markus T wrote: > Hello Pedro, > > Did you find some time to review this? This is related to the BFD changes you > and Alan Modra were discussing. > > It makes GDB use the BFD sections that Alan's patch added to fix an issue with > disassembling vdso code in record btrace. > > Thanks, > Markus. > >> -----Original Message----- >> From: Metzger, Markus T >> Sent: Friday, April 04, 2014 10:53 AM >> To: palves@redhat.com >> Cc: gdb-patches@sourceware.org >> Subject: [PATCH] btrace, vdso: add vdso target sections >> >> When loading symbols for the vdso, also add its sections to target_sections. >> >> This fixes an issue with record btrace where vdso instructions could not be >> disassembled during replay. >> >> 2014-04-04 Markus Metzger >> >> * symfile-mem.c (symbol_file_add_from_memory): Add >> add_sections >> parameter. Add BFD sections. Adjust all callers. >> (struct symbol_file_add_from_memory_args): Add add_sections >> field. >> >> testsuite/ >> * gdb.btrace/vdso.c: New. >> * gdb.btrace/vdso.exp: New. >> >> >> --- >> gdb/symfile-mem.c | 33 ++++++++++++++++++++++++---- >> gdb/testsuite/gdb.btrace/vdso.c | 30 +++++++++++++++++++++++++ >> gdb/testsuite/gdb.btrace/vdso.exp | 46 >> +++++++++++++++++++++++++++++++++++++++ >> 3 files changed, 105 insertions(+), 4 deletions(-) >> create mode 100644 gdb/testsuite/gdb.btrace/vdso.c >> create mode 100644 gdb/testsuite/gdb.btrace/vdso.exp >> >> diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c >> index 3f09c4d..6f67cd8 100644 >> --- a/gdb/symfile-mem.c >> +++ b/gdb/symfile-mem.c >> @@ -80,10 +80,12 @@ target_read_memory_bfd (bfd_vma memaddr, >> bfd_byte *myaddr, bfd_size_type len) >> non-zero, is the known size of the object. TEMPL is a bfd >> representing the target's format. NAME is the name to use for this >> symbol file in messages; it can be NULL or a malloc-allocated string >> - which will be attached to the BFD. */ >> + which will be attached to the BFD. If ADD_SECTIONS is non-zero, >> + add the sections of the loaded BFD. */ >> static struct objfile * >> symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr, >> - size_t size, char *name, int from_tty) >> + size_t size, char *name, int add_sections, >> + int from_tty) >> { >> struct objfile *objf; >> struct bfd *nbfd; >> @@ -131,6 +133,27 @@ symbol_file_add_from_memory (struct bfd *templ, >> CORE_ADDR addr, >> from_tty ? SYMFILE_VERBOSE : 0, >> sai, OBJF_SHARED, NULL); >> >> + if (add_sections) >> + { >> + struct target_section *sections, *sections_end, *tsec; >> + >> + sections = NULL; >> + sections_end = NULL; >> + make_cleanup (xfree, sections); >> + >> + if (build_section_table (nbfd, §ions, §ions_end) == 0) >> + { >> + /* Adjust the target section addresses by the load address. */ >> + for (tsec = sections; tsec != sections_end; ++tsec) >> + { >> + tsec->addr += loadbase; >> + tsec->endaddr += loadbase; >> + } >> + >> + add_target_sections (&nbfd, sections, sections_end); >> + } >> + } >> + >> /* This might change our ideas about frames already looked at. */ >> reinit_frame_cache (); >> >> @@ -159,7 +182,7 @@ add_symbol_file_from_memory_command (char >> *args, int from_tty) >> error (_("Must use symbol-file or exec-file " >> "before add-symbol-file-from-memory.")); >> >> - symbol_file_add_from_memory (templ, addr, 0, NULL, from_tty); >> + symbol_file_add_from_memory (templ, addr, 0, NULL, 0, from_tty); >> } >> >> /* Arguments for symbol_file_add_from_memory_wrapper. */ >> @@ -171,6 +194,7 @@ struct symbol_file_add_from_memory_args >> size_t size; >> char *name; >> int from_tty; >> + int add_sections; >> }; >> >> /* Wrapper function for symbol_file_add_from_memory, for >> @@ -182,7 +206,7 @@ symbol_file_add_from_memory_wrapper (struct >> ui_out *uiout, void *data) >> struct symbol_file_add_from_memory_args *args = data; >> >> symbol_file_add_from_memory (args->bfd, args->sysinfo_ehdr, args- >>> size, >> - args->name, args->from_tty); >> + args->name, args->add_sections, args- >>> from_tty); >> return 0; >> } >> >> @@ -247,6 +271,7 @@ add_vsyscall_page (struct target_ops *target, int >> from_tty) >> vsyscall DSO was not triggered by the user, even if the user >> typed "run" at the TTY. */ >> args.from_tty = 0; >> + args.add_sections = 1; >> catch_exceptions (current_uiout, >> symbol_file_add_from_memory_wrapper, >> &args, RETURN_MASK_ALL); >> } >> diff --git a/gdb/testsuite/gdb.btrace/vdso.c >> b/gdb/testsuite/gdb.btrace/vdso.c >> new file mode 100644 >> index 0000000..3e73071 >> --- /dev/null >> +++ b/gdb/testsuite/gdb.btrace/vdso.c >> @@ -0,0 +1,30 @@ >> +/* This testcase is part of GDB, the GNU debugger. >> + >> + Copyright 2014 Free Software Foundation, Inc. >> + >> + Contributed by Intel Corp. >> + >> + This program is free software; you can redistribute it and/or modify >> + it under the terms of the GNU General Public License as published by >> + the Free Software Foundation; either version 3 of the License, or >> + (at your option) any later version. >> + >> + This program is distributed in the hope that it will be useful, >> + but WITHOUT ANY WARRANTY; without even the implied warranty of >> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >> + GNU General Public License for more details. >> + >> + You should have received a copy of the GNU General Public License >> + along with this program. If not, see . */ >> + >> +#include >> + >> +int >> +main (void) >> +{ >> + struct timeval tv; >> + >> + gettimeofday (&tv, 0); >> + >> + return 0; >> +} >> diff --git a/gdb/testsuite/gdb.btrace/vdso.exp >> b/gdb/testsuite/gdb.btrace/vdso.exp >> new file mode 100644 >> index 0000000..2f415ff >> --- /dev/null >> +++ b/gdb/testsuite/gdb.btrace/vdso.exp >> @@ -0,0 +1,46 @@ >> +# This testcase is part of GDB, the GNU debugger. >> +# >> +# Copyright 2014 Free Software Foundation, Inc. >> +# >> +# Contributed by Intel Corp. >> +# >> +# This program is free software; you can redistribute it and/or modify >> +# it under the terms of the GNU General Public License as published by >> +# the Free Software Foundation; either version 3 of the License, or >> +# (at your option) any later version. >> +# >> +# This program is distributed in the hope that it will be useful, >> +# but WITHOUT ANY WARRANTY; without even the implied warranty of >> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >> +# GNU General Public License for more details. >> +# >> +# You should have received a copy of the GNU General Public License >> +# along with this program. If not, see . >> +# >> +# >> +# Test that we can access the vdso memory during replay for stepping. >> + >> +# check for btrace support >> +if { [skip_btrace_tests] } { return -1 } >> + >> +# start inferior >> +standard_testfile >> +if [prepare_for_testing $testfile.exp $testfile $srcfile] { >> + return -1 >> +} >> +if ![runto_main] { >> + return -1 >> +} >> + >> +# trace the test code >> +gdb_test_no_output "record btrace" >> +gdb_test "next" >> + >> +# start replaying >> +gdb_test "reverse-stepi" >> + >> +# disassemble the code around the current PC >> +gdb_test "disassemble \$pc, +10" [join [list \ >> + ".*" \ >> + "End of assembler dump\." \ >> + ] "\r\n"] >> -- >> 1.8.3.1 > > Intel GmbH > Dornacher Strasse 1 > 85622 Feldkirchen/Muenchen, Deutschland > Sitz der Gesellschaft: Feldkirchen bei Muenchen > Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk > Registergericht: Muenchen HRB 47456 > Ust.-IdNr./VAT Registration No.: DE129385895 > Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052 >