Skip to content

Commit 6cc6184

Browse files
committed
remove gdb feature guard for sandbox config
- the user experience is not great as the fields and methods related to gdb port are not accessible unless the gdb feature is turned on. - if one runs the build command in the cli and provides the --features gdb the IDE will not know that the feature is enabled and will show errors as it doesn't know about the fields/methods Signed-off-by: Doru Blânzeanu <[email protected]>
1 parent af0a52a commit 6cc6184

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

src/hyperlight_host/src/sandbox/config.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ use crate::mem::exe::ExeInfo;
2525
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
2626
#[repr(C)]
2727
pub struct SandboxConfiguration {
28-
#[cfg(gdb)]
2928
/// Guest gdb debug port
3029
guest_debug_port: Option<u16>,
3130
/// The maximum size of the guest error buffer.
@@ -139,9 +138,8 @@ impl SandboxConfiguration {
139138
pub const MIN_KERNEL_STACK_SIZE: usize = 0x1000;
140139
/// The default value for kernel stack size
141140
pub const DEFAULT_KERNEL_STACK_SIZE: usize = Self::MIN_KERNEL_STACK_SIZE;
142-
#[cfg(gdb)]
143141
/// The minimum value for debug port
144-
pub const MIN_GUEST_DEBUG_PORT: u16 = 9000;
142+
pub const MIN_GUEST_DEBUG_PORT: u16 = 1024;
145143

146144
#[allow(clippy::too_many_arguments)]
147145
/// Create a new configuration for a sandbox with the given sizes.
@@ -159,7 +157,7 @@ impl SandboxConfiguration {
159157
max_initialization_time: Option<Duration>,
160158
max_wait_for_cancellation: Option<Duration>,
161159
guest_panic_context_buffer_size: usize,
162-
#[cfg(gdb)] guest_debug_port: Option<u16>,
160+
guest_debug_port: Option<u16>,
163161
) -> Self {
164162
Self {
165163
input_data_size: max(input_data_size, Self::MIN_INPUT_SIZE),
@@ -227,7 +225,6 @@ impl SandboxConfiguration {
227225
guest_panic_context_buffer_size,
228226
Self::MIN_GUEST_PANIC_CONTEXT_BUFFER_SIZE,
229227
),
230-
#[cfg(gdb)]
231228
guest_debug_port,
232229
}
233230
}
@@ -355,7 +352,6 @@ impl SandboxConfiguration {
355352
);
356353
}
357354

358-
#[cfg(gdb)]
359355
#[instrument(skip_all, parent = Span::current(), level= "Trace")]
360356
/// Sets the configuration for the guest debug
361357
pub fn set_guest_debug_port(&mut self, port: u16) {
@@ -406,7 +402,6 @@ impl SandboxConfiguration {
406402
self.max_initialization_time
407403
}
408404

409-
#[cfg(gdb)]
410405
#[instrument(skip_all, parent = Span::current(), level= "Trace")]
411406
pub(crate) fn get_guest_debug_port(&self) -> Option<u16> {
412407
self.guest_debug_port
@@ -460,7 +455,6 @@ impl Default for SandboxConfiguration {
460455
None,
461456
None,
462457
Self::DEFAULT_GUEST_PANIC_CONTEXT_BUFFER_SIZE,
463-
#[cfg(gdb)]
464458
None,
465459
)
466460
}
@@ -504,7 +498,6 @@ mod tests {
504498
MAX_WAIT_FOR_CANCELLATION_OVERRIDE as u64,
505499
)),
506500
GUEST_PANIC_CONTEXT_BUFFER_SIZE_OVERRIDE,
507-
#[cfg(gdb)]
508501
None,
509502
);
510503
let exe_infos = vec![
@@ -569,7 +562,6 @@ mod tests {
569562
SandboxConfiguration::MIN_MAX_WAIT_FOR_CANCELLATION as u64 - 1,
570563
)),
571564
SandboxConfiguration::MIN_GUEST_PANIC_CONTEXT_BUFFER_SIZE - 1,
572-
#[cfg(gdb)]
573565
None,
574566
);
575567
assert_eq!(SandboxConfiguration::MIN_INPUT_SIZE, cfg.input_data_size);
@@ -741,7 +733,6 @@ mod tests {
741733
}
742734

743735
#[test]
744-
#[cfg(gdb)]
745736
fn guest_debug_port(port in 9000..=u16::MAX) {
746737
let mut cfg = SandboxConfiguration::default();
747738
cfg.set_guest_debug_port(port);

0 commit comments

Comments
 (0)