Skip to content

Commit bf2529f

Browse files
authored
Merge branch 'main' into vmclock
2 parents 98463ef + dd4555a commit bf2529f

File tree

6 files changed

+35
-36
lines changed

6 files changed

+35
-36
lines changed

Cargo.lock

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/clippy-tracing/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ bench = false
1313
clap = { version = "4.5.51", features = ["derive"] }
1414
itertools = "0.14.0"
1515
proc-macro2 = { version = "1.0.103", features = ["span-locations"] }
16-
quote = "1.0.41"
17-
syn = { version = "2.0.109", features = ["full", "extra-traits", "visit", "visit-mut", "printing"] }
16+
quote = "1.0.42"
17+
syn = { version = "2.0.110", features = ["full", "extra-traits", "visit", "visit-mut", "printing"] }
1818
walkdir = "2.5.0"
1919

2020
[dev-dependencies]

src/log-instrument-macros/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ bench = false
1212

1313
[dependencies]
1414
proc-macro2 = "1.0.103"
15-
quote = "1.0.41"
16-
syn = { version = "2.0.109", features = ["full", "extra-traits"] }
15+
quote = "1.0.42"
16+
syn = { version = "2.0.110", features = ["full", "extra-traits"] }
1717

1818
[lints]
1919
workspace = true

src/vmm/src/builder.rs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ pub enum StartMicrovmError {
112112
CreateEntropyDevice(crate::devices::virtio::rng::EntropyError),
113113
/// Failed to allocate guest resource: {0}
114114
AllocateResources(#[from] vm_allocator::Error),
115-
/// Error starting GDB debug session
115+
/// Error starting GDB debug session: {0}
116116
#[cfg(feature = "gdb")]
117117
GdbServer(gdb::target::GdbTargetError),
118118
/// Error cloning Vcpu fds
@@ -291,19 +291,12 @@ pub fn build_microvm_for_boot(
291291
let vmm = Arc::new(Mutex::new(vmm));
292292

293293
#[cfg(feature = "gdb")]
294-
{
295-
let (gdb_tx, gdb_rx) = mpsc::channel();
296-
vcpus
297-
.iter_mut()
298-
.for_each(|vcpu| vcpu.attach_debug_info(gdb_tx.clone()));
299-
300-
if let Some(gdb_socket_path) = &vm_resources.machine_config.gdb_socket_path {
301-
gdb::gdb_thread(vmm.clone(), gdb_rx, entry_point.entry_addr, gdb_socket_path)
302-
.map_err(StartMicrovmError::GdbServer)?;
303-
} else {
304-
debug!("No GDB socket provided not starting gdb server.");
305-
}
306-
}
294+
let (gdb_tx, gdb_rx) = mpsc::channel();
295+
296+
#[cfg(feature = "gdb")]
297+
vcpus
298+
.iter_mut()
299+
.for_each(|vcpu| vcpu.attach_debug_info(gdb_tx.clone()));
307300

308301
// Move vcpus to their own threads and start their state machine in the 'Paused' state.
309302
vmm.lock()
@@ -317,6 +310,14 @@ pub fn build_microvm_for_boot(
317310
)
318311
.map_err(VmmError::VcpuStart)?;
319312

313+
#[cfg(feature = "gdb")]
314+
if let Some(gdb_socket_path) = &vm_resources.machine_config.gdb_socket_path {
315+
gdb::gdb_thread(vmm.clone(), gdb_rx, entry_point.entry_addr, gdb_socket_path)
316+
.map_err(StartMicrovmError::GdbServer)?;
317+
} else {
318+
debug!("No GDB socket provided not starting gdb server.");
319+
}
320+
320321
// Load seccomp filters for the VMM thread.
321322
// Execution panics if filters cannot be loaded, use --no-seccomp if skipping filters
322323
// altogether is the desired behaviour.

src/vmm/src/gdb/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ pub fn gdb_thread(
5151
}
5252

5353
let path = Path::new(socket_addr);
54-
let listener = UnixListener::bind(path).map_err(|_| GdbTargetError::ServerSocketError)?;
54+
let listener = UnixListener::bind(path).map_err(GdbTargetError::ServerSocketError)?;
5555
trace!("Waiting for GDB server connection on {}...", path.display());
5656
let (connection, _addr) = listener
5757
.accept()
58-
.map_err(|_| GdbTargetError::ServerSocketError)?;
58+
.map_err(GdbTargetError::ServerSocketError)?;
5959

6060
std::thread::Builder::new()
6161
.name("gdb".into())

src/vmm/src/gdb/target.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ pub enum GdbTargetError {
6565
NoPausedVcpu,
6666
/// Error when setting Vcpu debug flags
6767
VcpuKvmError,
68-
/// Server socket Error
69-
ServerSocketError,
68+
/// Server socket Error: {0}
69+
ServerSocketError(std::io::Error),
7070
/// Error with creating GDB thread
7171
GdbThreadError,
7272
/// VMM locking error
@@ -394,8 +394,6 @@ impl MultiThreadBase for FirecrackerTarget {
394394
let vcpu_idx = tid_to_vcpuid(tid);
395395
let vcpu_fd = &vmm.vcpus_handles[vcpu_idx].vcpu_fd;
396396

397-
let vmm = &self.vmm.lock().expect("Error locking vmm in read addr");
398-
399397
while !data.is_empty() {
400398
let gpa = arch::translate_gva(vcpu_fd, gva, &vmm).map_err(|e| {
401399
error!("Error {e:?} translating gva on read address: {gva:#X}");

0 commit comments

Comments
 (0)