Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

Commit

Permalink
mulle_lldb_70 squashed
Browse files Browse the repository at this point in the history
and four conflicts resolved
  • Loading branch information
codeon-nat committed Mar 21, 2019
1 parent 8e6bea5 commit 3a8bf26
Show file tree
Hide file tree
Showing 42 changed files with 3,284 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
.*.swp
.sw?
# OS X specific files.
.DS_store
.DS_Store
DerivedData/

# Remote build configuration files.
Expand Down
4 changes: 4 additions & 0 deletions CODE_OWNERS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,7 @@ D: Test suite
N: Pavel Labath
E: labath@google.com
D: Linux, Android

N: Nat!
E: nat@codeon.de
D: MulleObjC
17 changes: 17 additions & 0 deletions INSTALL.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,20 @@ For instructions to build LLDB on Linux, or more details about supported
compiler versions, other dependencies, and build flags, see:

http://lldb.llvm.org/build.html


## Build fix for Xcode with mulle_lldb_40

The script will try to download and bail on `release_40` not being there

Fix it like so:

```
cd llvm
git fetch origin refs/heads/release_40
git checkout -b release_40 f3d3277bb713bb8aced9a7ac2e9b05c52d2844ee

cd tools/clang
git fetch origin refs/heads/release_40
git checkout -b release_40 21fe7e8f8ab44b67238af7bf9ba9d8afdf0c0e2c
```
1 change: 1 addition & 0 deletions MULLE_LLDB_VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.0.0.3
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[![Codeon Gmbh](CodeonLogo.png)](//www.codeon.de)

# mulle-lldb

This is a debugger for [mulle-objc](//www.mulle-kybernetik.com/weblog/2015/mulle_objc_a_new_objective_c_.html)
runtime.

> See [README.txt](README.txt) for more information about lldb
The debugger is built together with the [mulle-clang](https://github.com/Codeon-GmbH/mulle-clang) compiler. See the compiler for more details.


## Author

[Nat!](//www.mulle-kybernetik.com/weblog) for
[Codeon GmbH](//www.codeon.de)
182 changes: 182 additions & 0 deletions bin/migrate-to-next-release
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
#!/usr/bin/env bash

[ "${TRACE}" = "YES" ] && set -x && : "$0" "$@"

OLD_LLVM_BRANCH="release_70"
OLD_MULLE_DEV_BRANCH="mulle_lldb_70"
NEW_LLVM_BRANCH="release_80"
NEW_MULLE_DEV_BRANCH="mulle_lldb_80"

LLVM_REMOTE="llvm"

BEFOREFILE=.before-tags.txt
AFTERFILE=.after-tags.txt
SOURCEDIRS="include/ source/"


#
# this function should be identical in mulle-clang/mulle-lldb
# If you edit them edit the corresponding file too
#

####### >-> DONT EDIT >->

migrate()
{
[ ! -e "MULLE_LLDB_VERSION" ] && echo "cd to the root of mulle-lldb" >&2 && exit 1

if ! git rev-parse --verify "${OLD_MULLE_DEV_BRANCH}" > /dev/null 2>&1
then
echo "Branch ${OLD_MULLE_DEV_BRANCH} must exist" >&2 && exit 1
fi


if git rev-parse --verify "${NEW_MULLE_DEV_BRANCH}" > /dev/null 2>&1
then
echo "Branch ${NEW_MULLE_DEV_BRANCH} must not exist yet" >&2 && exit 1
fi

#
# remove garbage tmp if present
#
if git rev-parse --verify "tmp_${NEW_MULLE_DEV_BRANCH}" > /dev/null 2>&1
then
git branch -D "tmp_${NEW_MULLE_DEV_BRANCH}" || exit 1
fi

#
# remove garbage tag if present
#
if git rev-parse --verify "squashed_${OLD_MULLE_DEV_BRANCH}" > /dev/null 2>&1
then
git tag -d "squashed_${OLD_MULLE_DEV_BRANCH}" || exit 1
fi

#
# get new version from LLVM (github)
#
if ! git ls-remote --exit-code llvm > /dev/null
then
git remote add "${LLVM_REMOTE}" https://github.com/llvm-mirror/lldb.git 2> /dev/null
fi
git fetch "${LLVM_REMOTE}" || exit 1

if ! git rev-parse --verify "${LLVM_REMOTE}/${OLD_LLVM_BRANCH}" > /dev/null 2>&1
then
echo "Branch ${LLVM_REMOTE}/${OLD_LLVM_BRANCH} must exist" >&2 && exit 1
fi


# find the place we forked from last time
ancestor="`git merge-base "${LLVM_REMOTE}/${OLD_LLVM_BRANCH}" "${OLD_MULLE_DEV_BRANCH}"`"
[ -z "${ancestor}" ] && echo "No common ancestor found" >&2 && exit 1

# create a new temporary branch to contain squashed patchset
echo "### 1: Checkout" >&2 &&

git checkout -b "tmp_${NEW_MULLE_DEV_BRANCH}" "${ancestor}" || exit 1

#
# squash everything into new branch
# this helps weed out re-edits and commits that weren't useful
# easing the conflict resolution
#
# ???? git merge --squash "tmp_${OLD_MULLE_DEV_BRANCH}"
echo "### 2: Squash Merge" >&2

git merge --squash "${OLD_MULLE_DEV_BRANCH}" || exit 1


# commit stuff
echo "### 3: Commit" >&2

git commit -m "${OLD_MULLE_DEV_BRANCH} squashed" || exit 1

# remember until where did we squash the old branch (in case of
# future edits)
echo "### 4: Tag" >&2

git tag "squashed_${OLD_MULLE_DEV_BRANCH}" "${OLD_MULLE_DEV_BRANCH}" || exit 1

# count our change marker texts
grep -R '@mulle-' ${SOURCEDIRS} > "${BEFOREFILE}" || exit 1

#
# Now get the new stuff
#
echo "### 5: Checkout" >&2

git checkout -b "${NEW_MULLE_DEV_BRANCH}" "${LLVM_REMOTE}/${NEW_LLVM_BRANCH}" || exit 1

echo "### 6: Cherry pick" >&2

if ! git cherry-pick "tmp_${NEW_MULLE_DEV_BRANCH}"
then
git status -s
exit 1
fi
}


cleanup()
{
# count our change marker texts again
grep -R '@mulle-' ${SOURCEDIRS} > "${AFTERFILE}" || exit 1

local before
local after

before="`cat "${BEFOREFILE}" `"
after="`cat "${AFTERFILE}" `"

if [ "${before}" != "${after}" ]
then
echo "Some @mulle- tags got lost in the merge" >&2
echo "before : ${BEFOREFILE}" >&2
echo "after : ${AFTERFILE}" >&2
diff "${BEFOREFILE}" "${AFTERFILE}" >&2
exit 1
fi

#
# resolve conflicts manually.
# Check with grep '@mulle-objc' ... | wc -l, that all changes are present
#
echo "### 7: Tmp branch delete" >&2

git branch -D "tmp_${NEW_MULLE_DEV_BRANCH}" || exit 1
rm "${AFTERFILE}" "${BEFOREFILE}"
}


####### <-< DONT EDIT <-<


#
# since an old version of this script gets checked out over the new one
# try to have bash parsed everything already
#
#
# since an old version of this script gets checked out over the new one
# try to have bash parsed everything already
#
[ ! -e "MULLE_LLDB_VERSION" ] && echo "cd to the root of mulle-lldb" >&2 && exit 1


case "$1" in
'continue'|'cleanup')
cleanup
;;

*)
if [ ! -f "${AFTERFILE}" ]
then
migrate
fi
cleanup
;;
esac


migrate

3 changes: 3 additions & 0 deletions include/lldb/Symbol/ClangASTContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,9 @@ class ClangASTContext : public TypeSystem {
const char *name, // the full symbol name as seen in the symbol table
// (lldb::opaque_compiler_type_t type, "-[NString
// stringWithCString:]")
/// @mulle-objc@ add this for parameter names >
std::vector<clang::ParmVarDecl *> &function_param_decls,
/// @mulle-objc@ add this for parameter names <
const CompilerType &method_compiler_type, lldb::AccessType access,
bool is_artificial, bool is_variadic);

Expand Down
4 changes: 4 additions & 0 deletions include/lldb/Target/LanguageRuntime.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ class LanguageRuntime : public PluginInterface {

Process *GetProcess() { return m_process; }

// @mulle-lldb@ code from swift-lldb >
virtual bool IsSymbolARuntimeThunk(const Symbol &symbol) { return false; }
// @mulle-lldb@ code from swift-lldb <

Target &GetTargetRef() { return m_process->GetTarget(); }

virtual lldb::BreakpointResolverSP
Expand Down
4 changes: 4 additions & 0 deletions include/lldb/Target/ObjCLanguageRuntime.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class ObjCLanguageRuntime : public LanguageRuntime {
eObjC_VersionUnknown = 0,
eAppleObjC_V1 = 1,
eAppleObjC_V2 = 2
// @mulle-lldb@ add runtime enum >
, eMulleObjC_V1 = 48
// @mulle-lldb@ add runtime enum <
};

typedef lldb::addr_t ObjCISA;
Expand Down Expand Up @@ -218,6 +221,7 @@ class ObjCLanguageRuntime : public LanguageRuntime {
virtual bool HasReadObjCLibrary() = 0;

virtual lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,
StackID &return_stack_id,
bool stop_others) = 0;

lldb::addr_t LookupInMethodCache(lldb::addr_t class_addr, lldb::addr_t sel);
Expand Down
6 changes: 6 additions & 0 deletions include/lldb/Target/Process.h
Original file line number Diff line number Diff line change
Expand Up @@ -3132,6 +3132,12 @@ class Process : public std::enable_shared_from_this<Process>,
std::unique_ptr<UtilityFunction> m_dlopen_utility_func_up;
std::once_flag m_dlopen_utility_func_flag_once;

// @mulle-lldb@ avoid failed threadplan calling formatters that execute a threadplan again >
public:
bool isThreadPlanLocked( void);
protected:
// @mulle-lldb@ avoid failed threadplan calling formatters that execute a threadplan again <

size_t RemoveBreakpointOpcodesFromBuffer(lldb::addr_t addr, size_t size,
uint8_t *buf) const;

Expand Down
7 changes: 7 additions & 0 deletions source/API/SystemInitializerFull.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
#include "Plugins/Language/ObjC/ObjCLanguage.h"
#include "Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h"
#include "Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h"
// @mulle-lldb@ Initialize runtime >
#include "Plugins/LanguageRuntime/ObjC/MulleObjCRuntime/MulleObjCRuntimeV1.h"
// @mulle-lldb@ Initialize runtime <
#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h"
#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h"
#include "Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h"
Expand Down Expand Up @@ -354,6 +357,10 @@ SystemInitializerFull::Initialize(const InitializerOptions &options) {
EmulateInstructionPPC64::Initialize();
SymbolFileDWARFDebugMap::Initialize();
ItaniumABILanguageRuntime::Initialize();
// @mulle-lldb@ Initialize runtime >
// initialize ahead of AppleRuntimes, so we get searched first
MulleObjCRuntimeV1::Initialize();
// @mulle-lldb@ Initialize runtime <
AppleObjCRuntimeV2::Initialize();
AppleObjCRuntimeV1::Initialize();
SystemRuntimeMacOSX::Initialize();
Expand Down
41 changes: 29 additions & 12 deletions source/DataFormatters/ValueObjectPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,8 @@ bool ValueObjectPrinter::PrintChildrenOneLiner(bool hide_names) {
return true;
}

// @mulle-lldb@ >> rewritten function to not hit DataVisualization::ShouldPrintAsOneLiner

void ValueObjectPrinter::PrintChildrenIfNeeded(bool value_printed,
bool summary_printed) {
// this flag controls whether we tried to display a description for this
Expand All @@ -759,16 +761,35 @@ void ValueObjectPrinter::PrintChildrenIfNeeded(bool value_printed,
auto curr_ptr_depth = m_ptr_depth;
bool print_children =
ShouldPrintChildren(is_failed_description, curr_ptr_depth);

// DataVisualization::ShouldPrintAsOneLiner often called for
// print_oneline (see below) is very expensive, so use an
// early exit, if we are not printing children (also easier to read)

if (!print_children) {
if (m_curr_depth >= m_options.m_max_depth && IsAggregate() &&
ShouldPrintValueObject()) {
m_stream->PutCString("{...}\n");
} else
m_stream->EOL();
return;
}

//
// TODO: maybe move the next line to #1#, but its unclear to me if
// DataVisualization::ShouldPrintAsOneLiner can modify *m_valobj
//
bool print_oneline =
(curr_ptr_depth.CanAllowExpansion() || m_options.m_show_types ||
!m_options.m_allow_oneliner_mode || m_options.m_flat_output ||
(m_options.m_pointer_as_array) || m_options.m_show_location)
? false
: DataVisualization::ShouldPrintAsOneLiner(*m_valobj);

bool is_instance_ptr = IsInstancePointer();
uint64_t instance_ptr_value = LLDB_INVALID_ADDRESS;

if (print_children && is_instance_ptr) {
if (is_instance_ptr) {
instance_ptr_value = m_valobj->GetValueAsUnsigned(0);
if (m_printed_instance_pointers->count(instance_ptr_value)) {
// we already printed this instance-is-pointer thing, so don't expand it
Expand All @@ -781,19 +802,15 @@ void ValueObjectPrinter::PrintChildrenIfNeeded(bool value_printed,
instance_ptr_value); // remember this guy for future reference
}

if (print_children) {
if (print_oneline) {
m_stream->PutChar(' ');
PrintChildrenOneLiner(false);
m_stream->EOL();
} else
PrintChildren(value_printed, summary_printed, curr_ptr_depth);
} else if (m_curr_depth >= m_options.m_max_depth && IsAggregate() &&
ShouldPrintValueObject()) {
m_stream->PutCString("{...}\n");
} else
// #1#
if (print_oneline) {
m_stream->PutChar(' ');
PrintChildrenOneLiner(false);
m_stream->EOL();
} else
PrintChildren(value_printed, summary_printed, curr_ptr_depth);
}
// @mulle-lldb@ << rewritten function to not hit DataVisualization::ShouldPrintAsOneLiner

bool ValueObjectPrinter::ShouldPrintValidation() {
return m_options.m_run_validator;
Expand Down
Loading

0 comments on commit 3a8bf26

Please sign in to comment.