From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- .../cross_crate_debuginfo_type_uniquing.rs | 16 +++++++++++++++ tests/debuginfo/auxiliary/cross_crate_spans.rs | 19 ++++++++++++++++++ .../dependency-with-embedded-visualizers.natvis | 10 ++++++++++ .../dependency-with-embedded-visualizers.py | 23 ++++++++++++++++++++++ .../dependency-with-embedded-visualizers.rs | 19 ++++++++++++++++++ tests/debuginfo/auxiliary/issue-13213-aux.rs | 19 ++++++++++++++++++ tests/debuginfo/auxiliary/macro-stepping.rs | 10 ++++++++++ 7 files changed, 116 insertions(+) create mode 100644 tests/debuginfo/auxiliary/cross_crate_debuginfo_type_uniquing.rs create mode 100644 tests/debuginfo/auxiliary/cross_crate_spans.rs create mode 100644 tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.natvis create mode 100644 tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.py create mode 100644 tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.rs create mode 100644 tests/debuginfo/auxiliary/issue-13213-aux.rs create mode 100644 tests/debuginfo/auxiliary/macro-stepping.rs (limited to 'tests/debuginfo/auxiliary') diff --git a/tests/debuginfo/auxiliary/cross_crate_debuginfo_type_uniquing.rs b/tests/debuginfo/auxiliary/cross_crate_debuginfo_type_uniquing.rs new file mode 100644 index 000000000..b9bb3ba72 --- /dev/null +++ b/tests/debuginfo/auxiliary/cross_crate_debuginfo_type_uniquing.rs @@ -0,0 +1,16 @@ +// no-prefer-dynamic +#![crate_type = "rlib"] +// compile-flags:-g + +struct S1; + +impl S1 { + fn f(&mut self) { } +} + + +struct S2; + +impl S2 { + fn f(&mut self) { } +} diff --git a/tests/debuginfo/auxiliary/cross_crate_spans.rs b/tests/debuginfo/auxiliary/cross_crate_spans.rs new file mode 100644 index 000000000..efe5e4195 --- /dev/null +++ b/tests/debuginfo/auxiliary/cross_crate_spans.rs @@ -0,0 +1,19 @@ +#![crate_type = "rlib"] + +#![allow(unused_variables)] +#![feature(omit_gdb_pretty_printer_section)] +#![omit_gdb_pretty_printer_section] + +// no-prefer-dynamic +// compile-flags:-g + +pub fn generic_function(val: T) -> (T, T) { + let result = (val.clone(), val.clone()); + let a_variable: u32 = 123456789; + let another_variable: f64 = 123456789.5; + zzz(); + result +} + +#[inline(never)] +fn zzz() {()} diff --git a/tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.natvis b/tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.natvis new file mode 100644 index 000000000..5900fcc01 --- /dev/null +++ b/tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.natvis @@ -0,0 +1,10 @@ + + + + {name} is {age} years old. + + name + age + + + diff --git a/tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.py b/tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.py new file mode 100644 index 000000000..2635ed487 --- /dev/null +++ b/tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.py @@ -0,0 +1,23 @@ +import gdb + +class PersonPrinter: + "Print a Person" + + def __init__(self, val): + self.val = val + self.name = val["name"] + self.age = int(val["age"]) + + def to_string(self): + return "{} is {} years old.".format(self.name, self.age) + +def lookup(val): + lookup_tag = val.type.tag + if lookup_tag is None: + return None + if "dependency_with_embedded_visualizers::Person" == lookup_tag: + return PersonPrinter(val) + + return None + +gdb.current_objfile().pretty_printers.append(lookup) diff --git a/tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.rs b/tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.rs new file mode 100644 index 000000000..327515b10 --- /dev/null +++ b/tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.rs @@ -0,0 +1,19 @@ +// compile-flags:-g +// ignore-lldb +// no-prefer-dynamic + +#![feature(debugger_visualizer)] +#![debugger_visualizer(natvis_file = "dependency-with-embedded-visualizers.natvis")] +#![debugger_visualizer(gdb_script_file = "dependency-with-embedded-visualizers.py")] +#![crate_type = "rlib"] + +pub struct Person { + name: String, + age: i32, +} + +impl Person { + pub fn new(name: String, age: i32) -> Person { + Person { name: name, age: age } + } +} diff --git a/tests/debuginfo/auxiliary/issue-13213-aux.rs b/tests/debuginfo/auxiliary/issue-13213-aux.rs new file mode 100644 index 000000000..bde98b445 --- /dev/null +++ b/tests/debuginfo/auxiliary/issue-13213-aux.rs @@ -0,0 +1,19 @@ +#![crate_type = "lib"] +// compile-flags:-g + +pub use private::P; + +#[derive(Copy, Clone)] +pub struct S { + p: P, +} + +mod private { + #[derive(Copy, Clone)] + pub struct P { + p: i32, + } + pub const THREE: P = P { p: 3 }; +} + +pub static A: S = S { p: private::THREE }; diff --git a/tests/debuginfo/auxiliary/macro-stepping.rs b/tests/debuginfo/auxiliary/macro-stepping.rs new file mode 100644 index 000000000..4447dd22d --- /dev/null +++ b/tests/debuginfo/auxiliary/macro-stepping.rs @@ -0,0 +1,10 @@ +// compile-flags:-g + +#![crate_type = "rlib"] + +#[macro_export] +macro_rules! new_scope { + () => { + let x = 1; + } +} -- cgit v1.2.3