Skip to content

Commit

Permalink
Merge branch 'dev' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
thestr4ng3r committed Feb 15, 2023
2 parents e70aa0f + 30cd6b0 commit 1ed04d6
Show file tree
Hide file tree
Showing 32 changed files with 1,380 additions and 928 deletions.
1 change: 1 addition & 0 deletions .builds/freebsd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ sources:
- https://github.com/rizinorg/rizin#stable
- https://github.com/rizinorg/rz-ghidra
- https://github.com/rizinorg/rizin-testbins
hottub_trigger: '.*'
tasks:
- rizinbuild: |
cd rizin
Expand Down
1 change: 1 addition & 0 deletions .builds/openbsd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ sources:
- https://github.com/rizinorg/rizin#stable
- https://github.com/rizinorg/rz-ghidra
- https://github.com/rizinorg/rizin-testbins
hottub_trigger: '.*'
tasks:
- rizinbuild: |
cd rizin
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Checkout submodules
run: |
git submodule init
Expand All @@ -40,10 +40,10 @@ jobs:
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
- name: Preparing msvc toolchain
uses: ilammy/msvc-dev-cmd@v1
with:
Expand All @@ -52,14 +52,14 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install meson ninja PyYAML
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
repository: rizinorg/rizin
path: rizin
ref: stable
- name: Extract rizin version
shell: pwsh
run: echo "##[set-output name=branch;]$( python sys\\version.py )"
run: echo "branch=$(python sys/version.py)" >> $Env:GITHUB_OUTPUT
id: extract_version
working-directory: rizin
- name: Build with meson + ninja
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ on:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
language: ['cpp']

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
Expand All @@ -30,14 +30,14 @@ jobs:
git submodule init
git submodule update
- uses: actions/setup-python@v1
- uses: actions/setup-python@v4
with:
python-version: 3.8.x
python-version: 3.10.x

- name: apt dependencies
run: |
sudo apt-get --assume-yes update
sudo apt-get --assume-yes install ninja-build libgraphviz-dev bison flex qt5-default
sudo apt-get --assume-yes install ninja-build libgraphviz-dev bison flex qtbase5-dev cmake
- name: py dependencies
run: |
Expand All @@ -53,7 +53,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

Expand All @@ -64,4 +64,4 @@ jobs:
make
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
10 changes: 5 additions & 5 deletions .github/workflows/coverity-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ on:

jobs:
latest:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v1
- uses: actions/setup-python@v4
with:
python-version: 3.7.x
python-version: 3.10.x

- name: Download Coverity Build Tool
run: |
Expand All @@ -28,7 +28,7 @@ jobs:
sudo chmod -R go-w /usr/share
- name: apt dependencies
run: sudo apt-get install ninja-build libgraphviz-dev bison flex qt5-default
run: sudo apt-get install ninja-build libgraphviz-dev bison flex qtbase5-dev qt5-qmake cmake

- name: py dependencies
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags/deploy-test-') || startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Checkout submodules
run: |
git submodule init
Expand All @@ -35,10 +35,10 @@ jobs:
tarball
]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Extract version
id: extract_version
run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}
run: echo "version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand All @@ -49,7 +49,7 @@ jobs:
release_name: Release ${{ steps.extract_version.outputs.version }}
draft: true
prerelease: false
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
- name: Display structure of downloaded files
run: ls -R
- name: Upload rz-ghidra src tarball
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ on:

jobs:
licenses:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: REUSE Compliance Check
uses: fsfe/reuse-action@v1.1
uses: fsfe/reuse-action@v1
13 changes: 4 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,19 @@ jobs:
include:
- os: linux
name: X86_64
dist: focal
dist: jammy
- os: linux
name: S390X
arch: s390x
dist: focal
dist: jammy
- os: linux
name: PPC64
arch: ppc64le
dist: focal
dist: jammy
- os: linux
name: ARM64
arch: arm64
dist: focal
allow_failures:
- os: linux
name: S390X
arch: s390x
dist: focal
dist: jammy

addons:
apt:
Expand Down
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ set(CORE_SOURCE
src/RizinPrintC.cpp
src/RzCoreMutex.h
src/RzCoreMutex.cpp
src/rz_ghidra.h)
src/PrettyXmlEncode.h
src/PrettyXmlEncode.cpp
src/rz_ghidra.h
src/rz_ghidra_internal.h)

