From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12950 invoked by alias); 3 Jun 2017 19:18:24 -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 12930 invoked by uid 89); 3 Jun 2017 19:18:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=irrespective, alto X-HELO: resqmta-po-05v.sys.comcast.net Received: from resqmta-po-05v.sys.comcast.net (HELO resqmta-po-05v.sys.comcast.net) (96.114.154.164) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 03 Jun 2017 19:18:22 +0000 Received: from resomta-po-19v.sys.comcast.net ([96.114.154.243]) by resqmta-po-05v.sys.comcast.net with SMTP id HEYxdYSdIrWIEHEZ6diF5o; Sat, 03 Jun 2017 19:18:24 +0000 Received: from vm-fedora21.eagercon.com ([IPv6:2601:647:4d04:5190:20c:29ff:fe70:d3be]) by resomta-po-19v.sys.comcast.net with SMTP id HEZ5dgmaAiVxkHEZ6dSyhi; Sat, 03 Jun 2017 19:18:24 +0000 Subject: Re: [PATCH] sim: microblaze: breakpoint inst check + a couple of questions To: Andrea Corallo , GDB Patches References: <295196608.1570236.1496487588855.ref@mail.yahoo.com> <295196608.1570236.1496487588855@mail.yahoo.com> From: Michael Eager Message-ID: <59330B7F.90802@eagerm.com> Date: Sat, 03 Jun 2017 19:18:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <295196608.1570236.1496487588855@mail.yahoo.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-CMAE-Envelope: MS4wfEghg5PkIUne1cY26+hXLXsV7Y5W0mfUeDGUE7N0cOj3YUE/a/kJPJ3wxhn3esp1zmwsuGwsrcFxuGzE2NGj9Yf1Dzkd7duelAZHEKzlESDFoyQXhPUq r7w0jpu/0BU16sySTBKHZNe50xZPUByhc4YXOw9/XB9JmRUCC9lepRGXDj4MdsAPHWFiWCrwJ8L3BXWYssOL3b0fcdgboccm1+U= X-IsSubscribed: yes X-SW-Source: 2017-06/txt/msg00078.txt.bz2 On 06/03/2017 03:59 AM, Andrea Corallo via gdb-patches wrote: > I have couple of questions related to microblaze debugging and its simula= tor: I can help with questions about MicroBlaze GDB, but can't say much about th= e simulator. I looked at=20 it briefly a long time, but most of my debugging was on a development board. I don't believe that there has been any development on the MB sim for many = years. The QEMU=20 simulator is much more up to date. > When gdb add a breakpoint writes to memory the following word 0xb9cc0060,= this is defined in gdb/microblaze-tdep.h:120 > > /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used. > Only used for native debugging. */ > #define MICROBLAZE_BREAKPOINT {0xb9, 0xcc, 0x00, 0x60} > > This brki instruction cause the cpu to jump to 0x60 > I guess this is because there is supposed to start a monitor program in s= ome configuration correct? > Because the simulator is not expecting any monitor program wouldn't be mo= re appropriate to use hardware breakpoints instead? There is a note in the MicroBlaze Processor Reference Guide about the use o= f "brk" and "brki"=20 instructions: As a special case, when C_USE_DEBUG is set, and =E2=80=9Cbrki rD, 0x18= =E2=80=9D is executed, a software breakpoint is signaled to the Xilinx Microprocesor Debugger (X= MD) tool, irrespective of the value of C_BASE_VECTORS. (XMD is the JTAG pod used to debug using the GDB remote protocol.) Sim should do the something similar to this when running under GDB. > The other question is: the simulator is checking against the presence of = a brk instruction but not brki making gdb not stopping on the breakpoint ju= st inserted. > Would make sense to check against both as in the following patch? > > sim/microblaze/ChangeLog: > 2017-06-01 Andrea Corallo > > * interp.c (sim_engine_run): check also for breakpoint instruction brki. > --- > sim/microblaze/interp.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sim/microblaze/interp.c b/sim/microblaze/interp.c > index 75fc98b..d094a69 100644 > --- a/sim/microblaze/interp.c > +++ b/sim/microblaze/interp.c > @@ -161,7 +161,7 @@ sim_engine_run (SIM_DESC sd, > oldpc =3D PC; > delay_slot_enable =3D 0; > branch_taken =3D 0; > - if (op =3D=3D microblaze_brk) > + if (op =3D=3D microblaze_brk || op =3D=3D brki) > sim_engine_halt (sd, NULL, NULL, NULL_CIA, sim_stopped, SIM_SIGTRAP); > else if (inst =3D=3D MICROBLAZE_HALT_INST) > { There is another use of microblaze_brk where a check is made whether a "brk= " instruction is being=20 inserted in a delay slot. I believe that this should also be updated to al= so check for a "brki"=20 instruction. --=20 Michael Eager eager@eagercon.com 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077