diff --git a/.appveyor.yml b/.appveyor.yml index aaf6c86efa736..eb8ad6fa18fdc 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -8,6 +8,7 @@ skip_tags: true branches: only: - master + - decompiler-refactoring # Environment variables environment: diff --git a/.github/workflows/centos6.yml b/.github/workflows/centos6.yml index 79f4e64942457..828f7b8d552b1 100644 --- a/.github/workflows/centos6.yml +++ b/.github/workflows/centos6.yml @@ -7,6 +7,7 @@ on: - 'prerelease*' - 'release-*' - 'centos*' + - 'decompiler-refactoring' schedule: - cron: '0 18 * * 1,3,5' # Three-weekly at 18:00 UTC on Monday, Wednesday, and Friday diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 72418b5f7e26a..41a0239cabd34 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,6 +7,7 @@ on: - 'pre-release*' - 'prerelease*' - 'release*' + - 'decompiler-refactoring' jobs: build: diff --git a/.github/workflows/newshell-treesitter-tests.yml b/.github/workflows/newshell-treesitter-tests.yml index 4a9e339c63c92..d342706eb45fa 100644 --- a/.github/workflows/newshell-treesitter-tests.yml +++ b/.github/workflows/newshell-treesitter-tests.yml @@ -10,6 +10,7 @@ on: - 'shlr/radare2-shell-parser/**/*' branches: - master + - decompiler-refactoring jobs: build: diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index cf5598a18c738..1734e6ee7f5ac 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -4,6 +4,7 @@ on: pull_request: branches: - master + - decompiler-refactoring jobs: build: diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 259dedb3b7df2..a0bcc3e04f2d7 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -7,6 +7,7 @@ on: pull_request: branches: - master + - decompiler-refactoring jobs: build: diff --git a/.travis.yml b/.travis.yml index b1cbd344baf74..fcdb985f14814 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ branches: - master - /^release-.*$/ - /^prerelease-.*$/ + - decompiler-refactoring services: - docker diff --git a/libr/core/cannotated_code.c b/libr/core/cannotated_code.c index 113b5a6b7f905..c9fd71503f354 100644 --- a/libr/core/cannotated_code.c +++ b/libr/core/cannotated_code.c @@ -30,8 +30,16 @@ R_API void r_core_annotated_code_print_json(RAnnotatedCode *code) { break; case R_CODE_ANNOTATION_TYPE_FUNCTION_NAME: pj_ks (pj, "type", "function_name"); - pj_ks (pj, "name", annotation->function_name.name); - pj_kn (pj, "function_offset", annotation->function_name.offset); + pj_ks (pj, "name", annotation->reference.name); + pj_kn (pj, "offset", annotation->reference.offset); + break; + case R_CODE_ANNOTATION_TYPE_GLOBAL_VARIABLE: + pj_ks (pj, "type", "global_variable"); + pj_kn (pj, "offset", annotation->reference.offset); + break; + case R_CODE_ANNOTATION_TYPE_CONSTANT_VARIABLE: + pj_ks (pj, "type", "constant_variable"); + pj_kn (pj, "offset", annotation->reference.offset); break; case R_CODE_ANNOTATION_TYPE_SYNTAX_HIGHLIGHT: pj_ks (pj, "type", "syntax_highlight"); diff --git a/libr/include/r_util/r_annotated_code.h b/libr/include/r_util/r_annotated_code.h index 243b216646a4a..2bb35b5a8c660 100644 --- a/libr/include/r_util/r_annotated_code.h +++ b/libr/include/r_util/r_annotated_code.h @@ -35,7 +35,9 @@ typedef enum r_syntax_highlight_type_t { typedef enum r_code_annotation_type_t { R_CODE_ANNOTATION_TYPE_OFFSET, R_CODE_ANNOTATION_TYPE_SYNTAX_HIGHLIGHT, - R_CODE_ANNOTATION_TYPE_FUNCTION_NAME + R_CODE_ANNOTATION_TYPE_FUNCTION_NAME, + R_CODE_ANNOTATION_TYPE_GLOBAL_VARIABLE, + R_CODE_ANNOTATION_TYPE_CONSTANT_VARIABLE // ... } RCodeAnnotationType; @@ -52,10 +54,14 @@ typedef struct r_code_annotation_t { RSyntaxHighlightType type; } syntax_highlight; + /** Information in annotations of type R_CODE_ANNOTATION_TYPE_FUNCTION_NAME, + * R_CODE_ANNOTATION_TYPE_GLOBAL_VARIABLE, and R_CODE_ANNOTATION_TYPE_CONSTANT_VARIABLE + * will be stored in the struct name reference in this union. + */ struct { char *name; - ut64 offset; // offset of the function with the name specified - } function_name; + ut64 offset; // address + } reference; }; } RCodeAnnotation; diff --git a/libr/util/annotated_code.c b/libr/util/annotated_code.c index 18232831d488f..6ea0f32a48f83 100644 --- a/libr/util/annotated_code.c +++ b/libr/util/annotated_code.c @@ -17,7 +17,7 @@ R_API void r_annotation_free(void *e, void *user) { (void)user; RCodeAnnotation *annotation = e; if (annotation->type == R_CODE_ANNOTATION_TYPE_FUNCTION_NAME) { - free (annotation->function_name.name); + free (annotation->reference.name); } }