Added check for existing frames to the evaluate debugger request.
Fixed output of evaluated expressions from the debugger in the developer shell. Use global evaluate request from developer shell if there is no JavaScript stack. Remove use of JS2C macros in developer shell JavaScript code. Review URL: http://codereview.chromium.org/21350 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1273 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
b10926644c
commit
5344151ecb
12
src/d8.js
12
src/d8.js
@ -381,6 +381,10 @@ DebugRequest.prototype.makeEvaluateJSONRequest_ = function(expression) {
|
||||
var request = this.createRequest('evaluate');
|
||||
request.arguments = {};
|
||||
request.arguments.expression = expression;
|
||||
// Request a global evaluation if there is no current frame.
|
||||
if (Debug.State.currentFrame == kNoFrame) {
|
||||
request.arguments.global = true;
|
||||
}
|
||||
return request.toJSONProtocol();
|
||||
}
|
||||
};
|
||||
@ -795,7 +799,7 @@ function DebugResponseDetails(json_response) {
|
||||
case 'evaluate':
|
||||
case 'lookup':
|
||||
if (last_cmd == 'p' || last_cmd == 'print') {
|
||||
details.text = body.text;
|
||||
result = body.text;
|
||||
} else {
|
||||
var value = response.bodyValue();
|
||||
if (value.isObject()) {
|
||||
@ -984,10 +988,10 @@ ProtocolPackage.prototype.body = function() {
|
||||
|
||||
|
||||
ProtocolPackage.prototype.bodyValue = function(index) {
|
||||
if (IS_UNDEFINED(index)) {
|
||||
return new ProtocolValue(this.packet_.body, this);
|
||||
} else {
|
||||
if (index) {
|
||||
return new ProtocolValue(this.packet_.body[index], this);
|
||||
} else {
|
||||
return new ProtocolValue(this.packet_.body, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1421,6 +1421,11 @@ DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) {
|
||||
disable_break = true;
|
||||
}
|
||||
|
||||
// No frames no evaluate in frame.
|
||||
if (this.exec_state_.frameCount() == 0) {
|
||||
return response.failed('No frames');
|
||||
}
|
||||
|
||||
// Check whether a frame was specified.
|
||||
if (!IS_UNDEFINED(frame)) {
|
||||
var frame_number = %ToNumber(frame);
|
||||
|
Loading…
Reference in New Issue
Block a user