Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(553)

Issue 5633007: This change contains changes that were made on a separate copy of this code,... (Closed)

Created:
10 years ago by mlinck
Modified:
9 years, 7 months ago
CC:
native-client-reviews_googlegroups.com
Visibility:
Public.

Description

This change contains changes that were made on a separate copy of this code, in the nativeclient_vsx project. The idea is to create a canonical version of this code so development can progress (finally). Also, there are a number of bug fixes: - Breakpoints can be set. - Continue no longer crashes the rsp. - Continue no longer wipes out breakpoints. With these changes gdb debugging a program succesfully via the rsp has been tested. Note that there is now some dead code that can be removed, and a lot of cleanup to the rsp code still remains to be done. I'm not doing this in this CL because I want to get some form of automated testing on this working functionality before any further code modifications. -mike Related issue: http://code.google.com/p/nativeclient/issues/detail?id=1245

Patch Set 1 #

Total comments: 46

Patch Set 2 : '' #

Total comments: 22

Patch Set 3 : '' #

Total comments: 18

Patch Set 4 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+428 lines, -293 lines) Patch
M src/trusted/gdb_rsp/host.h View 1 2 3 3 chunks +28 lines, -24 lines 0 comments Download
M src/trusted/gdb_rsp/host.cc View 1 2 3 1 chunk +3 lines, -2 lines 0 comments Download
M src/trusted/gdb_rsp/target.h View 1 2 3 5 chunks +67 lines, -24 lines 0 comments Download
M src/trusted/gdb_rsp/target.cc View 1 2 3 17 chunks +330 lines, -243 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
mlinck
I've uploaded the first RSP CL. The point is to get the last changes ilewis ...
10 years ago (2010-12-07 22:10:06 UTC) #1
mmortensen
I just had a few questions and nits...LGTM although I'm sure someone closer to the ...
10 years ago (2010-12-07 22:53:58 UTC) #2
noelallen_use_chromium
I'm not done with the review, but I wanted to give you early feedback so ...
10 years ago (2010-12-07 23:04:44 UTC) #3
mlinck
Hi, I took care of all the printfs and other concerns. I also broke out ...
10 years ago (2010-12-10 21:10:27 UTC) #4
noelallen_use_chromium
http://codereview.chromium.org/5633007/diff/1/src/trusted/gdb_rsp/target.h File src/trusted/gdb_rsp/target.h (right): http://codereview.chromium.org/5633007/diff/1/src/trusted/gdb_rsp/target.h#newcode187 src/trusted/gdb_rsp/target.h:187: uint32_t run_req_; // Requested thread for run operations. I ...
10 years ago (2010-12-13 19:28:10 UTC) #5
mlinck
I fixed all requested items except those that seem to be more appropriately referred to ...
10 years ago (2010-12-14 17:23:24 UTC) #6
noelallen_use_chromium
Okay, looking pretty good. We need to figure out what the correct thing WRT step ...
10 years ago (2010-12-14 20:18:41 UTC) #7
Cliff L. Biffle
Comments on target.{cc,h}. I'm rather confused about the use of some of these member variables ...
10 years ago (2010-12-14 21:46:07 UTC) #8
mlinck
10 years ago (2010-12-16 20:02:51 UTC) #9
I've made some more changes based on cliff's review.  This has also brought to
light at least one new problem.  A bug has been written.  Since this code is so
far from working, I've also decided we should really spend some time figuring
out how to remove it from the TCB as soon as this review is finished so that I
have "beachhead" version of the code.

http://codereview.chromium.org/5633007/diff/15001/src/trusted/gdb_rsp/target.cc
File src/trusted/gdb_rsp/target.cc (right):

http://codereview.chromium.org/5633007/diff/15001/src/trusted/gdb_rsp/target....
src/trusted/gdb_rsp/target.cc:617: return true;
On 2010/12/14 20:18:41, noelallen wrote:
> That seems incorrect.  This function should be turning on or off the STEP flag
> on the CPU.  If on, this thread will report a sig 5 every instruction. 
Turning
> HW step on and off does not affect breakpoints.
> 
> 
> On 2010/12/14 17:23:24, mlinck wrote:
> > On 2010/12/13 19:28:10, noelallen wrote:
> > > Where is SetStep(false)?  Make sure we turn off single step somewhere. 
> > Probably
> > > should always turn in off in the signal handler.
> > 
> > Well, there was a massive bug associated SetStep(false) because it caused
the
> > application to no longer stop at breakpoints.  Stepping needs to be
revisited
> > and implemented in a way that doesn't break breakpoint behavior.  There are
> > outstanding issues that will need to resolve step behavior.
> 

That is false.  I haven't looked closely at how step was implemented because it
is beyond the scope of this CL (seeing how there are two outstanding tickets to
address it separetely) but I know that the "resume" function used to result in a
call to setStep(false) and I verified by testing that that line was responsible
for the debug_stub ignoring breakpoints after resume and never breaking again. 
I had to remove the line in order to fix breakpoint behavior.  What I want here
as a baseline is code that I know does breakpoints, and tickets to fix all the
other stuff that never worked properly in an organized fashion.

