&str variable truncating content when debugging Rust with LLDB

So, I'm new to Rust and haven't used C, C++ and LLDB before so I'm hoping I'm just missing something simple.

Let's say I have a large str and during debug I want to check its content. I'm using rust-analyzer and vscode lldb to debug it, so far it's working fine.

In this example here:

    fn main() {

        let long_json = r#"

        [{"_id":"5ee16b56b0b0334e110a77cc","index":0,"guid":"e5732cad-96d4-48a6-ac38-cb7bff197ea1","isActive":false,"balance":"$1,345.79","picture":"http://placehold.it/32x32","age":39,"eyeColor":"brown","name":{"first":"Roxanne","last":"Roberson"},"company":"OTHERSIDE","email":"roxanne.roberson@otherside.ca","phone":"+1 (981) 453-2288","address":"406 Wakeman Place, Kimmell, Maine, 1913","about":"Commodo sint veniam dolore reprehenderit nisi aliquip quis in deserunt ullamco. Elit aute ad Lorem pariatur officia ut mollit officia laborum minim. Duis elit Lorem anim consectetur qui excepteur duis voluptate excepteur in. Pariatur ullamco duis sint labore proident cillum fugiat ex amet.","registered":"Saturday, January 5, 2019 6:07 PM","latitude":"-59.649851","longitude":"-128.151453","tags":["excepteur","nisi","eu","do","sint"],"range":[0,1,2,3,4,5,6,7,8,9],"friends":[{"id":0,"name":"Hendricks Herring"},{"id":1,"name":"Gretchen Kramer"},{"id":2,"name":"Rhodes Roach"}],"greeting":"Hello, Roxanne! You have 9 unread messages.","favoriteFruit":"banana"},{"_id":"5ee16b564293f351ac08db96","index":1,"guid":"803b7568-91d4-45bb-96ce-aed2446cf594","isActive":true,"balance":"$3,910.52","picture":"http://placehold.it/32x32","age":34,"eyeColor":"brown","name":{"first":"Jeannette","last":"Mcbride"},"company":"SKYBOLD","email":"jeannette.mcbride@skybold.com","phone":"+1 (843) 442-3422","address":"129 Wogan Terrace, Rodanthe, Tennessee, 4002","about":"Proident ullamco in magna ullamco culpa enim non. Nulla nisi enim sunt nisi pariatur dolore exercitation sunt cillum pariatur. Sunt irure sunt aliquip sit laborum deserunt officia ullamco deserunt pariatur magna excepteur amet magna. Qui do elit velit commodo voluptate cillum id nostrud eiusmod est dolore ad Lorem. Cillum nulla do commodo consequat laboris tempor do nostrud excepteur.","registered":"Wednesday, February 5, 2020 5:51 PM","latitude":"-77.176568","longitude":"-172.379058","tags":["mollit","commodo","aliqua","laboris","consequat"],"range":[0,1,2,3,4,5,6,7,8,9],"friends":[{"id":0,"name":"Mcpherson Fuentes"},{"id":1,"name":"Booker Abbott"},{"id":2,"name":"Cara Cook"}],"greeting":"Hello, Jeannette! You have 7 unread messages.","favoriteFruit":"banana"},{"_id":"5ee16b5610542ece44b716d4","index":2,"guid":"f9739d20-d732-408c-85e1-8daff7b65eb2","isActive":false,"balance":"$2,960.17","picture":"http://placehold.it/32x32","age":24,"eyeColor":"green","name":{"first":"Barlow","last":"Cantu"},"company":"SOPRANO","email":"barlow.cantu@soprano.biz","phone":"+1 (817) 543-3894","address":"655 Harwood Place, Homeworth, New Mexico, 4005","about":"Est eu consequat esse enim nisi velit enim mollit incididunt labore esse in. Sint eu ut exercitation quis ipsum. Dolore in magna cillum do elit. Qui sit id nostrud voluptate qui Lorem laborum magna non veniam occaecat exercitation.","registered":"Saturday, January 7, 2017 9:59 AM","latitude":"-6.108453","longitude":"149.592845","tags":["laboris","ea","reprehenderit","do","adipisicing"],"range":[0,1,2,3,4,5,6,7,8,9],"friends":[{"id":0,"name":"Althea English"},{"id":1,"name":"Valarie Dixon"},{"id":2,"name":"Gonzales Randall"}],"greeting":"Hello, Barlow! You have 5 unread messages.","favoriteFruit":"strawberry"},{"_id":"5ee16b56885ee10344bbc738","index":3,"guid":"608a3ee8-748f-4fbf-9143-2d5f3f029bf3","isActive":true,"balance":"$1,364.97","picture":"http://placehold.it/32x32","age":28,"eyeColor":"blue","name":{"first":"Farley","last":"Day"},"company":"VELITY","email":"farley.day@velity.org","phone":"+1 (856) 571-3784","address":"172 Middleton Street, Wakarusa, District Of Columbia, 7728","about":"Ea consectetur elit tempor do quis nostrud eiusmod eu veniam incididunt in ad voluptate. Amet nulla duis deserunt eiusmod excepteur officia magna do incididunt sint proident fugiat. Nulla cillum irure fugiat ut proident duis deserunt enim incididunt nisi tempor Lorem enim. Lorem sunt elit proident fugiat. Ipsum tempor exercitation anim excepteur tempor cupidatat cillum occaecat enim dolor do.","registered":"Wednesday, May 27, 2020 6:26 PM","latitude":"24.472778","longitude":"154.028566","tags":["est","mollit","anim","mollit","commodo"],"range":[0,1,2,3,4,5,6,7,8,9],"friends":[{"id":0,"name":"Conway Larson"},{"id":1,"name":"Fry Todd"},{"id":2,"name":"Katherine Shaffer"}],"greeting":"Hello, Farley! You have 5 unread messages.","favoriteFruit":"banana"},{"_id":"5ee16b568a697948f80eff97","index":4,"guid":"150c8692-afe3-46c4-9500-7ca44a73ca5f","isActive":false,"balance":"$3,767.73","picture":"http://placehold.it/32x32","age":40,"eyeColor":"blue","name":{"first":"Kerry","last":"Blanchard"},"company":"CONFRENZY","email":"kerry.blanchard@confrenzy.co.uk","phone":"+1 (948) 560-3098","address":"679 Ocean Court, Levant, Indiana, 3159","about":"Exercitation mollit proident non proident do et. Veniam pariatur culpa dolore anim ullamco amet enim. Non minim deserunt culpa culpa consequat pariatur in sunt exercitation.","registered":"Tuesday, May 8, 2018 6:49 PM","latitude":"-73.042028","longitude":"64.25606","tags":["aliqua","amet","veniam","deserunt","amet"],"range":[0,1,2,3,4,5,6,7,8,9],"friends":[{"id":0,"name":"Church Higgins"},{"id":1,"name":"Vargas Buckley"},{"id":2,"name":"Moon Hansen"}],"greeting":"Hello, Kerry! You have 7 unread messages.","favoriteFruit":"apple"},{"_id":"5ee16b56202b99f98cf21aa4","index":5,"guid":"bd87be36-f388-4232-8120-c8f858e840a5","isActive":false,"balance":"$1,086.36","picture":"http://placehold.it/32x32","age":26,"eyeColor":"brown","name":{"first":"Maddox","last":"Bryan"},"company":"AQUOAVO","email":"maddox.bryan@aquoavo.io","phone":"+1 (875) 590-3532","address":"847 Hemlock Street, Draper, Nebraska, 7132","about":"Duis dolore voluptate velit anim nulla sit ipsum. Eiusmod enim commodo et deserunt do ipsum non culpa occaecat do aliqua irure. Ad nisi qui Lorem culpa ad aliquip id deserunt laborum. Ipsum enim pariatur anim ut pariatur minim.","registered":"Monday, February 23, 2015 12:14 AM","latitude":"-56.97017","longitude":"59.166085","tags":["officia","est","magna","occaecat","dolor"],"range":[0,1,2,3,4,5,6,7,8,9],"friends":[{"id":0,"name":"Terrie Williamson"},{"id":1,"name":"Vang Frank"},{"id":2,"name":"Abby Singleton"}],"greeting":"Hello, Maddox! You have 5 unread messages.","favoriteFruit":"apple"},{"_id":"5ee16b5674cc4b316d5c5635","index":6,"guid":"52e8fe45-4d51-4d6c-a995-5f9074191951","isActive":true,"balance":"$3,785.86","picture":"http://placehold.it/32x32","age":35,"eyeColor":"blue","name":{"first":"Hartman","last":"Hess"},"company":"TOURMANIA","email":"hartman.hess@tourmania.tv","phone":"+1 (954) 405-3788","address":"827 Linden Boulevard, Belleview, South Carolina, 9378","about":"Lorem irure fugiat eu duis irure est nostrud cupidatat nulla minim irure qui ullamco eiusmod. Enim Lorem mollit labore Lorem minim adipisicing voluptate sunt duis. Dolore mollit pariatur aute aliqua proident qui dolore velit eu. Cillum ut sit eu nulla adipisicing. Dolore irure et id duis velit irure aliqua deserunt fugiat exercitation irure aliqua pariatur non.","registered":"Thursday, May 9, 2019 1:59 PM","latitude":"68.864875","longitude":"9.569542","tags":["Lorem","in","consequat","adipisicing","anim"],"range":[0,1,2,3,4,5,6,7,8,9],"friends":[{"id":0,"name":"Hughes Dunn"},{"id":1,"name":"Laverne Knight"},{"id":2,"name":"Norman Myers"}],"greeting":"Hello, Hartman! You have 9 unread messages.","favoriteFruit":"apple"}]

        "#.to_owned();
        println!("This is a long json {:?}", long_json);
    }

