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:
sgjesse@chromium.org 2009-02-13 14:20:03 +00:00
parent b10926644c
commit 5344151ecb
2 changed files with 13 additions and 4 deletions

View File

@ -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);
}
}

View File

@ -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);