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

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

Issue 6525058: Reverting: Several changes to fix debug_stub:... (issue6489005)... (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 9 years, 10 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
« no previous file with comments | « src/trusted/gdb_rsp/target.h ('k') | src/trusted/service_runtime/nacl_all_modules.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string.h> 7 #include <string.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <stdio.h> 9 #include <stdio.h>
10 10
(...skipping 24 matching lines...) Expand all
35 Target::Target(const Abi* abi) 35 Target::Target(const Abi* abi)
36 : abi_(abi), 36 : abi_(abi),
37 mutex_(NULL), 37 mutex_(NULL),
38 sig_start_(NULL), 38 sig_start_(NULL),
39 sig_done_(NULL), 39 sig_done_(NULL),
40 send_done_(false), 40 send_done_(false),
41 ctx_(NULL), 41 ctx_(NULL),
42 cur_signal_(-1), 42 cur_signal_(-1),
43 sig_thread_(0), 43 sig_thread_(0),
44 run_thread_(-1), 44 run_thread_(-1),
45 reg_thread_(-1), 45 reg_thread_(-1) {
46 mem_base_(0) {
47 if (NULL == abi_) abi_ = Abi::Get(); 46 if (NULL == abi_) abi_ = Abi::Get();
48 } 47 }
49 48
50 Target::~Target() { 49 Target::~Target() {
51 Destroy(); 50 Destroy();
52 } 51 }
53 52
54 bool Target::Init() { 53 bool Target::Init() {
55 string targ_xml = "l<target><architecture>"; 54 string targ_xml = "l<target><architecture>";
56 55
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 114
116 bool Target::RemoveTemporaryBreakpoints() { 115 bool Target::RemoveTemporaryBreakpoints() {
117 const Abi::BPDef *bp = abi_->GetBreakpointDef(); 116 const Abi::BPDef *bp = abi_->GetBreakpointDef();
118 117
119 // Iterate through the map, removing breakpoints 118 // Iterate through the map, removing breakpoints
120 while (!breakMap_.empty()) { 119 while (!breakMap_.empty()) {
121 // Copy the key/value locally 120 // Copy the key/value locally
122 BreakMap_t::iterator cur = breakMap_.begin(); 121 BreakMap_t::iterator cur = breakMap_.begin();
123 uint64_t addr = cur->first; 122 uint64_t addr = cur->first;
124 uint8_t *data = cur->second; 123 uint8_t *data = cur->second;
125 124
126 // Then remove it from the map 125 // Then remove it from the map
127 breakMap_.erase(cur); 126 breakMap_.erase(cur);
128 127
129 // Copy back the old code, and free the data 128 // Copy back the old code, and free the data
130 IPlatform::SetMemory(addr, bp->size_, data); 129 IPlatform::SetMemory(addr, bp->size_, data);
131 delete[] data; 130 delete[] data;
132 } 131 }
133 132
134 return true; 133 return true;
135 } 134 }
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 // IN : $maaaa,llll 430 // IN : $maaaa,llll
432 // OUT: $xx..xx 431 // OUT: $xx..xx
433 case 'm': { 432 case 'm': {
434 uint64_t addr; 433 uint64_t addr;
435 uint64_t wlen; 434 uint64_t wlen;
436 uint32_t len; 435 uint32_t len;
437 if (!pktIn->GetNumberSep(&addr, 0)) { 436 if (!pktIn->GetNumberSep(&addr, 0)) {
438 err = BAD_FORMAT; 437 err = BAD_FORMAT;
439 break; 438 break;
440 } 439 }
441 if (addr < mem_base_) { 440
442 addr += mem_base_;
443 }
444 if (!pktIn->GetNumberSep(&wlen, 0)) { 441 if (!pktIn->GetNumberSep(&wlen, 0)) {
445 err = BAD_FORMAT; 442 err = BAD_FORMAT;
446 break; 443 break;
447 } 444 }
448 445
449 len = static_cast<uint32_t>(wlen); 446 len = static_cast<uint32_t>(wlen);
450 uint8_t *block = new uint8_t[len]; 447 uint8_t *block = new uint8_t[len];
451 if (!port::IPlatform::GetMemory(addr, len, block)) err = FAILED; 448 if (!port::IPlatform::GetMemory(addr, len, block)) err = FAILED;
452 449
453 pktOut->AddBlock(block, len); 450 pktOut->AddBlock(block, len);
454 break; 451 break;
455 } 452 }
456 453
457 // IN : $Maaaa,llll:xx..xx 454 // IN : $Maaaa,llll:xx..xx
458 // OUT: $OK 455 // OUT: $OK
459 case 'M': { 456 case 'M': {
460 uint64_t addr; 457 uint64_t addr;
461 uint64_t wlen; 458 uint64_t wlen;
462 uint32_t len; 459 uint32_t len;
463 460
464 if (!pktIn->GetNumberSep(&addr, 0)) { 461 if (!pktIn->GetNumberSep(&addr, 0)) {
465 err = BAD_FORMAT; 462 err = BAD_FORMAT;
466 break; 463 break;
467 } 464 }
468 if (addr < mem_base_) {
469 addr += mem_base_;
470 }
471
472 if (!pktIn->GetNumberSep(&wlen, 0)) { 465 if (!pktIn->GetNumberSep(&wlen, 0)) {
473 err = BAD_FORMAT; 466 err = BAD_FORMAT;
474 break; 467 break;
475 } 468 }
476 469
477 len = static_cast<uint32_t>(wlen); 470 len = static_cast<uint32_t>(wlen);
478 uint8_t *block = new uint8_t[len]; 471 uint8_t *block = new uint8_t[len];
479 pktIn->GetBlock(block, len); 472 pktIn->GetBlock(block, len);
480 473
481 if (!port::IPlatform::SetMemory(addr, len, block)) err = FAILED; 474 if (!port::IPlatform::SetMemory(addr, len, block)) err = FAILED;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 627
635 return NULL; 628 return NULL;
636 } 629 }
637 630
638 631
639 } // namespace gdb_rsp 632 } // namespace gdb_rsp
640 633
641 634
642 635
643 636
OLDNEW
« no previous file with comments | « src/trusted/gdb_rsp/target.h ('k') | src/trusted/service_runtime/nacl_all_modules.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698