Code Monkey home page Code Monkey logo

libosxunwind's People

Contributors

ararslan avatar ckaran avatar keno avatar staticfloat avatar vtjnash avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libosxunwind's Issues

Including license file

IIUC this should be licensed under the Apple Public Source License 2.0. Would be nice to have a license file to make this clear. Also if this is now dual licensed, that would be helpful information to have too.

Replace COMPILE_TIME_ASSERT with static_assert

Commit d470411 fails on my machine with multiple errors along the following:

In file included from src/libuwind.cxx:33:
In file included from /Users/crossbar/Documents/Programming/Julia/libosxunwind/src/UnwindCursor.hpp:41:
/Users/crossbar/Documents/Programming/Julia/libosxunwind/src/DwarfInstructions.hpp:920:2: error: redeclaration of 'compile_time_assert_failed' with a different
      type: 'int [((int)CFI_Parser<A>::kMaxRegisterNumber > (int)DW_X86_64_RET_ADDR) ? 1 : -1]' vs 'int [1]'
        COMPILE_TIME_ASSERT( (int)CFI_Parser<A>::kMaxRegisterNumber > (int)DW_X86_64_RET_ADDR );
        ^
/Users/crossbar/Documents/Programming/Julia/libosxunwind/src/InternalMacros.h:51:14: note: expanded from macro 'COMPILE_TIME_ASSERT'
                extern int compile_time_assert_failed[ ( expr ) ? 1 : -1 ] __attribute__( ( unused ) );
                           ^
/Users/crossbar/Documents/Programming/Julia/libosxunwind/src/Registers.hpp:591:2: note: previous declaration is here
        COMPILE_TIME_ASSERT( sizeof(Registers_ppc) < sizeof(unw_context_t) );
        ^
/Users/crossbar/Documents/Programming/Julia/libosxunwind/src/InternalMacros.h:51:14: note: expanded from macro 'COMPILE_TIME_ASSERT'
                extern int compile_time_assert_failed[ ( expr ) ? 1 : -1 ] __attribute__( ( unused ) );

COMPILE_TIME_ASSERT is defined in Julia/libosxunwind/src/InternalMacros.h and is intended to be a compile-time assertion function. This is precisely what static_assert, which is part of both the latest C and C++ standards, is intended for. Replacing all instances of COMPILE_TIME_ASSERT with static_assert solves this problem. The following patch does this:

From 51704b7d4fe633bc60bef174aef47044c12ce3bb Mon Sep 17 00:00:00 2001
From: Cem Karan <[email protected]>
Date: Thu, 5 May 2016 09:25:37 -0400
Subject: [PATCH] Replaced COMPILE_TIME_ASSERT() with static_assert()

The former is a version of the latter, but the latter is part of the C and C++
standards, and so is supported on all compliant compilers.

---
 src/DwarfInstructions.hpp | 10 +++++++---
 src/Registers.hpp         | 10 +++++++---
 src/UnwindCursor.hpp      |  4 +++-
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/src/DwarfInstructions.hpp b/src/DwarfInstructions.hpp
index d063ebc..6784af8 100644
--- a/src/DwarfInstructions.hpp
+++ b/src/DwarfInstructions.hpp
@@ -29,6 +29,7 @@
 #ifndef __DWARF_INSTRUCTIONS_HPP__
 #define __DWARF_INSTRUCTIONS_HPP__

+#include <assert.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -917,7 +918,8 @@ typename A::pint_t DwarfInstructions<A,R>::evaluateExpression(pint_t expression,
 template <typename A, typename R>
 int DwarfInstructions<A,R>::lastRestoreReg(const Registers_x86_64&) 
 {
-   COMPILE_TIME_ASSERT( (int)CFI_Parser<A>::kMaxRegisterNumber > (int)DW_X86_64_RET_ADDR );
+   static_assert( (int)CFI_Parser<A>::kMaxRegisterNumber > (int)DW_X86_64_RET_ADDR,
+    "(int)CFI_Parser<A>::kMaxRegisterNumber MUST be > (int)DW_X86_64_RET_ADDR" );
    return DW_X86_64_RET_ADDR; 
 }

@@ -1312,7 +1314,8 @@ compact_unwind_encoding_t DwarfInstructions<A,R>::createCompactEncodingFromProlo
 template <typename A, typename R>
 int DwarfInstructions<A,R>::lastRestoreReg(const Registers_x86&) 
 {
-   COMPILE_TIME_ASSERT( (int)CFI_Parser<A>::kMaxRegisterNumber > (int)DW_X86_RET_ADDR );
+   static_assert( (int)CFI_Parser<A>::kMaxRegisterNumber > (int)DW_X86_RET_ADDR,
+   "(int)CFI_Parser<A>::kMaxRegisterNumber MUST be > (int)DW_X86_RET_ADDR" );
    return DW_X86_RET_ADDR; 
 }

@@ -1688,7 +1691,8 @@ compact_unwind_encoding_t DwarfInstructions<A,R>::createCompactEncodingFromProlo
 template <typename A, typename R>
 int DwarfInstructions<A,R>::lastRestoreReg(const Registers_ppc&) 
 {
-   COMPILE_TIME_ASSERT( (int)CFI_Parser<A>::kMaxRegisterNumber > (int)UNW_PPC_SPEFSCR );
+   static_assert( (int)CFI_Parser<A>::kMaxRegisterNumber > (int)UNW_PPC_SPEFSCR,
+   "(int)CFI_Parser<A>::kMaxRegisterNumber MUST be > (int)UNW_PPC_SPEFSCR" );
    return UNW_PPC_SPEFSCR; 
 }

