Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proc: if a reslice operator is used load the whole slice #3623

Merged
merged 1 commit into from
Jan 24, 2024

Conversation

aarzilli
Copy link
Member

@aarzilli aarzilli commented Jan 3, 2024

When the users uses a reslice operation load the whole resliced
variable, ignoring the MaxArrayValues setting.

Only apply this when the 'high' part is specified and a literal and the
'low' part is either unspecified or a literal.

Fixes #3600

When the users uses a reslice operation load the whole resliced
variable, ignoring the MaxArrayValues setting.
Only apply this when the 'high' part is specified and a literal and the
'low' part is either unspecified or a literal.

Fixes go-delve#3600
}

if node.Low != nil {
err = ctx.compileAST(node.Low)
if err != nil {
return err
}
_, isbasiclit := node.Low.(*ast.BasicLit)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why perform this check on the low side, what would cause us to not trust the length depending on the low side of the slice operation?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thinking is that we only do this when the expression has a fixed length and something like s[a:1000000] doesn't.

Copy link
Member

@derekparker derekparker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@derekparker derekparker merged commit 6cd0b70 into go-delve:master Jan 24, 2024
2 checks passed
@thockin
Copy link
Contributor

thockin commented Jan 24, 2024

Yay, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Printing a subscriptable type should respect the subscript size, even if larger than max-array-values
3 participants