if(BUILD_SLEIGH_PLUGIN)
set(ASM_SOURCE
Expand Down
2 changes: 2 additions & 0 deletions ghidra/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# Base of everything
set(SOURCE_BASE_CXX
# xml.cc // generated by yacc task
marshal.cc
space.cc
float.cc
address.cc
Expand Down Expand Up @@ -46,6 +47,7 @@ set(SOURCE_DECOMPILER_CXX
funcdata.cc
funcdata_block.cc
funcdata_varnode.cc
unionresolve.cc
funcdata_op.cc
pcodeinject.cc
heritage.cc
Expand Down
2 changes: 1 addition & 1 deletion ghidra/ghidra
Submodule ghidra updated 7367 files
57 changes: 36 additions & 21 deletions src/CodeXMLParse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,32 +139,47 @@ void AnnotateCommentOffset(ANNOTATOR_PARAMS)
void AnnotateColor(ANNOTATOR_PARAMS)
{
pugi::xml_attribute attr = node.attribute("color");
if (attr.empty())
if(attr.empty())
return;

std::string color = attr.as_string();
if (color == "")
int color = attr.as_int(-1);
if(color < 0)
return;

RSyntaxHighlightType type;
if (color == "keyword")
type = RZ_SYNTAX_HIGHLIGHT_TYPE_KEYWORD;
else if (color == "comment")
type = RZ_SYNTAX_HIGHLIGHT_TYPE_COMMENT;
else if (color == "type")
type = RZ_SYNTAX_HIGHLIGHT_TYPE_DATATYPE;
else if (color == "funcname")
type = RZ_SYNTAX_HIGHLIGHT_TYPE_FUNCTION_NAME;
else if (color == "param")
type = RZ_SYNTAX_HIGHLIGHT_TYPE_FUNCTION_PARAMETER;
else if (color == "var")
type = RZ_SYNTAX_HIGHLIGHT_TYPE_LOCAL_VARIABLE;
else if (color == "const")
type = RZ_SYNTAX_HIGHLIGHT_TYPE_CONSTANT_VARIABLE;
else if (color == "global")
type = RZ_SYNTAX_HIGHLIGHT_TYPE_GLOBAL_VARIABLE;
else
return;
switch(color)
{
case Emit::syntax_highlight::keyword_color:
type = RZ_SYNTAX_HIGHLIGHT_TYPE_KEYWORD;
break;
case Emit::syntax_highlight::comment_color:
type = RZ_SYNTAX_HIGHLIGHT_TYPE_COMMENT;
break;
case Emit::syntax_highlight::type_color:
type = RZ_SYNTAX_HIGHLIGHT_TYPE_DATATYPE;
break;
case Emit::syntax_highlight::funcname_color:
type = RZ_SYNTAX_HIGHLIGHT_TYPE_FUNCTION_NAME;
break;
case Emit::syntax_highlight::var_color:
type = RZ_SYNTAX_HIGHLIGHT_TYPE_LOCAL_VARIABLE;
break;
case Emit::syntax_highlight::const_color:
type = RZ_SYNTAX_HIGHLIGHT_TYPE_CONSTANT_VARIABLE;
break;
case Emit::syntax_highlight::param_color:
type = RZ_SYNTAX_HIGHLIGHT_TYPE_FUNCTION_PARAMETER;
break;
case Emit::syntax_highlight::global_color:
type = RZ_SYNTAX_HIGHLIGHT_TYPE_GLOBAL_VARIABLE;
break;
case Emit::syntax_highlight::no_color:
case Emit::syntax_highlight::error_color:
case Emit::syntax_highlight::special_color:
default:
return;
}

RzCodeAnnotation annotation = {};
annotation.type = RZ_CODE_ANNOTATION_TYPE_SYNTAX_HIGHLIGHT;
annotation.syntax_highlight.type = type;
Expand Down
37 changes: 37 additions & 0 deletions src/PrettyXmlEncode.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// SPDX-FileCopyrightText: 2023 Florian Märkl <info@florianmaerkl.de>
// SPDX-License-Identifier: LGPL-3.0-or-later

#include "PrettyXmlEncode.h"

void PrettyXmlEncode::indent()
{
for(int i = 0; i < depth; i++)
outStream << " ";
}

void PrettyXmlEncode::openElement(const ElementId &elemId)
{
if(elementTagIsOpen)
outStream << ">\n";
else
elementTagIsOpen = true;
indent();
depth++;
outStream << '<' << elemId.getName();
}

void PrettyXmlEncode::closeElement(const ElementId &elemId)
{
depth--;
if(elementTagIsOpen)
{
outStream << "/>\n";
elementTagIsOpen = false;
}
else
{
indent();
outStream << "</" << elemId.getName() << ">\n";
}
}

21 changes: 21 additions & 0 deletions src/PrettyXmlEncode.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-FileCopyrightText: 2023 Florian Märkl <info@florianmaerkl.de>
// SPDX-License-Identifier: LGPL-3.0-or-later

#ifndef PRETTY_XML_ENCODE_H
#define PRETTY_XML_ENCODE_H

#include <marshal.hh>

class PrettyXmlEncode: public XmlEncode
{
private:
int depth = 0;
void indent();

public:
PrettyXmlEncode(std::ostream &s) : XmlEncode(s) {}
void openElement(const ElementId &elemId) override;
void closeElement(const ElementId &elemId) override;
};

#endif
2 changes: 1 addition & 1 deletion src/RizinArchitecture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ std::string FilenameFromCore(RzCore *core)
}

RizinArchitecture::RizinArchitecture(RzCore *core, const std::string &sleigh_id)
: SleighArchitecture(FilenameFromCore(core), sleigh_id.empty() ? SleighIdFromCore(core) : sleigh_id, &cout),
: SleighArchitecture(FilenameFromCore(core), sleigh_id.empty() ? SleighIdFromCore(core) : sleigh_id, &std::cout),
coreMutex(core)
{
}
Expand Down
4 changes: 2 additions & 2 deletions src/RizinCommentDatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class RizinCommentDatabase : public CommentDatabase
CommentSet::const_iterator beginComment(const Address &fad) const override;
CommentSet::const_iterator endComment(const Address &fad) const override;

void saveXml(ostream &s) const override { cache.saveXml(s); }
void restoreXml(const Element *el, const AddrSpaceManager *trans) override { throw LowlevelError("commentdb::restoreXml unimplemented"); }
void encode(Encoder &encoder) const override { cache.encode(encoder); }
void decode(Decoder &decoder) override { throw LowlevelError("CommentDatabaseGhidra::decode unimplemented"); }
};

#endif //RZ_GHIDRA_RizinCOMMENTDATABASE_H
Loading

0 comments on commit 1ed04d6

Please sign in to comment.