If I add a breakpoint in the println! line and check the content of long_json in the local variables on the side it will be truncated.

I saw that this may be related to string_summarize option in LLDB, so based on the CodeLLDB docs I added this to my configs:

    "lldb.launch.initCommands": [
        "set set target.max-string-summary-length 10000"
    ],

Still no luck. I tried on the debug console to type ?long_json, po long_json but also no luck it's always truncating the result.

This is the po long_json result

    po long_json
    "
        [{"_id":"5ee16b56b0b0334e110a77cc","index":0,"guid":"e5732cad-96d4-48a6-ac38-cb7bff197ea1","isActive":false,"balance":"$1,345.79","picture":"http://placehold.it/32x32","age":39,"eyeColor":"brown","name":{"first":"Roxanne","last":"Roberson"},"company":"OTHERSIDE","email":"roxanne.roberson@otherside.ca","phone":"+1 (981) 453-2288","address":"406 Wakeman Place, Kimmell, Maine, 1913","about":"Commodo sint veniam dolore reprehenderit nisi aliquip quis in deserunt ullamco. Elit aute ad Lorem pariatur officia ut mollit officia laborum minim. Duis elit Lorem anim consectetur qui excepteur duis voluptate excepteur in. Pariatur ullamco duis sint labore proident cillum fugiat ex amet.","registered":"Saturday, January 5, 2019 6:07 PM","latitude":"-59.649851","longitude":"-128.151453","tags":["excepteur","nisi","eu","do","sint"],"range":[0,1,2,3,4,5,6,7,8,9],"friends":[{"id":0,"name":"Hendricks Herring"},{"id":1,"name":"Gretchen Kramer"},{"id":2,"name":"Rhodes Roach"}],"greeting":"Hello, Roxan..."

Is there a way to get the full value somehow without using println, in case I'm debuggins some package or something?

I think set should not be duplicated.

Oh, thanks for your answer.

If I try that I get this issue when I try to start debugging:

Executing script: initCommands
error: command 'settings' did not recognize 'target .max-string-summary-length' as valid (subcommand might be invalid).

So I think set set is correct even though it's a bit weird.

I based the double set on this file from VsCode LLDB github using this for another option:

I've faced the same issue. I've needed to view the long JSON string in the LLDB, but it was truncated.
I've solved this with the following python script (LLDB custom command).

import re
import lldb

def print_rust_str(debugger, command, result, internal_dict):
    mem_threshold = 8192
    var = command

    ci = debugger.GetCommandInterpreter()
    res = lldb.SBCommandReturnObject()

    ci.HandleCommand("po {}.vec.len".format(var), res)
    if not res.Succeeded():
        result.SetError(res.GetError())
        return

    read_len = int(res.GetOutput())

    if read_len > mem_threshold:
        result.SetError("Unable to read {} bytes (threshold = {})".format(
            read_len,
            mem_threshold
        ))
        return

    ci.HandleCommand(
        "me read -s1 -fa -c{} {}.vec.buf.ptr.pointer --force".format(
            read_len,
            var
        ),
        res
    )

    if not res.Succeeded():
        result.SetError(res.GetError())
        return

    output = res.GetOutput()

    hex_regex = r'0x(\d|[A-Fa-f])+'
    begin_regex = r'(^|\n){hex}: '.format(hex = hex_regex)
    output = re.sub(begin_regex, '', output)

    print(output, file=result)

And I added these commands into the launch.json:

"initCommands": [
                "command script import <path-to-python-script>",
                "command script add -f <python-script-file-name>.print_rust_str print_rust_str"
            ]

And then I was able to use it in LLDB:

print_rust_str <string-variable-name>

NOTE: this works only for String variables.

P.S.
I also tried set set -- target.max-children-count 8192, it works, but I've needed the raw string content and po <string-var-name> doesn't give me it even after setting max-children-count.