Skip to content

[lldb] Change the two remaining SInt64 settings in Target to uint #105460

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

Merged
merged 2 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lldb/source/Target/Target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4609,7 +4609,7 @@ uint32_t TargetProperties::GetMaxZeroPaddingInFloatFormat() const {

uint32_t TargetProperties::GetMaximumNumberOfChildrenToDisplay() const {
const uint32_t idx = ePropertyMaxChildrenCount;
return GetPropertyAtIndexAs<int64_t>(
return GetPropertyAtIndexAs<uint64_t>(
idx, g_target_properties[idx].default_uint_value);
}

Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Target/TargetProperties.td
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ let Definition = "target" in {
def MaxZeroPaddingInFloatFormat: Property<"max-zero-padding-in-float-format", "UInt64">,
DefaultUnsignedValue<6>,
Desc<"The maximum number of zeroes to insert when displaying a very small float before falling back to scientific notation.">;
def MaxChildrenCount: Property<"max-children-count", "SInt64">,
def MaxChildrenCount: Property<"max-children-count", "UInt64">,
DefaultUnsignedValue<256>,
Desc<"Maximum number of children to expand in any level of depth.">;
def MaxChildrenDepth: Property<"max-children-depth", "UInt64">,
Expand All @@ -101,7 +101,7 @@ let Definition = "target" in {
def MaxSummaryLength: Property<"max-string-summary-length", "UInt64">,
DefaultUnsignedValue<1024>,
Desc<"Maximum number of characters to show when using %s in summary strings.">;
def MaxMemReadSize: Property<"max-memory-read-size", "SInt64">,
def MaxMemReadSize: Property<"max-memory-read-size", "UInt64">,
DefaultUnsignedValue<1024>,
Desc<"Maximum number of bytes that 'memory read' will fetch before --force must be specified.">;
def BreakpointUseAvoidList: Property<"breakpoints-use-platform-avoid-list", "Boolean">,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Test lldb data formatter subsystem.
"""


import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
Expand Down Expand Up @@ -51,7 +50,7 @@ def do_test(self, stdlib_type):
self.expect(
"settings show target.max-children-count",
matching=True,
substrs=["target.max-children-count (int) = 256"],
substrs=["target.max-children-count (unsigned) = 256"],
)

self.expect(
Expand Down Expand Up @@ -132,7 +131,7 @@ def do_test_ptr_and_ref(self, stdlib_type):
self.expect(
"settings show target.max-children-count",
matching=True,
substrs=["target.max-children-count (int) = 256"],
substrs=["target.max-children-count (unsigned) = 256"],
)

self.expect(
Expand Down
3 changes: 3 additions & 0 deletions lldb/test/API/functionalities/memory/big-read/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
C_SOURCES := main.c

include Makefile.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""
Test the maximum memory read setting.
"""

import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil


class TestMemoryReadMaximumSize(TestBase):
def test_memory_read_max_setting(self):
"""Test the target.max-memory-read-size setting."""
self.build()
(
self.target,
self.process,
self.thread,
self.bp,
) = lldbutil.run_to_source_breakpoint(
self, "breakpoint here", lldb.SBFileSpec("main.c")
)
self.assertTrue(self.bp.IsValid())

self.expect(
"mem rea -f x -s 4 -c 2048 `&c`",
error=True,
substrs=["Normally, 'memory read' will not read over 1024 bytes of data"],
)
self.runCmd("settings set target.max-memory-read-size `2048 * sizeof(int)`")
self.expect("mem rea -f x -s 4 -c 2048 `&c`", substrs=["feed"])
9 changes: 9 additions & 0 deletions lldb/test/API/functionalities/memory/big-read/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <string.h>
int main() {
int c[2048];
memset(c, 0, 2048 * sizeof(int));

c[2047] = 0xfeed;

return c[2047]; // breakpoint here
}
Loading