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

Side by Side Diff: src/trusted/gdb_rsp/target_test.cc

Issue 10365028: Debug stub: associate NaClAppThread with IThread (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2010 The Native Client Authors. All rights reserved. 2 * Copyright 2010 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can 3 * Use of this source code is governed by a BSD-style license that can
4 * be found in the LICENSE file. 4 * be found in the LICENSE file.
5 */ 5 */
6 6
7 #include <assert.h> 7 #include <assert.h>
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 17 matching lines...) Expand all
28 SessionMock *ses = gdb_rsp::GetGoldenSessionMock(true, false); 28 SessionMock *ses = gdb_rsp::GetGoldenSessionMock(true, false);
29 const gdb_rsp::Abi* abi = gdb_rsp::Abi::Get(); 29 const gdb_rsp::Abi* abi = gdb_rsp::Abi::Get();
30 30
31 Target *target = new Target(NULL); 31 Target *target = new Target(NULL);
32 if (!target->Init()) { 32 if (!target->Init()) {
33 printf("Failed to INIT target.\n"); 33 printf("Failed to INIT target.\n");
34 return 1; 34 return 1;
35 } 35 }
36 36
37 // Create a pseudo thread with registers set to their index 37 // Create a pseudo thread with registers set to their index
38 port::IThread *thread = port::IThread::Acquire(0x1234, true); 38 port::IThread *thread = port::IThread::Create(0x1234, NULL);
39 for (uint32_t a = 0; a < abi->GetRegisterCount(); a++) { 39 for (uint32_t a = 0; a < abi->GetRegisterCount(); a++) {
40 const Abi::RegDef* def = abi->GetRegisterDef(a); 40 const Abi::RegDef* def = abi->GetRegisterDef(a);
41 uint64_t val = static_cast<uint64_t>(a); 41 uint64_t val = static_cast<uint64_t>(a);
42 thread->SetRegister(a, &val, def->bytes_); 42 thread->SetRegister(a, &val, def->bytes_);
43 } 43 }
44 target->TrackThread(thread); 44 target->TrackThread(thread);
45 45
46 // Pretend we just got a signal on that thread 46 // Pretend we just got a signal on that thread
47 target->Signal(thread->GetId(), 5, false); 47 target->Signal(thread->GetId(), 5, false);
48 48
49 // Run the session to completion. 49 // Run the session to completion.
50 target->Run(ses); 50 target->Run(ses);
51 51
52 if (ses->PeekAction() != SessionMock::DISCONNECT) { 52 if (ses->PeekAction() != SessionMock::DISCONNECT) {
53 printf("We did not consume all the actions.\n"); 53 printf("We did not consume all the actions.\n");
54 errs++; 54 errs++;
55 } 55 }
56 56
57 delete target; 57 delete target;
58 delete ses; 58 delete ses;
59 return errs; 59 return errs;
60 } 60 }
61 61
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698