Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add updated SourceLanguage variants #157

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
69 changes: 47 additions & 22 deletions src/symbol/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ impl<'a> TryFromCtx<'a, Endian> for CPUType {
}

/// These values correspond to the CV_CFL_LANG enumeration, and are documented
/// [on MSDN](https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx).
/// [on MSDN](https://learn.microsoft.com/en-us/visualstudio/debugger/debug-interface-access/cv-cfl-lang?view=vs-2022).
#[non_exhaustive]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum SourceLanguage {
Expand Down Expand Up @@ -525,34 +525,53 @@ pub enum SourceLanguage {
MSIL = 0x0f,
/// Application language is High Level Shader Language.
HLSL = 0x10,

/// Application language is Objective-C.
ObjC = 0x11,
/// Application language is Objective-C++.
ObjCXX = 0x12,
/// Application language is Swift.
Swift = 0x13,
/// Application is a module generated by the aliasobj tool.
AliasObj = 0x14,
/// Application language is Rust.
Rust = 0x15,
/// Application language is Go.
Go = 0x16,
/// The DMD compiler emits 'D' for the CV source language. Microsoft doesn't
/// have an enumerator for it yet.
D = 0x44,
}

impl fmt::Display for SourceLanguage {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::C => write!(f, "C"),
Self::Cpp => write!(f, "Cpp"),
Self::Fortran => write!(f, "Fortran"),
Self::Masm => write!(f, "Masm"),
Self::Pascal => write!(f, "Pascal"),
Self::Basic => write!(f, "Basic"),
Self::Cobol => write!(f, "Cobol"),
Self::Link => write!(f, "Link"),
Self::Cvtres => write!(f, "Cvtres"),
Self::Cvtpgd => write!(f, "Cvtpgd"),
Self::CSharp => write!(f, "CSharp"),
Self::VB => write!(f, "VB"),
Self::ILAsm => write!(f, "ILAsm"),
Self::Java => write!(f, "Java"),
Self::JScript => write!(f, "JScript"),
Self::MSIL => write!(f, "MSIL"),
Self::HLSL => write!(f, "HLSL"),
Self::D => write!(f, "D"),
}
let str_repr = match self {
Self::C => "C",
Self::Cpp => "Cpp",
Self::Fortran => "Fortran",
Self::Masm => "Masm",
Self::Pascal => "Pascal",
Self::Basic => "Basic",
Self::Cobol => "Cobol",
Self::Link => "Link",
Self::Cvtres => "Cvtres",
Self::Cvtpgd => "Cvtpgd",
Self::CSharp => "CSharp",
Self::VB => "VB",
Self::ILAsm => "ILAsm",
Self::Java => "Java",
Self::JScript => "JScript",
Self::MSIL => "MSIL",
Self::HLSL => "HLSL",
Self::ObjC => "ObjC",
Self::ObjCXX => "ObjCXX",
Self::Swift => "Swift",
Self::AliasObj => "AliasObj",
Self::Rust => "Rust",
Self::Go => "Go",
Self::D => "D",
};

write!(f, "{str_repr}")
}
}

Expand All @@ -576,6 +595,12 @@ impl From<u8> for SourceLanguage {
0x0e => Self::JScript,
0x0f => Self::MSIL,
0x10 => Self::HLSL,
0x11 => Self::ObjC,
0x12 => Self::ObjCXX,
0x13 => Self::Swift,
0x14 => Self::AliasObj,
0x16 => Self::Rust,
0x17 => Self::Go,
0x44 => Self::D,
_ => Self::Masm, // There is no unknown, so we just force to Masm as the default.
}
Expand Down