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

rust-lldb: "ValueError: Positive integer expected" trying to print regex::Captures #52185

Closed
alex opened this issue Jul 9, 2018 · 0 comments
Closed

Comments

@alex
Copy link
Member

alex commented Jul 9, 2018

I'm in a frame of Rust code with a regex::Captures local:

frame #9: 0x00000001000095d1 dom-rooting`dom_rooting::parse_callgraph_call::he390b4fd9cb48a86(line="D 1 2") at main.rs:84
   81  	    let m = RE.captures(line)
   82  	        .expect(&format!("parse failure: {:?}", line));
   83
-> 84  	    return (m[1].parse().unwrap(), m[2].parse().unwrap());
   85  	}
   86
   87  	fn parse_callgraph(p: &Path) -> Callgraph {

I try to print m (the regex::Captures) and hilarity ensues:

(lldb) p m
Traceback (most recent call last):
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 99, in print_val
    is_tuple_like = False)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 220, in print_struct_val
    body = separator.join([render_child(idx) for idx in range(field_start_index, len(fields))])
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 213, in render_child
    return this + print_val(field_val.get_wrapped_value(), internal_dict)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 132, in print_val
    is_tuple_like = True)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 220, in print_struct_val
    body = separator.join([render_child(idx) for idx in range(field_start_index, len(fields))])
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 213, in render_child
    return this + print_val(field_val.get_wrapped_value(), internal_dict)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 115, in print_val
    return print_std_vec_val(val, internal_dict)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 264, in print_std_vec_val
    internal_dict)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 299, in print_array_of_values
    return ', '.join([render_element(i) for i in range(length)])
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 297, in render_element
    return print_val(element_val, internal_dict)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 156, in print_val
    return print_val(lldb_val.GetChildAtIndex(discriminant_val), internal_dict)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 132, in print_val
    is_tuple_like = True)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 220, in print_struct_val
    body = separator.join([render_child(idx) for idx in range(field_start_index, len(fields))])
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 213, in render_child
    return this + print_val(field_val.get_wrapped_value(), internal_dict)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 112, in print_val
    return print_str_slice_val(val, internal_dict)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 268, in print_str_slice_val
    return read_utf8_string(data_ptr, length)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 305, in read_utf8_string
    data = process.ReadMemory(ptr_val.as_integer(), byte_count, error)
  File "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python/lldb/__init__.py", line 7184, in ReadMemory
    return _lldb.SBProcess_ReadMemory(self, *args)
ValueError: Positive integer expected
Traceback (most recent call last):
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 132, in print_val
    is_tuple_like = True)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 220, in print_struct_val
    body = separator.join([render_child(idx) for idx in range(field_start_index, len(fields))])
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 213, in render_child
    return this + print_val(field_val.get_wrapped_value(), internal_dict)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 115, in print_val
    return print_std_vec_val(val, internal_dict)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 264, in print_std_vec_val
    internal_dict)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 299, in print_array_of_values
    return ', '.join([render_element(i) for i in range(length)])
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 297, in render_element
    return print_val(element_val, internal_dict)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 156, in print_val
    return print_val(lldb_val.GetChildAtIndex(discriminant_val), internal_dict)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 132, in print_val
    is_tuple_like = True)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 220, in print_struct_val
    body = separator.join([render_child(idx) for idx in range(field_start_index, len(fields))])
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 213, in render_child
    return this + print_val(field_val.get_wrapped_value(), internal_dict)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 112, in print_val
    return print_str_slice_val(val, internal_dict)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 268, in print_str_slice_val
    return read_utf8_string(data_ptr, length)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 305, in read_utf8_string
    data = process.ReadMemory(ptr_val.as_integer(), byte_count, error)
  File "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python/lldb/__init__.py", line 7184, in ReadMemory
    return _lldb.SBProcess_ReadMemory(self, *args)
ValueError: Positive integer expected
Traceback (most recent call last):
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 115, in print_val
    return print_std_vec_val(val, internal_dict)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 264, in print_std_vec_val
    internal_dict)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 299, in print_array_of_values
    return ', '.join([render_element(i) for i in range(length)])
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 297, in render_element
    return print_val(element_val, internal_dict)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 156, in print_val
    return print_val(lldb_val.GetChildAtIndex(discriminant_val), internal_dict)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 132, in print_val
    is_tuple_like = True)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 220, in print_struct_val
    body = separator.join([render_child(idx) for idx in range(field_start_index, len(fields))])
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 213, in render_child
    return this + print_val(field_val.get_wrapped_value(), internal_dict)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 112, in print_val
    return print_str_slice_val(val, internal_dict)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 268, in print_str_slice_val
    return read_utf8_string(data_ptr, length)
  File "/Users/agaynor/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 305, in read_utf8_string
    data = process.ReadMemory(ptr_val.as_integer(), byte_count, error)
  File "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python/lldb/__init__.py", line 7184, in ReadMemory
    return _lldb.SBProcess_ReadMemory(self, *args)
ValueError: Positive integer expected
(regex::re_unicode::Captures) $3 = {
  text = "D 1 2"
  locs = {
    __0 = {
      buf = RawVec<core::option::Option<usize>, alloc::alloc::Global> {
ptr: Unique<core::option::Option<usize>> {
pointer: NonZero<*const core::option::Option<usize>>(&0x10288d280),
_marker: PhantomData<core::option::Option<usize>>
},
cap: 8,
a: Global
}
      len = 8
    }
  }
  named_groups = Arc<std::collections::hash::map::HashMap<alloc::string::String, usize, std::collections::hash::map::RandomState>> {
ptr: NonNull<alloc::arc::ArcInner<std::collections::hash::map::HashMap<alloc::string::String, usize, std::collections::hash::map::RandomState>>> {
pointer: NonZero<*const alloc::arc::ArcInner<std::collections::hash::map::HashMap<alloc::string::String, usize, std::collections::hash::map::RandomState>>>(&0x10288c500)
},
phantom: PhantomData<std::collections::hash::map::HashMap<alloc::string::String, usize, std::collections::hash::map::RandomState>>
}
}
(lldb)

System info:

~/p/h/dom-rooting ❯❯❯ rust-lldb --version
lldb-900.0.57
  Swift-4.0
~/p/h/dom-rooting ❯❯❯ rustc --version
rustc 1.27.0 (3eda71b00 2018-06-19)
~/p/h/dom-rooting ❯❯❯ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.13.5
BuildVersion:	17F77
Centril added a commit to Centril/rust that referenced this issue Feb 24, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).
Centril added a commit to Centril/rust that referenced this issue Feb 25, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
Centril added a commit to Centril/rust that referenced this issue Feb 27, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
Centril added a commit to Centril/rust that referenced this issue Feb 27, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
Centril added a commit to Centril/rust that referenced this issue Feb 27, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
Centril added a commit to Centril/rust that referenced this issue Feb 28, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
Centril added a commit to Centril/rust that referenced this issue Feb 28, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
Centril added a commit to Centril/rust that referenced this issue Feb 28, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
pietroalbini added a commit to pietroalbini/rust that referenced this issue Mar 1, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
Centril added a commit to Centril/rust that referenced this issue Mar 9, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
Centril added a commit to Centril/rust that referenced this issue Mar 9, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
Centril added a commit to Centril/rust that referenced this issue Mar 9, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
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

No branches or pull requests

1 participant