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

Updated to bitflags 2.2.1. #138

Merged
merged 4 commits into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ categories = ["development-tools::debugging", "embedded", "emulators", "network-
exclude = ["examples/**/*.elf", "examples/**/*.o"]

[dependencies]
bitflags = "1.3"
bitflags = "2.3.1"
cfg-if = "1.0"
log = "0.4"
managed = { version = "0.8", default-features = false }
Expand Down
6 changes: 5 additions & 1 deletion src/stub/core_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,15 @@ impl<T: Target, C: Connection> GdbStubImpl<T, C> {
}
}

#[derive(Copy, Clone)]
#[repr(transparent)]
struct ProtocolFeatures(u8);

// This bitflag is not part of the protocol - it is an internal implementation
// detail. The alternative would be to use multiple `bool` fields, which wastes
// space in minimal `gdbstub` configurations.
bitflags::bitflags! {
struct ProtocolFeatures: u8 {
impl ProtocolFeatures: u8 {
const NO_ACK_MODE = 1 << 0;
const MULTIPROCESS = 1 << 1;
}
Expand Down
32 changes: 20 additions & 12 deletions src/target/ext/host_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ use crate::arch::Arch;
use crate::target::Target;
use bitflags::bitflags;

/// Host flags for opening files.
///
/// Extracted from the GDB documentation at
/// [Open Flags](https://sourceware.org/gdb/current/onlinedocs/gdb/Open-Flags.html#Open-Flags),
/// and the LLDB source code at
/// [`lldb/include/lldb/Host/File.h`](https://github.com/llvm/llvm-project/blob/ec642ceebc1aacc8b16249df7734b8cf90ae2963/lldb/include/lldb/Host/File.h#L47-L66)
#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(transparent)]
pub struct HostIoOpenFlags(u32);

bitflags! {
/// Host flags for opening files.
///
/// Extracted from the GDB documentation at
/// [Open Flags](https://sourceware.org/gdb/current/onlinedocs/gdb/Open-Flags.html#Open-Flags),
/// and the LLDB source code at
/// [`lldb/include/lldb/Host/File.h`](https://github.com/llvm/llvm-project/blob/ec642ceebc1aacc8b16249df7734b8cf90ae2963/lldb/include/lldb/Host/File.h#L47-L66)
pub struct HostIoOpenFlags: u32 {
impl HostIoOpenFlags: u32 {
/// A read-only file.
const O_RDONLY = 0x0;
/// A write-only file.
Expand All @@ -37,12 +41,16 @@ bitflags! {
}
}

/// Host file permissions.
///
/// Extracted from the GDB documentation at
/// [mode_t Values](https://sourceware.org/gdb/current/onlinedocs/gdb/mode_005ft-Values.html#mode_005ft-Values)
#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(transparent)]
pub struct HostIoOpenMode(u32);

bitflags! {
/// Host file permissions.
///
/// Extracted from the GDB documentation at
/// [mode_t Values](https://sourceware.org/gdb/current/onlinedocs/gdb/mode_005ft-Values.html#mode_005ft-Values)
pub struct HostIoOpenMode: u32 {
impl HostIoOpenMode: u32 {
/// A regular file.
const S_IFREG = 0o100000;
/// A directory.
Expand Down