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

Side by Side Diff: ppapi/native_client/src/trusted/plugin/pnacl_options.cc

Issue 181153002: Have PNaCl use debug pexe URL instead of stripped pexe w/ kEnableNaClDebug (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nosandbox win Created 6 years, 9 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 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/native_client/src/trusted/plugin/pnacl_options.h" 5 #include "ppapi/native_client/src/trusted/plugin/pnacl_options.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 #include <vector> 8 #include <vector>
9 9
10 #include "native_client/src/include/nacl_string.h" 10 #include "native_client/src/include/nacl_string.h"
11 11
12 namespace plugin { 12 namespace plugin {
13 13
14 PnaclOptions::PnaclOptions() : translate_(false), opt_level_(2) { } 14 PnaclOptions::PnaclOptions()
15 : translate_(false),
16 is_debug_(false),
17 opt_level_(2) {
18 }
15 19
16 PnaclOptions::~PnaclOptions() { 20 PnaclOptions::~PnaclOptions() {
17 } 21 }
18 22
19 void PnaclOptions::set_opt_level(int32_t l) { 23 void PnaclOptions::set_opt_level(int32_t l) {
20 if (l <= 0) { 24 if (l <= 0) {
21 opt_level_ = 0; 25 opt_level_ = 0;
22 return; 26 return;
23 } 27 }
24 // Currently only allow 0 or 2, since that is what we test. 28 // Currently only allow 0 or 2, since that is what we test.
25 opt_level_ = 2; 29 opt_level_ = 2;
26 } 30 }
27 31
28 std::vector<char> PnaclOptions::GetOptCommandline() const { 32 std::vector<char> PnaclOptions::GetOptCommandline() const {
29 std::vector<char> result; 33 std::vector<char> result;
30 nacl::string str; 34 nacl::string str;
31 35
32 nacl::stringstream ss; 36 nacl::stringstream ss;
33 ss << "-O" << opt_level_; 37 ss << "-O" << opt_level_;
38 // Debug info is only available in LLVM format pexes,
39 // not in PNaCl format pexes.
40 if (is_debug_)
41 ss << "\x00-bitcode-format=llvm";
34 str = ss.str(); 42 str = ss.str();
35 43
36 std::copy(str.begin(), str.end(), std::back_inserter(result)); 44 std::copy(str.begin(), str.end(), std::back_inserter(result));
37 result.push_back('\x00'); 45 result.push_back('\x00');
38 46
39 return result; 47 return result;
40 } 48 }
41 49
42 } // namespace plugin 50 } // namespace plugin
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698