diff --git a/src/Registers.hpp b/src/Registers.hpp
index ad45ec8..c22d025 100644
--- a/src/Registers.hpp
+++ b/src/Registers.hpp
@@ -29,6 +29,7 @@
 #ifndef __REGISTERS_HPP__
 #define __REGISTERS_HPP__

+#include <assert.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -106,7 +107,8 @@ private:

 inline Registers_x86::Registers_x86(const void* registers)
 {
-   COMPILE_TIME_ASSERT( sizeof(Registers_x86) < sizeof(unw_context_t) );
+   static_assert( sizeof(Registers_x86) < sizeof(unw_context_t),
+   "sizeof(Registers_x86) MUST be < sizeof(unw_context_t)" );
    fRegisters = *((GPRs*)registers); 
 }

@@ -310,7 +312,8 @@ private:

 inline Registers_x86_64::Registers_x86_64(const void* registers)
 {
-   COMPILE_TIME_ASSERT( sizeof(Registers_x86_64) < sizeof(unw_context_t) );
+   static_assert( sizeof(Registers_x86_64) < sizeof(unw_context_t),
+   "sizeof(Registers_x86_64) MUST be < sizeof(unw_context_t)" );
    fRegisters = *((GPRs*)registers); 
 }

@@ -588,7 +591,8 @@ private:

 inline Registers_ppc::Registers_ppc(const void* registers) 
 {
-   COMPILE_TIME_ASSERT( sizeof(Registers_ppc) < sizeof(unw_context_t) );
+   static_assert( sizeof(Registers_ppc) < sizeof(unw_context_t) ,
+                 "sizeof(Registers_ppc) MUST be < sizeof(unw_context_t)");
    fRegisters = *((ppc_thread_state_t*)registers); 
    fFloatRegisters = *((ppc_float_state_t*)((char*)registers+160));
    memcpy(fVectorRegisters, ((char*)registers+424), sizeof(fVectorRegisters));
diff --git a/src/UnwindCursor.hpp b/src/UnwindCursor.hpp
index 637ef7b..e315ac3 100644
--- a/src/UnwindCursor.hpp
+++ b/src/UnwindCursor.hpp
@@ -29,6 +29,7 @@
 #ifndef __UNWINDCURSOR_HPP__
 #define __UNWINDCURSOR_HPP__

+#include <assert.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -405,7 +406,8 @@ template <typename A, typename R>
 UnwindCursor<A,R>::UnwindCursor(unw_context_t* context, A& as)
   : fUnwindInfoMissing(false), fIsSignalFrame(false), fForceDwarf(false), fRegisters(context), fAddressSpace(as)
 {
-   COMPILE_TIME_ASSERT( sizeof(UnwindCursor<A,R>) < sizeof(unw_cursor_t) );
+   static_assert( sizeof(UnwindCursor<A,R>) < sizeof(unw_cursor_t),
+   "sizeof(UnwindCursor<A,R>) MUST be < sizeof(unw_cursor_t)" );

    bzero(&fInfo, sizeof(fInfo));
 }
-- 
2.8.2

Cannot build master on OS X 10.14

This line breaks the compilation with clang

LDFLAGS_add = -nodefaultlibs -Wl,-upward-lSystem -Wl,-umbrella,System -lstdc++

to use stdc++ on OS X, it should be -stdlib=libstdc++ rather than lstdc++

Ref: spack/spack#5942

versions

  • clang: Apple LLVM version 10.0.0 (clang-1000.11.45.2)
  • OS X: 10.14 (18A391)

I was able to build master branch on the same Mac, but it breaks somehow after I upgrade to Mojave.

Use of private function __dyld_find_unwind_sections

Just a heads up for anyone who wish to use this library of OSX and ship on the Mac App Store.
Since it uses private functions (e.g. __dyld_find_unwind_sections), it will get rejected by the app store:

"Your app uses of references the following non-public APIs:

__dyld_find_unwind_sections

The use of non-public APIs is not permitted on the App Store, because it can lead to a poor user experience should these APIs change.
"

Julia build fails on OS X with latest master

From @protogeezer on February 26, 2016 16:55

build with fresh git clone fails while building libosxunwind...

et-imac-retina:julia sjbespa$ ./clone-julia julia-0.5-master
Cloning into 'julia-0.5-master'...
remote: Counting objects: 169353, done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 169353 (delta 4), reused 0 (delta 0), pack-reused 169341
Receiving objects: 100% (169353/169353), 97.26 MiB | 8.92 MiB/s, done.
Resolving deltas: 100% (129141/129141), done.
Checking connectivity... done.

et-imac-retina:julia sjbespa$ cd julia-0.5-master

et-imac-retina:julia-0.5-master sjbespa$ make -j4
Creating usr/etc/julia/juliarc.jl
Copying in usr/share/doc/julia/examples
Copying in usr/share/man/man1/julia.1
...
patching file TESTS/bug_1315_double.c
patching file TESTS/bug_1315_single.c
make[2]: Circular src/libuwind.cxx <- src/libuwind.cxx.o dependency dropped.
clang: error: no such file or directory: 'libosxunwind.a'
make[2]: *** [libosxunwind.dylib] Error 1
make[2]: *** Waiting for unfinished jobs....

Copied from original issue: JuliaLang/julia#15255

Library doesn't build w/ ICC on OSX

Following the discussion at JuliaLang/julia#9145, the .s extension must be capitalized (and the Makefile changed accordingly) in order for ICC to be able to build it on OSX.
I'm not sure if doing this wouldn't break the build on other OSes though...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.