Here's the version of the function that was clearing breakpoints.  Resume() line
268 was the problem.
http://code.google.com/p/nativeclient-vsx/source/browse/third_party/nacl_sub/...

http://codereview.chromium.org/5633007/diff/25001/src/trusted/gdb_rsp/target....
src/trusted/gdb_rsp/target.cc:44: run_req_(-1),
On 2010/12/14 21:46:08, Cliff L. Biffle wrote:
> You appear to be using two magic numbers, 0 and -1, here for thread IDs. 
What's
> the difference?

I have addressed this by creating a new constant, used here and in
"UpdateThreadId" below.  Said function is the result of quickly factoring two
almost identical functions because I got tired of making the same changes twice.

http://codereview.chromium.org/5633007/diff/25001/src/trusted/gdb_rsp/target....
src/trusted/gdb_rsp/target.cc:110: for (size_t cnt = parts.size(); cnt ; cnt--)
{
On 2010/12/14 21:46:08, Cliff L. Biffle wrote:
> Excess space before semicolon.

Done.

http://codereview.chromium.org/5633007/diff/25001/src/trusted/gdb_rsp/target....
src/trusted/gdb_rsp/target.cc:121: if ((cnt == 4) && (parts[3] == "read") &&
(parts.size() == 5)) {
On 2010/12/14 21:46:08, Cliff L. Biffle wrote:
> Doing this inside the loop is confusing.  It seems like you could do this
check
> at the top-level.  But it's possible that I'm confused.

I've clarified this code a little bit but the only effect was to make it more
obvious that it never worked, and that the body of the next if-statement makes
no sense.  I wrote an issue that requires this function to be spec'd, isolated,
and tested.

http://codereview.chromium.org/5633007/diff/25001/src/trusted/gdb_rsp/target....
src/trusted/gdb_rsp/target.cc:225: snprintf(tmp, sizeof(tmp), "QC%x",
sig_thread_);
On 2010/12/14 21:46:08, Cliff L. Biffle wrote:
> Looks like this will be, at largest, 11 bytes.

Done.

http://codereview.chromium.org/5633007/diff/25001/src/trusted/gdb_rsp/target....
src/trusted/gdb_rsp/target.cc:226: SetProperty("C", tmp);
On 2010/12/14 21:46:08, Cliff L. Biffle wrote:
> Consider using NACL_ARRAY_SIZE macro here -- it will defend you against the
> future possibility of tmp becoming a char* instead of a char[], which will
cause
> sizeof to behave rather differently.
Since we have a known max-length and don't want to use magic numbers I've
declared a constant and used that here instead.

http://codereview.chromium.org/5633007/diff/25001/src/trusted/gdb_rsp/target....
src/trusted/gdb_rsp/target.cc:226: SetProperty("C", tmp);
On 2010/12/14 21:46:08, Cliff L. Biffle wrote:
> Incidentally, isn't there a nice C++ way of doing this?

Implicit conversion between string and char * is being deprecated so if you
start with C-types you're probably best of sticking with them.  And I'm not sure
there's a "nice" way to do anything to char[] or char* since std::copy still
requires you to first allocate memory.  I could use a stringstream to do the
formatting but it certainly wouldn't be less code, it certainly wouldn't be
faster and, since we know the bounds of this buffer, not really safer.

http://codereview.chromium.org/5633007/diff/25001/src/trusted/gdb_rsp/target....
src/trusted/gdb_rsp/target.cc:255: sig_done_->Signal();
On 2010/12/14 21:46:08, Cliff L. Biffle wrote:
> I see cur_signal_ being set to 0, -1, and actual values.  Below, code says it
is
> "simulating a signal" by setting it to 0, and then resets it to -1.  Can you
> explain more about the lifecycle of this variable

This has never worked.  I have an issue to investigate it and fix it properly,
along with providing tests.  I think we were blocking on a change in actual
signal or platform code that kept the actual break from the debugger from ever
getting here.

http://codereview.chromium.org/5633007/diff/25001/src/trusted/gdb_rsp/target.h
File src/trusted/gdb_rsp/target.h (right):

http://codereview.chromium.org/5633007/diff/25001/src/trusted/gdb_rsp/target....
src/trusted/gdb_rsp/target.h:69: // MatchQuery does a longest prefix match
against the locally cased
On 2010/12/14 21:46:08, Cliff L. Biffle wrote:
> cased?  cached?

Done.

http://codereview.chromium.org/5633007/diff/25001/src/trusted/gdb_rsp/target....
src/trusted/gdb_rsp/target.h:175: int32_t run_req_;   // Requested thread for
run operations.
On 2010/12/14 21:46:08, Cliff L. Biffle wrote:
> These names are not great.  They should probably contain the word 'thread.'

Done.

Powered by Google App Engine
This is Rietveld 408576698