Skip to content

Commit

Permalink
v1.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
nico committed May 18, 2020
2 parents 1108fcc + fd9f644 commit eaf1699
Show file tree
Hide file tree
Showing 13 changed files with 538 additions and 166 deletions.
2 changes: 1 addition & 1 deletion RELEASING
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ Push new release branch:
# Push the 1.0.0.git change on master too:
git checkout master; git push origin master
6. add binaries to https://github.com/nico/demumble/releases
build them with `./dist.py`
build them with `./dist.py` (on the release branch)
8 changes: 4 additions & 4 deletions demumble.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "llvm/Demangle/Demangle.h"

const char kDemumbleVersion[] = "1.2.1";
const char kDemumbleVersion[] = "1.2.2";

static int print_help(FILE* out) {
fprintf(out,
Expand Down Expand Up @@ -34,9 +34,9 @@ static void print_demangled(const char* format, const char* s) {
}
}

static bool is_mangle_char_posix(char c) {
static bool is_mangle_char_itanium(char c) {
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
(c >= '0' && c <= '9') || c == '_';
(c >= '0' && c <= '9') || c == '_' || c == '$';
}

static bool is_mangle_char_win(char c) {
Expand Down Expand Up @@ -116,7 +116,7 @@ int main(int argc, char* argv[]) {
while (cur + n_sym != end && is_mangle_char_win(cur[n_sym]))
++n_sym;
else if (is_plausible_itanium_prefix(cur))
while (cur + n_sym != end && is_mangle_char_posix(cur[n_sym]))
while (cur + n_sym != end && is_mangle_char_itanium(cur[n_sym]))
++n_sym;
else {
if (print_mode == kPrintAll)
Expand Down
3 changes: 3 additions & 0 deletions demumble_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
('demumble -mb < _Z1fv!foo_bar', '"f()" (_Z1fv)\n'),
('demumble --foo < bar', re.compile(".*unrecognized option `--foo'.*")),
('demumble -bx < bar', re.compile(".*unrecognized option `x' in `-bx'.*")),
('demumble < _ZZ3fooiENK3$_0clEi',
'foo(int)::$_0::operator()(int) const\n'),
('demumble .?AVNet@@', "class Net `RTTI Type Descriptor Name'\n"),
]

status = 0
Expand Down
14 changes: 7 additions & 7 deletions dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

# Builds demumble for Mac, Linux, Windows. Must run on a Mac.
# Needs a chromium checkout at ~/src/chrome/src that was synced with
# target_os=['win'] to get the Windows toolchain. You must run
# `build/linux/sysroot_scripts/install-sysroot.py --arch amd64` once to
# get the linux toolchain.
# target_os=['win'] to get the Windows toolchain, and to get lld.
# You must run `build/linux/sysroot_scripts/install-sysroot.py --arch amd64`
# once to get the linux toolchain.

# Also needs a GN build of llvm at ~/src/llvm-project/out/gn for llvm-strip
# for stripping the Linux binary.
Expand Down Expand Up @@ -34,6 +34,9 @@
clangxx = crsrc + '/third_party/llvm-build/Release+Asserts/bin/clang++'
lldlink = crsrc + '/third_party/llvm-build/Release+Asserts/bin/lld-link'

# FIXME: https://chromium-review.googlesource.com/c/chromium/src/+/1214943
# has a way to build eu-strip on macOS, which is arguably a smaller dep
# than llvm-strip.
linux_strip = os.path.join(os.path.expanduser('~'),
'src/llvm-project/out/gn/bin/llvm-strip')

Expand All @@ -58,7 +61,7 @@ def buildir(newdir):
devnull = open(os.devnull,"w")

# Linux.
linux_sysroot = crsrc + '/build/linux/debian_jessie_amd64-sysroot'
linux_sysroot = crsrc + '/build/linux/debian_sid_amd64-sysroot'
cflags = [ '--sysroot', linux_sysroot, '--target=x86_64-linux-gnu', ]
ldflags = ['-fuse-ld=lld'] + cflags
with buildir('buildlinux'):
Expand All @@ -70,9 +73,6 @@ def buildir(newdir):
'-DCMAKE_SYSTEM_NAME=Linux',
], stdout=devnull)
subprocess.check_call(['ninja', 'demumble'])
# FIXME: https://chromium-review.googlesource.com/c/chromium/src/+/1214943
# has a way to build eu-strip on macOS, which is arguably a smaller dep
# than llvm-strip.
subprocess.check_call([linux_strip, 'demumble'])
subprocess.check_call(['zip', '-q9', 'demumble-linux.zip', 'demumble'])
subprocess.check_call(['mv', 'demumble-linux.zip', '..'])
Expand Down
9 changes: 8 additions & 1 deletion third_party/llvm/include/llvm/Demangle/Demangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@ char *itaniumDemangle(const char *mangled_name, char *buf, size_t *n,
int *status);


enum MSDemangleFlags { MSDF_None = 0, MSDF_DumpBackrefs = 1 << 0 };
enum MSDemangleFlags {
MSDF_None = 0,
MSDF_DumpBackrefs = 1 << 0,
MSDF_NoAccessSpecifier = 1 << 1,
MSDF_NoCallingConvention = 1 << 2,
MSDF_NoReturnType = 1 << 3,
MSDF_NoMemberType = 1 << 4,
};
char *microsoftDemangle(const char *mangled_name, char *buf, size_t *n,
int *status, MSDemangleFlags Flags = MSDF_None);

Expand Down
7 changes: 0 additions & 7 deletions third_party/llvm/include/llvm/Demangle/DemangleConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@
#ifndef LLVM_DEMANGLE_COMPILER_H
#define LLVM_DEMANGLE_COMPILER_H

#ifdef _MSC_VER
// snprintf is implemented in VS 2015
#if _MSC_VER < 1900
#define snprintf _snprintf_s
#endif
#endif

#ifndef __has_feature
#define __has_feature(x) 0
#endif
Expand Down
Loading

0 comments on commit eaf1699

Please sign in to comment.