diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1a1687e47..9eb2fb625 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,11 @@ jobs: strategy: matrix: python-version: [3.9, 3.8, 3.7, 3.6] + cc: [gcc, clang] fail-fast: false + env: + CC: ${{ matrix.cc }} + CFLAGS: -Wall -Werror -g -O2 steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} @@ -18,14 +22,14 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install busybox-static libelf-dev libdw-dev qemu-kvm zstd + sudo apt-get install busybox-static libelf-dev libdw-dev qemu-kvm zstd ${{ matrix.cc == 'clang' && 'libomp-dev' || '' }} pip install mypy - name: Generate version.py run: python setup.py --version - name: Check with mypy run: mypy --strict --no-warn-return-any drgn _drgn.pyi - - name: Build and test - run: python setup.py test -K + - name: Build and test with ${{ matrix.cc }} + run: python setup.py test lint: runs-on: ubuntu-latest diff --git a/MANIFEST.in b/MANIFEST.in index 8255679b9..f4ea67285 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ -recursive-include docs *.py *.rst +recursive-include docs *.css *.ico *.png *.py *.rst recursive-include examples *.py recursive-include tests *.py recursive-include tools *.py diff --git a/_drgn.pyi b/_drgn.pyi index ef1fe892a..0fcc55cb1 100644 --- a/_drgn.pyi +++ b/_drgn.pyi @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ libdrgn bindings diff --git a/docs/exts/drgndoc/docstrings.py b/docs/exts/drgndoc/docstrings.py index be92ddc24..e6bab5369 100644 --- a/docs/exts/drgndoc/docstrings.py +++ b/docs/exts/drgndoc/docstrings.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import argparse import functools diff --git a/docs/exts/drgndoc/ext.py b/docs/exts/drgndoc/ext.py index b347f4f4f..6ca33b9d8 100644 --- a/docs/exts/drgndoc/ext.py +++ b/docs/exts/drgndoc/ext.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ drgn consists of a core C extension and supporting Python code. It also makes diff --git a/docs/exts/drgndoc/format.py b/docs/exts/drgndoc/format.py index 7c5d7a20b..b7be5b6f9 100644 --- a/docs/exts/drgndoc/format.py +++ b/docs/exts/drgndoc/format.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import ast import re diff --git a/docs/exts/drgndoc/namespace.py b/docs/exts/drgndoc/namespace.py index 5bf92365d..808c1cb09 100644 --- a/docs/exts/drgndoc/namespace.py +++ b/docs/exts/drgndoc/namespace.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import itertools from typing import Generic, Iterator, List, Mapping, Optional, Sequence, TypeVar, Union diff --git a/docs/exts/drgndoc/parse.py b/docs/exts/drgndoc/parse.py index ec0b9c5bf..d9f5cc91d 100644 --- a/docs/exts/drgndoc/parse.py +++ b/docs/exts/drgndoc/parse.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import ast import inspect diff --git a/docs/exts/drgndoc/util.py b/docs/exts/drgndoc/util.py index 7c0f2b8e3..5c088ac3a 100644 --- a/docs/exts/drgndoc/util.py +++ b/docs/exts/drgndoc/util.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later from typing import Optional diff --git a/docs/exts/drgndoc/visitor.py b/docs/exts/drgndoc/visitor.py index e8a5085b4..6cf132ffd 100644 --- a/docs/exts/drgndoc/visitor.py +++ b/docs/exts/drgndoc/visitor.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import ast import sys diff --git a/drgn/__init__.py b/drgn/__init__.py index 1cfa94457..f3998cc0c 100644 --- a/drgn/__init__.py +++ b/drgn/__init__.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ Scriptable debugger library diff --git a/drgn/__main__.py b/drgn/__main__.py index f8898c636..c85ee75b1 100644 --- a/drgn/__main__.py +++ b/drgn/__main__.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ drgn entry point diff --git a/drgn/helpers/__init__.py b/drgn/helpers/__init__.py index e60a5683a..552451c95 100644 --- a/drgn/helpers/__init__.py +++ b/drgn/helpers/__init__.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ Helpers diff --git a/drgn/helpers/linux/__init__.py b/drgn/helpers/linux/__init__.py index 701bb383d..71bf0c25a 100644 --- a/drgn/helpers/linux/__init__.py +++ b/drgn/helpers/linux/__init__.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ Linux Kernel diff --git a/drgn/helpers/linux/block.py b/drgn/helpers/linux/block.py index 0d2c5c495..cf8588427 100644 --- a/drgn/helpers/linux/block.py +++ b/drgn/helpers/linux/block.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ Block Layer diff --git a/drgn/helpers/linux/boot.py b/drgn/helpers/linux/boot.py index 427298627..74dd2be85 100644 --- a/drgn/helpers/linux/boot.py +++ b/drgn/helpers/linux/boot.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ Boot diff --git a/drgn/helpers/linux/bpf.py b/drgn/helpers/linux/bpf.py index af7d083d6..fa526041b 100644 --- a/drgn/helpers/linux/bpf.py +++ b/drgn/helpers/linux/bpf.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ BPF diff --git a/drgn/helpers/linux/cgroup.py b/drgn/helpers/linux/cgroup.py index b0e112a05..dac0a91c3 100644 --- a/drgn/helpers/linux/cgroup.py +++ b/drgn/helpers/linux/cgroup.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ Cgroup diff --git a/drgn/helpers/linux/cpumask.py b/drgn/helpers/linux/cpumask.py index dac26d2c9..84e572098 100644 --- a/drgn/helpers/linux/cpumask.py +++ b/drgn/helpers/linux/cpumask.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ CPU Masks diff --git a/drgn/helpers/linux/device.py b/drgn/helpers/linux/device.py index 0efc10e4d..73861d77d 100644 --- a/drgn/helpers/linux/device.py +++ b/drgn/helpers/linux/device.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ Devices diff --git a/drgn/helpers/linux/fs.py b/drgn/helpers/linux/fs.py index 27a922118..7eff48338 100644 --- a/drgn/helpers/linux/fs.py +++ b/drgn/helpers/linux/fs.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ Virtual Filesystem Layer diff --git a/drgn/helpers/linux/idr.py b/drgn/helpers/linux/idr.py index d5fa25d6b..b9497cd83 100644 --- a/drgn/helpers/linux/idr.py +++ b/drgn/helpers/linux/idr.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ IDR diff --git a/drgn/helpers/linux/kconfig.py b/drgn/helpers/linux/kconfig.py index e26b3a45e..ff5aac0e0 100644 --- a/drgn/helpers/linux/kconfig.py +++ b/drgn/helpers/linux/kconfig.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ Kconfig diff --git a/drgn/helpers/linux/kernfs.py b/drgn/helpers/linux/kernfs.py index 103ef7ca5..a3e223598 100644 --- a/drgn/helpers/linux/kernfs.py +++ b/drgn/helpers/linux/kernfs.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ Kernfs diff --git a/drgn/helpers/linux/list.py b/drgn/helpers/linux/list.py index dc3aace4f..b72d1e0e0 100644 --- a/drgn/helpers/linux/list.py +++ b/drgn/helpers/linux/list.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ Linked Lists diff --git a/drgn/helpers/linux/list_nulls.py b/drgn/helpers/linux/list_nulls.py index a5161e3b8..f007c68c8 100644 --- a/drgn/helpers/linux/list_nulls.py +++ b/drgn/helpers/linux/list_nulls.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ Nulls Lists diff --git a/drgn/helpers/linux/mm.py b/drgn/helpers/linux/mm.py index 50f9c124e..8a5b9d9e2 100644 --- a/drgn/helpers/linux/mm.py +++ b/drgn/helpers/linux/mm.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ Memory Management diff --git a/drgn/helpers/linux/net.py b/drgn/helpers/linux/net.py index 7f1e15a79..621f7652f 100644 --- a/drgn/helpers/linux/net.py +++ b/drgn/helpers/linux/net.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ Networking diff --git a/drgn/helpers/linux/percpu.py b/drgn/helpers/linux/percpu.py index a3590d974..2472f8e4c 100644 --- a/drgn/helpers/linux/percpu.py +++ b/drgn/helpers/linux/percpu.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ Per-CPU diff --git a/drgn/helpers/linux/pid.py b/drgn/helpers/linux/pid.py index fe816c492..9f4d7cab4 100644 --- a/drgn/helpers/linux/pid.py +++ b/drgn/helpers/linux/pid.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ Process IDS diff --git a/drgn/helpers/linux/radixtree.py b/drgn/helpers/linux/radixtree.py index b0aa67e97..fe8814248 100644 --- a/drgn/helpers/linux/radixtree.py +++ b/drgn/helpers/linux/radixtree.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ Radix Trees diff --git a/drgn/helpers/linux/rbtree.py b/drgn/helpers/linux/rbtree.py index 2bbd9a980..c81e2bb96 100644 --- a/drgn/helpers/linux/rbtree.py +++ b/drgn/helpers/linux/rbtree.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ Red-Black Trees diff --git a/drgn/helpers/linux/sched.py b/drgn/helpers/linux/sched.py index 3d5276867..f6abf9f06 100644 --- a/drgn/helpers/linux/sched.py +++ b/drgn/helpers/linux/sched.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ CPU Scheduler diff --git a/drgn/helpers/linux/tcp.py b/drgn/helpers/linux/tcp.py index 72c5387ff..af0c7b116 100644 --- a/drgn/helpers/linux/tcp.py +++ b/drgn/helpers/linux/tcp.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ TCP diff --git a/drgn/helpers/linux/user.py b/drgn/helpers/linux/user.py index d64d09974..d9fd7475c 100644 --- a/drgn/helpers/linux/user.py +++ b/drgn/helpers/linux/user.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ Users diff --git a/drgn/internal/__init__.py b/drgn/internal/__init__.py index 300b85ebc..1b14962ca 100644 --- a/drgn/internal/__init__.py +++ b/drgn/internal/__init__.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """ drgn internals diff --git a/drgn/internal/cli.py b/drgn/internal/cli.py index 491738d33..ac2f9acd6 100644 --- a/drgn/internal/cli.py +++ b/drgn/internal/cli.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """drgn command line interface""" diff --git a/drgn/internal/rlcompleter.py b/drgn/internal/rlcompleter.py index f2321e856..6c4bb7f3a 100644 --- a/drgn/internal/rlcompleter.py +++ b/drgn/internal/rlcompleter.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """Improved readline completer""" diff --git a/examples/linux/cgroup.py b/examples/linux/cgroup.py index ae17bf84c..eab17d4f4 100755 --- a/examples/linux/cgroup.py +++ b/examples/linux/cgroup.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """List the paths of all descendants of a cgroup v2""" diff --git a/examples/linux/fs_inodes.py b/examples/linux/fs_inodes.py index 5e9d75cf4..6bc32de23 100755 --- a/examples/linux/fs_inodes.py +++ b/examples/linux/fs_inodes.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """List the paths of all inodes cached in a given filesystem""" diff --git a/examples/linux/lsmod.py b/examples/linux/lsmod.py index b6e8ddf0c..a60917eb6 100755 --- a/examples/linux/lsmod.py +++ b/examples/linux/lsmod.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """An implementation of lsmod(8) using drgn""" diff --git a/examples/linux/ps.py b/examples/linux/ps.py index 5346db05c..3f1b8d230 100755 --- a/examples/linux/ps.py +++ b/examples/linux/ps.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """A simplified implementation of ps(1) using drgn""" diff --git a/examples/linux/tcp_sock.py b/examples/linux/tcp_sock.py index 68d8e84c0..1df33cf6d 100755 --- a/examples/linux/tcp_sock.py +++ b/examples/linux/tcp_sock.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later """List all TCP sockets and their cgroup v2 paths""" diff --git a/libdrgn/Makefile.am b/libdrgn/Makefile.am index c23859046..b012dc165 100644 --- a/libdrgn/Makefile.am +++ b/libdrgn/Makefile.am @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later ACLOCAL_AMFLAGS = -I m4 @@ -164,9 +164,3 @@ EXTRA_PROGRAMS = examples/load_debug_info examples_load_debug_info_SOURCES = examples/load_debug_info.c examples_load_debug_info_LDADD = libdrgnimpl.la - -CLEANFILES = $(ARCH_INCS) \ - drgn.h \ - python/constants.c \ - python/docstrings.c \ - python/docstrings.h diff --git a/libdrgn/arch_ppc64.c b/libdrgn/arch_ppc64.c index 3539b2e61..2fdd4ecde 100644 --- a/libdrgn/arch_ppc64.c +++ b/libdrgn/arch_ppc64.c @@ -1,5 +1,5 @@ // (C) Copyright IBM Corp. 2020 -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include #include @@ -71,6 +71,32 @@ #include "arch_ppc64.inc" +static const struct drgn_cfi_row default_dwarf_cfi_row_ppc64 = DRGN_CFI_ROW( + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(ra)), + [DRGN_REGISTER_NUMBER(r1)] = { DRGN_CFI_RULE_CFA_PLUS_OFFSET }, + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r14)), + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r15)), + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r16)), + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r17)), + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r18)), + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r19)), + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r20)), + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r21)), + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r22)), + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r23)), + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r24)), + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r25)), + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r26)), + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r27)), + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r28)), + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r29)), + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r30)), + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r31)), + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(cr2)), + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(cr3)), + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(cr4)), +); + static struct drgn_error * fallback_unwind_ppc64(struct drgn_program *prog, struct drgn_register_state *regs, @@ -258,31 +284,7 @@ const struct drgn_architecture_info arch_info_ppc64 = { .default_flags = (DRGN_PLATFORM_IS_64_BIT | DRGN_PLATFORM_IS_LITTLE_ENDIAN), DRGN_ARCHITECTURE_REGISTERS, - .default_dwarf_cfi_row = DRGN_CFI_ROW( - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(ra)), - [DRGN_REGISTER_NUMBER(r1)] = { DRGN_CFI_RULE_CFA_PLUS_OFFSET }, - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r14)), - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r15)), - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r16)), - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r17)), - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r18)), - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r19)), - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r20)), - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r21)), - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r22)), - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r23)), - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r24)), - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r25)), - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r26)), - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r27)), - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r28)), - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r29)), - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r30)), - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r31)), - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(cr2)), - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(cr3)), - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(cr4)), - ), + .default_dwarf_cfi_row = &default_dwarf_cfi_row_ppc64, .fallback_unwind = fallback_unwind_ppc64, .pt_regs_get_initial_registers = pt_regs_get_initial_registers_ppc64, .prstatus_get_initial_registers = prstatus_get_initial_registers_ppc64, diff --git a/libdrgn/arch_ppc64.defs b/libdrgn/arch_ppc64.defs index a9d1efb3d..ffc2770bb 100644 --- a/libdrgn/arch_ppc64.defs +++ b/libdrgn/arch_ppc64.defs @@ -1,5 +1,5 @@ # (C) Copyright IBM Corp. 2020 -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later "r0" "r1" "r2" diff --git a/libdrgn/arch_register_layout.h b/libdrgn/arch_register_layout.h index ab2f03697..9911589a2 100644 --- a/libdrgn/arch_register_layout.h +++ b/libdrgn/arch_register_layout.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file diff --git a/libdrgn/arch_x86_64.c b/libdrgn/arch_x86_64.c index 93e3f73c7..2368b422c 100644 --- a/libdrgn/arch_x86_64.c +++ b/libdrgn/arch_x86_64.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include #include @@ -40,6 +40,24 @@ #include "arch_x86_64.inc" +static const struct drgn_cfi_row default_dwarf_cfi_row_x86_64 = DRGN_CFI_ROW( + /* + * The System V psABI defines the CFA as the value of rsp in the calling + * frame. + */ + [DRGN_REGISTER_NUMBER(rsp)] = { DRGN_CFI_RULE_CFA_PLUS_OFFSET }, + /* + * Other callee-saved registers default to DW_CFA_same_value. This isn't + * explicitly documented in the psABI, but it seems to be the consensus. + */ + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(rbx)), + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(rbp)), + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r12)), + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r13)), + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r14)), + DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r15)), +); + static struct drgn_error * orc_to_cfi_x86_64(const struct drgn_orc_entry *orc, struct drgn_cfi_row **row_ret, bool *interrupted_ret, @@ -732,24 +750,7 @@ const struct drgn_architecture_info arch_info_x86_64 = { .default_flags = (DRGN_PLATFORM_IS_64_BIT | DRGN_PLATFORM_IS_LITTLE_ENDIAN), DRGN_ARCHITECTURE_REGISTERS, - .default_dwarf_cfi_row = DRGN_CFI_ROW( - /* - * The System V psABI defines the CFA as the value of rsp in the - * calling frame. - */ - [DRGN_REGISTER_NUMBER(rsp)] = { DRGN_CFI_RULE_CFA_PLUS_OFFSET }, - /* - * Other callee-saved registers default to DW_CFA_same_value. - * This isn't explicitly documented in the psABI, but it seems - * to be the consensus. - */ - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(rbx)), - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(rbp)), - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r12)), - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r13)), - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r14)), - DRGN_CFI_SAME_VALUE_INIT(DRGN_REGISTER_NUMBER(r15)), - ), + .default_dwarf_cfi_row = &default_dwarf_cfi_row_x86_64, .orc_to_cfi = orc_to_cfi_x86_64, .fallback_unwind = fallback_unwind_x86_64, .pt_regs_get_initial_registers = pt_regs_get_initial_registers_x86_64, diff --git a/libdrgn/arch_x86_64.defs b/libdrgn/arch_x86_64.defs index f4290839d..03b1ccf02 100644 --- a/libdrgn/arch_x86_64.defs +++ b/libdrgn/arch_x86_64.defs @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later "rax" "rdx" "rcx" diff --git a/libdrgn/binary_buffer.c b/libdrgn/binary_buffer.c index a71e53c0c..7cabed214 100644 --- a/libdrgn/binary_buffer.c +++ b/libdrgn/binary_buffer.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include "binary_buffer.h" #include "drgn.h" diff --git a/libdrgn/binary_buffer.h b/libdrgn/binary_buffer.h index 422548a7e..47854582d 100644 --- a/libdrgn/binary_buffer.h +++ b/libdrgn/binary_buffer.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file diff --git a/libdrgn/binary_search_tree.h b/libdrgn/binary_search_tree.h index e7c5de951..ba6fb4f57 100644 --- a/libdrgn/binary_search_tree.h +++ b/libdrgn/binary_search_tree.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file diff --git a/libdrgn/bitops.h b/libdrgn/bitops.h index fcc424c7f..49b1b748d 100644 --- a/libdrgn/bitops.h +++ b/libdrgn/bitops.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file diff --git a/libdrgn/build-aux/gen_arch.awk b/libdrgn/build-aux/gen_arch.awk index 41ceec646..102bd7165 100644 --- a/libdrgn/build-aux/gen_arch.awk +++ b/libdrgn/build-aux/gen_arch.awk @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later # This script generates drgn architecture definition code ("arch_foo.inc") from # an input definition file ("arch_foo.defs"). diff --git a/libdrgn/build-aux/gen_constants.py b/libdrgn/build-aux/gen_constants.py index 5a589c483..b859dfd84 100644 --- a/libdrgn/build-aux/gen_constants.py +++ b/libdrgn/build-aux/gen_constants.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import os.path import re diff --git a/libdrgn/cfi.c b/libdrgn/cfi.c index 0e3212e9b..4a729a876 100644 --- a/libdrgn/cfi.c +++ b/libdrgn/cfi.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include #include @@ -39,7 +39,7 @@ static bool drgn_cfi_row_reserve(struct drgn_cfi_row **row, uint16_t num_rules) if (num_rules < (*row)->num_regs + 1) num_rules = (*row)->num_regs + 1; size_t size; - if (__builtin_mul_overflow(num_rules - 1, + if (__builtin_mul_overflow((uint16_t)(num_rules - 1), sizeof(struct drgn_cfi_rule), &size) || __builtin_add_overflow(sizeof(struct drgn_cfi_row), size, diff --git a/libdrgn/cfi.h b/libdrgn/cfi.h index f182ed81c..72d954c55 100644 --- a/libdrgn/cfi.h +++ b/libdrgn/cfi.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file @@ -145,20 +145,15 @@ struct drgn_cfi_row { struct drgn_cfi_rule reg_rules[]; }; -/** Create a static @ref drgn_cfi_row given initializers for `reg_rules`. */ -#define DRGN_CFI_ROW(...) \ - ((struct drgn_cfi_row *) \ - &(const struct { \ - struct drgn_cfi_row row; \ - struct drgn_cfi_rule reg_rules[sizeof((struct drgn_cfi_rule []){ __VA_ARGS__ })\ - / sizeof(struct drgn_cfi_rule)]; \ - }){ \ - { \ - .num_regs = (sizeof((struct drgn_cfi_rule []){ __VA_ARGS__ })\ - / sizeof(struct drgn_cfi_rule)), \ - }, \ - { __VA_ARGS__ }, \ - }) +/** + * Initializer for a static @ref drgn_cfi_row given initializers for @ref + * drgn_cfi_row::reg_rules. + */ +#define DRGN_CFI_ROW(...) { \ + .num_regs = (sizeof((struct drgn_cfi_rule []){ __VA_ARGS__ }) \ + / sizeof(struct drgn_cfi_rule)), \ + .reg_rules = { __VA_ARGS__ }, \ +} /** * Initializer for a rule in @ref drgn_cfi_row::reg_rules specifying that the diff --git a/libdrgn/cityhash.h b/libdrgn/cityhash.h index de8718376..29abebad3 100644 --- a/libdrgn/cityhash.h +++ b/libdrgn/cityhash.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #ifndef DRGN_CITYHASH_H #define DRGN_CITYHASH_H diff --git a/libdrgn/configure.ac b/libdrgn/configure.ac index f8f3a2210..35fee53cb 100644 --- a/libdrgn/configure.ac +++ b/libdrgn/configure.ac @@ -1,7 +1,7 @@ dnl Copyright (c) Facebook, Inc. and its affiliates. -dnl SPDX-License-Identifier: GPL-3.0+ +dnl SPDX-License-Identifier: GPL-3.0-or-later -AC_INIT([libdrgn], [0.0.10], +AC_INIT([libdrgn], [0.0.11], [https://github.com/osandov/drgn/issues],, [https://github.com/osandov/drgn]) diff --git a/libdrgn/debug_info.c b/libdrgn/debug_info.c index 8206211ba..051b44c09 100644 --- a/libdrgn/debug_info.c +++ b/libdrgn/debug_info.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include #include @@ -4240,7 +4240,7 @@ drgn_debug_info_find_cfi_in_fde(struct drgn_debug_info_module *module, struct drgn_error *err; struct drgn_dwarf_cie *cie = &module->cies[fde->cie]; struct drgn_cfi_row *initial_row = - module->platform.arch->default_dwarf_cfi_row; + (struct drgn_cfi_row *)module->platform.arch->default_dwarf_cfi_row; err = drgn_eval_dwarf_cfi(module, fde, NULL, unbiased_pc, cie->initial_instructions, cie->initial_instructions_size, &initial_row); diff --git a/libdrgn/debug_info.h b/libdrgn/debug_info.h index 72b32f817..ef56c9739 100644 --- a/libdrgn/debug_info.h +++ b/libdrgn/debug_info.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file diff --git a/libdrgn/drgn.h.in b/libdrgn/drgn.h.in index e58c133ba..89f642051 100644 --- a/libdrgn/drgn.h.in +++ b/libdrgn/drgn.h.in @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file diff --git a/libdrgn/dwarf_index.c b/libdrgn/dwarf_index.c index 09f4e9289..8575fe9e1 100644 --- a/libdrgn/dwarf_index.c +++ b/libdrgn/dwarf_index.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include #include diff --git a/libdrgn/dwarf_index.h b/libdrgn/dwarf_index.h index 8aa309274..116c8273a 100644 --- a/libdrgn/dwarf_index.h +++ b/libdrgn/dwarf_index.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file diff --git a/libdrgn/error.c b/libdrgn/error.c index cb5aefe2b..b66c3661f 100644 --- a/libdrgn/error.c +++ b/libdrgn/error.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include #include diff --git a/libdrgn/error.h b/libdrgn/error.h index f16cebffa..f56252557 100644 --- a/libdrgn/error.h +++ b/libdrgn/error.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file diff --git a/libdrgn/hash_table.c b/libdrgn/hash_table.c index 55a34b9fd..f4b32be76 100644 --- a/libdrgn/hash_table.c +++ b/libdrgn/hash_table.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include "hash_table.h" diff --git a/libdrgn/hash_table.h b/libdrgn/hash_table.h index cc8abca22..4a18e4f48 100644 --- a/libdrgn/hash_table.h +++ b/libdrgn/hash_table.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file @@ -666,18 +666,6 @@ static inline size_t table##_chunk_capacity_scale(struct table##_chunk *chunk) \ } \ } \ \ -static inline void \ -table##_chunk_set_capacity_scale(struct table##_chunk *chunk, \ - size_t capacity_scale) \ -{ \ - if (table##_capacity_scale_bits == 4) { \ - chunk->control = (chunk->control & ~0xf) | capacity_scale; \ - } else { \ - uint16_t val = capacity_scale; \ - memcpy(&chunk->tags[12], &val, 2); \ - } \ -} \ - \ static inline bool table##_chunk_eof(struct table##_chunk *chunk) \ { \ return table##_chunk_capacity_scale(chunk) != 0; \ @@ -1350,7 +1338,7 @@ table##_delete_iterator_hashed(struct table *table, struct table##_iterator it, } \ } \ \ -__attribute__((__always_inline__)) \ +__attribute__((__always_inline__, __unused__)) \ static inline struct table##_iterator \ table##_delete_iterator(struct table *table, struct table##_iterator it) \ { \ diff --git a/libdrgn/helpers.h b/libdrgn/helpers.h index 2251e12a7..342333603 100644 --- a/libdrgn/helpers.h +++ b/libdrgn/helpers.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file diff --git a/libdrgn/kdump.c b/libdrgn/kdump.c index 3e7c43905..b4af4f0fa 100644 --- a/libdrgn/kdump.c +++ b/libdrgn/kdump.c @@ -1,5 +1,5 @@ // Copyright 2019 - Serapheim Dimitropoulos -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include #include diff --git a/libdrgn/language.c b/libdrgn/language.c index 623a44746..3e5086228 100644 --- a/libdrgn/language.c +++ b/libdrgn/language.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include diff --git a/libdrgn/language.h b/libdrgn/language.h index 2ac2c6037..8bce2b5b4 100644 --- a/libdrgn/language.h +++ b/libdrgn/language.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file diff --git a/libdrgn/language_c.c b/libdrgn/language_c.c index 236558406..732b31f10 100644 --- a/libdrgn/language_c.c +++ b/libdrgn/language_c.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include #include @@ -1147,7 +1147,8 @@ c_format_compound_object(const struct drgn_object *obj, goto out; } new->member = drgn_type_members(underlying_type); - new->end = new->member + drgn_type_num_members(underlying_type); + new->end = add_to_possibly_null_pointer(new->member, + drgn_type_num_members(underlying_type)); new->bit_offset = 0; /* diff --git a/libdrgn/lazy_object.c b/libdrgn/lazy_object.c index 9cb53c805..ae21be2b3 100644 --- a/libdrgn/lazy_object.c +++ b/libdrgn/lazy_object.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include diff --git a/libdrgn/lazy_object.h b/libdrgn/lazy_object.h index a5c4e1731..fa4ae640d 100644 --- a/libdrgn/lazy_object.h +++ b/libdrgn/lazy_object.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file diff --git a/libdrgn/lexer.c b/libdrgn/lexer.c index 1463b1f3e..221fa4530 100644 --- a/libdrgn/lexer.c +++ b/libdrgn/lexer.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include "drgn.h" #include "lexer.h" diff --git a/libdrgn/lexer.h b/libdrgn/lexer.h index 37910d6f8..693da4412 100644 --- a/libdrgn/lexer.h +++ b/libdrgn/lexer.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file diff --git a/libdrgn/linux_kernel.c b/libdrgn/linux_kernel.c index 16c52b090..e353b695c 100644 --- a/libdrgn/linux_kernel.c +++ b/libdrgn/linux_kernel.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include #include diff --git a/libdrgn/linux_kernel.h b/libdrgn/linux_kernel.h index 95616b98d..936155fc3 100644 --- a/libdrgn/linux_kernel.h +++ b/libdrgn/linux_kernel.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #ifndef DRGN_LINUX_KERNEL_H #define DRGN_LINUX_KERNEL_H diff --git a/libdrgn/linux_kernel_helpers.c b/libdrgn/linux_kernel_helpers.c index b2089034d..115fb4fa0 100644 --- a/libdrgn/linux_kernel_helpers.c +++ b/libdrgn/linux_kernel_helpers.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include #include diff --git a/libdrgn/memory_reader.c b/libdrgn/memory_reader.c index 950e24085..8ac6e09f8 100644 --- a/libdrgn/memory_reader.c +++ b/libdrgn/memory_reader.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include #include diff --git a/libdrgn/memory_reader.h b/libdrgn/memory_reader.h index 139c4583c..8d4eaff3d 100644 --- a/libdrgn/memory_reader.h +++ b/libdrgn/memory_reader.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file diff --git a/libdrgn/minmax.h b/libdrgn/minmax.h index 55d264f38..7e517667b 100644 --- a/libdrgn/minmax.h +++ b/libdrgn/minmax.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file diff --git a/libdrgn/object.c b/libdrgn/object.c index 2aeead196..011f64f0d 100644 --- a/libdrgn/object.c +++ b/libdrgn/object.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include #include @@ -27,6 +27,7 @@ LIBDRGN_PUBLIC void drgn_object_init(struct drgn_object *obj, obj->encoding = DRGN_OBJECT_ENCODING_NONE; obj->kind = DRGN_OBJECT_ABSENT; obj->is_bit_field = false; + obj->little_endian = false; } static void drgn_value_deinit(const struct drgn_object *obj, @@ -117,6 +118,8 @@ drgn_object_type_impl(struct drgn_type *type, struct drgn_type *underlying_type, drgn_type_is_complete(underlying_type)) { ret->little_endian = drgn_type_little_endian(drgn_type_type(underlying_type).type); + } else { + ret->little_endian = false; } return NULL; } diff --git a/libdrgn/object.h b/libdrgn/object.h index f74909b56..923ebfd5a 100644 --- a/libdrgn/object.h +++ b/libdrgn/object.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file diff --git a/libdrgn/object_index.c b/libdrgn/object_index.c index ca513775c..e7248138c 100644 --- a/libdrgn/object_index.c +++ b/libdrgn/object_index.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include #include diff --git a/libdrgn/object_index.h b/libdrgn/object_index.h index 022fbc222..2929056c4 100644 --- a/libdrgn/object_index.h +++ b/libdrgn/object_index.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file diff --git a/libdrgn/orc.h b/libdrgn/orc.h index 4b011fbb7..dd1fc87d6 100644 --- a/libdrgn/orc.h +++ b/libdrgn/orc.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file diff --git a/libdrgn/path.c b/libdrgn/path.c index a5b7a7278..26aa9b632 100644 --- a/libdrgn/path.c +++ b/libdrgn/path.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include #include diff --git a/libdrgn/path.h b/libdrgn/path.h index c2034f892..d2ed93620 100644 --- a/libdrgn/path.h +++ b/libdrgn/path.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file diff --git a/libdrgn/platform.c b/libdrgn/platform.c index 42cd8ee0d..d778b3a01 100644 --- a/libdrgn/platform.c +++ b/libdrgn/platform.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include #include diff --git a/libdrgn/platform.h b/libdrgn/platform.h index 9ac03de5c..288ea4e75 100644 --- a/libdrgn/platform.h +++ b/libdrgn/platform.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #ifndef DRGN_PLATFORM_H #define DRGN_PLATFORM_H @@ -86,7 +86,7 @@ struct drgn_architecture_info { const struct drgn_register_layout *register_layout; drgn_register_number (*dwarf_regno_to_internal)(uint64_t); /* CFI row containing default rules for DWARF CFI. */ - struct drgn_cfi_row *default_dwarf_cfi_row; + const struct drgn_cfi_row *default_dwarf_cfi_row; struct drgn_error *(*orc_to_cfi)(const struct drgn_orc_entry *, struct drgn_cfi_row **, bool *, drgn_register_number *); diff --git a/libdrgn/pp.h b/libdrgn/pp.h index 01641d050..e38cadd3f 100644 --- a/libdrgn/pp.h +++ b/libdrgn/pp.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /* * @file diff --git a/libdrgn/program.c b/libdrgn/program.c index 35214000b..2694428d4 100644 --- a/libdrgn/program.c +++ b/libdrgn/program.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include #include diff --git a/libdrgn/program.h b/libdrgn/program.h index 4682e6cf6..e58434d80 100644 --- a/libdrgn/program.h +++ b/libdrgn/program.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file diff --git a/libdrgn/python/drgnpy.h b/libdrgn/python/drgnpy.h index c2747d7aa..2094e15d8 100644 --- a/libdrgn/python/drgnpy.h +++ b/libdrgn/python/drgnpy.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #ifndef DRGNPY_H #define DRGNPY_H diff --git a/libdrgn/python/error.c b/libdrgn/python/error.c index 134feec07..1fb2b1364 100644 --- a/libdrgn/python/error.c +++ b/libdrgn/python/error.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include "drgnpy.h" #include "../error.h" diff --git a/libdrgn/python/helpers.c b/libdrgn/python/helpers.c index 7ab4df3fa..3158be0bd 100644 --- a/libdrgn/python/helpers.c +++ b/libdrgn/python/helpers.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include "drgnpy.h" #include "../helpers.h" diff --git a/libdrgn/python/language.c b/libdrgn/python/language.c index b677215a2..d893091db 100644 --- a/libdrgn/python/language.c +++ b/libdrgn/python/language.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include "drgnpy.h" #include "../language.h" diff --git a/libdrgn/python/module.c b/libdrgn/python/module.c index 23fec6cfa..1e55e7aa8 100644 --- a/libdrgn/python/module.c +++ b/libdrgn/python/module.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #ifdef WITH_KDUMPFILE #include diff --git a/libdrgn/python/object.c b/libdrgn/python/object.c index c6ce39a37..e8bd59031 100644 --- a/libdrgn/python/object.c +++ b/libdrgn/python/object.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include #include diff --git a/libdrgn/python/platform.c b/libdrgn/python/platform.c index a71b34a4f..b199e2d9e 100644 --- a/libdrgn/python/platform.c +++ b/libdrgn/python/platform.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include "drgnpy.h" diff --git a/libdrgn/python/program.c b/libdrgn/python/program.c index aa5ca5aff..c28d32f8a 100644 --- a/libdrgn/python/program.c +++ b/libdrgn/python/program.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include "drgnpy.h" #include "../hash_table.h" diff --git a/libdrgn/python/stack_trace.c b/libdrgn/python/stack_trace.c index d471800ab..be54db9c0 100644 --- a/libdrgn/python/stack_trace.c +++ b/libdrgn/python/stack_trace.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include "drgnpy.h" #include "../stack_trace.h" diff --git a/libdrgn/python/symbol.c b/libdrgn/python/symbol.c index 4a55f40d5..42140ea7f 100644 --- a/libdrgn/python/symbol.c +++ b/libdrgn/python/symbol.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include diff --git a/libdrgn/python/test.c b/libdrgn/python/test.c index 264d8b020..6728762ea 100644 --- a/libdrgn/python/test.c +++ b/libdrgn/python/test.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /* * Wrapper functions for testing. diff --git a/libdrgn/python/type.c b/libdrgn/python/type.c index d4fdd4ae3..817f36bc9 100644 --- a/libdrgn/python/type.c +++ b/libdrgn/python/type.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include diff --git a/libdrgn/python/util.c b/libdrgn/python/util.c index 372625b04..f49777338 100644 --- a/libdrgn/python/util.c +++ b/libdrgn/python/util.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include diff --git a/libdrgn/register_state.c b/libdrgn/register_state.c index 9f6717b04..3fd8f8db7 100644 --- a/libdrgn/register_state.c +++ b/libdrgn/register_state.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include #include diff --git a/libdrgn/register_state.h b/libdrgn/register_state.h index 54826a0b4..9f8b2bf32 100644 --- a/libdrgn/register_state.h +++ b/libdrgn/register_state.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file diff --git a/libdrgn/serialize.c b/libdrgn/serialize.c index 01efcfc9d..b50d80194 100644 --- a/libdrgn/serialize.c +++ b/libdrgn/serialize.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include #include diff --git a/libdrgn/serialize.h b/libdrgn/serialize.h index 491728695..281c54a1e 100644 --- a/libdrgn/serialize.h +++ b/libdrgn/serialize.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file diff --git a/libdrgn/siphash.h b/libdrgn/siphash.h index fd522d521..0cfba7428 100644 --- a/libdrgn/siphash.h +++ b/libdrgn/siphash.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #ifndef DRGN_SIPHASH_H #define DRGN_SIPHASH_H diff --git a/libdrgn/splay_tree.c b/libdrgn/splay_tree.c index 8241b8d9f..a0bfa6964 100644 --- a/libdrgn/splay_tree.c +++ b/libdrgn/splay_tree.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include "binary_search_tree.h" // IWYU pragma: associated diff --git a/libdrgn/stack_trace.c b/libdrgn/stack_trace.c index 03ca5b0aa..9a4f4cdd2 100644 --- a/libdrgn/stack_trace.c +++ b/libdrgn/stack_trace.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include #include diff --git a/libdrgn/stack_trace.h b/libdrgn/stack_trace.h index 4250e1713..20f5eb6c0 100644 --- a/libdrgn/stack_trace.h +++ b/libdrgn/stack_trace.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file diff --git a/libdrgn/string_builder.c b/libdrgn/string_builder.c index f0bc76a1c..9a10d0783 100644 --- a/libdrgn/string_builder.c +++ b/libdrgn/string_builder.c @@ -1,11 +1,12 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include #include #include "bitops.h" #include "string_builder.h" +#include "util.h" bool string_builder_finalize(struct string_builder *sb, char **ret) { @@ -58,7 +59,8 @@ bool string_builder_vappendf(struct string_builder *sb, const char *format, again: va_copy(aq, ap); - len = vsnprintf(&sb->str[sb->len], sb->capacity - sb->len, format, aq); + len = vsnprintf(add_to_possibly_null_pointer(sb->str, sb->len), + sb->capacity - sb->len, format, aq); va_end(aq); if (len < 0) return false; diff --git a/libdrgn/string_builder.h b/libdrgn/string_builder.h index 1da0974a7..bc3b3f04e 100644 --- a/libdrgn/string_builder.h +++ b/libdrgn/string_builder.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file diff --git a/libdrgn/symbol.c b/libdrgn/symbol.c index 14278e33e..e9ef9a2d0 100644 --- a/libdrgn/symbol.c +++ b/libdrgn/symbol.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include #include diff --git a/libdrgn/symbol.h b/libdrgn/symbol.h index f6cf4ddb5..508a35ba2 100644 --- a/libdrgn/symbol.h +++ b/libdrgn/symbol.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #ifndef DRGN_SYMBOL_H #define DRGN_SYMBOL_H diff --git a/libdrgn/type.c b/libdrgn/type.c index 996c88414..25000b123 100644 --- a/libdrgn/type.c +++ b/libdrgn/type.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include #include @@ -1041,13 +1041,16 @@ drgn_type_with_byte_order_impl(struct drgn_type **type, drgn_type_program(*type)); size_t num_enumerators = drgn_type_num_enumerators(*type); - if (!drgn_type_enumerator_vector_reserve(&builder.enumerators, - num_enumerators)) { - drgn_enum_type_builder_deinit(&builder); - return &drgn_enomem; + if (num_enumerators) { + if (!drgn_type_enumerator_vector_reserve(&builder.enumerators, + num_enumerators)) { + drgn_enum_type_builder_deinit(&builder); + return &drgn_enomem; + } + memcpy(&builder.enumerators.data, + drgn_type_enumerators(*type), + num_enumerators * sizeof(struct drgn_type_enumerator)); } - memcpy(&builder.enumerators.data, drgn_type_enumerators(*type), - num_enumerators * sizeof(struct drgn_type_enumerator)); err = drgn_enum_type_create(&builder, drgn_type_tag(*type), compatible_type, drgn_type_language(*type), type); diff --git a/libdrgn/type.h b/libdrgn/type.h index 00e27abe1..24ddeb033 100644 --- a/libdrgn/type.h +++ b/libdrgn/type.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file diff --git a/libdrgn/util.h b/libdrgn/util.h index 8f73655ab..166c38a1f 100644 --- a/libdrgn/util.h +++ b/libdrgn/util.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file @@ -125,4 +125,19 @@ static inline uint64_t uint_max(int n) return UINT64_MAX >> (64 - 8 * n); } +/** + * Safely add to a pointer which may be `NULL`. + * + * `NULL + 0` is undefined behavior, but it often arises naturally, like when + * computing the end of a dynamic array: `arr + length`. This works around the + * undefined behavior: `add_to_possibly_null_pointer(NULL, 0)` is defined as + * `NULL`. + * + * A more natural definition would be `i == 0 ? ptr : ptr + i`, but some + * versions of GCC and Clang generate an unnecessary branch or conditional move + * (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97225). + */ +#define add_to_possibly_null_pointer(ptr, i) \ + ((typeof(ptr))((uintptr_t)(ptr) + (i) * sizeof(*(ptr)))) + #endif /* DRGN_UTIL_H */ diff --git a/libdrgn/vector.c b/libdrgn/vector.c index 128e0279e..96b13c9f9 100644 --- a/libdrgn/vector.c +++ b/libdrgn/vector.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include "vector.h" diff --git a/libdrgn/vector.h b/libdrgn/vector.h index 37bcd15d1..70196c477 100644 --- a/libdrgn/vector.h +++ b/libdrgn/vector.h @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /** * @file diff --git a/scripts/generate_dwarf_constants.py b/scripts/generate_dwarf_constants.py index 2ba62b51d..baf224102 100755 --- a/scripts/generate_dwarf_constants.py +++ b/scripts/generate_dwarf_constants.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import keyword import re diff --git a/scripts/generate_primitive_type_spellings.py b/scripts/generate_primitive_type_spellings.py index 7708efea5..425aec517 100755 --- a/scripts/generate_primitive_type_spellings.py +++ b/scripts/generate_primitive_type_spellings.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import itertools import sys diff --git a/scripts/iwyu.py b/scripts/iwyu.py index 0f303d202..42eb2a067 100755 --- a/scripts/iwyu.py +++ b/scripts/iwyu.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import argparse import json diff --git a/scripts/test_cityhash.c b/scripts/test_cityhash.c index 3f9d2ebed..503dd7e74 100644 --- a/scripts/test_cityhash.c +++ b/scripts/test_cityhash.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include #include diff --git a/scripts/test_siphash.c b/scripts/test_siphash.c index f84ac8bdf..7712919ef 100644 --- a/scripts/test_siphash.c +++ b/scripts/test_siphash.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later #include #include diff --git a/setup.py b/setup.py index 06157693a..240fe1c61 100755 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later # setuptools must be imported before distutils (see pypa/setuptools#2230). import setuptools # isort: skip @@ -351,7 +351,7 @@ def get_version(): "Bug Tracker": "https://github.com/osandov/drgn/issues", "Documentation": "https://drgn.readthedocs.io", }, - license="GPL-3.0+", + license="GPL-3.0-or-later", classifiers=[ "Development Status :: 3 - Alpha", "Environment :: Console", diff --git a/tests/__init__.py b/tests/__init__.py index 3b96fbc3d..028062aec 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import functools import types diff --git a/tests/dwarfwriter.py b/tests/dwarfwriter.py index b9dfcc3e6..c0bacca53 100644 --- a/tests/dwarfwriter.py +++ b/tests/dwarfwriter.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later from collections import namedtuple import os.path diff --git a/tests/elf.py b/tests/elf.py index 8a99f5ca9..4a502bdd3 100644 --- a/tests/elf.py +++ b/tests/elf.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import enum diff --git a/tests/elfwriter.py b/tests/elfwriter.py index 52a0caaa9..b4393f54d 100644 --- a/tests/elfwriter.py +++ b/tests/elfwriter.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import struct from typing import Optional, Sequence diff --git a/tests/helpers/linux/__init__.py b/tests/helpers/linux/__init__.py index bc84e98e7..5b5754a6c 100644 --- a/tests/helpers/linux/__init__.py +++ b/tests/helpers/linux/__init__.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import contextlib import ctypes diff --git a/tests/helpers/linux/test_block.py b/tests/helpers/linux/test_block.py index c0b374eaa..26f981409 100644 --- a/tests/helpers/linux/test_block.py +++ b/tests/helpers/linux/test_block.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import errno from fcntl import ioctl diff --git a/tests/helpers/linux/test_boot.py b/tests/helpers/linux/test_boot.py index ec2946fa2..595482bec 100644 --- a/tests/helpers/linux/test_boot.py +++ b/tests/helpers/linux/test_boot.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import platform import re diff --git a/tests/helpers/linux/test_cgroup.py b/tests/helpers/linux/test_cgroup.py index 43cd4baa9..fa10d226e 100644 --- a/tests/helpers/linux/test_cgroup.py +++ b/tests/helpers/linux/test_cgroup.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import os diff --git a/tests/helpers/linux/test_cpumask.py b/tests/helpers/linux/test_cpumask.py index b9d49d19a..17dd4378c 100644 --- a/tests/helpers/linux/test_cpumask.py +++ b/tests/helpers/linux/test_cpumask.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later from pathlib import Path diff --git a/tests/helpers/linux/test_debug_info.py b/tests/helpers/linux/test_debug_info.py index cb60ddf82..94dc53b81 100644 --- a/tests/helpers/linux/test_debug_info.py +++ b/tests/helpers/linux/test_debug_info.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import os diff --git a/tests/helpers/linux/test_fs.py b/tests/helpers/linux/test_fs.py index c1bc6a813..aff6e1a9d 100644 --- a/tests/helpers/linux/test_fs.py +++ b/tests/helpers/linux/test_fs.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import os import os.path diff --git a/tests/helpers/linux/test_kconfig.py b/tests/helpers/linux/test_kconfig.py index 8993c9aaa..b5ebdd36f 100644 --- a/tests/helpers/linux/test_kconfig.py +++ b/tests/helpers/linux/test_kconfig.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import os.path diff --git a/tests/helpers/linux/test_kernfs.py b/tests/helpers/linux/test_kernfs.py index 4ceaf0178..e31f564f1 100644 --- a/tests/helpers/linux/test_kernfs.py +++ b/tests/helpers/linux/test_kernfs.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import os diff --git a/tests/helpers/linux/test_mm.py b/tests/helpers/linux/test_mm.py index 114430183..73f800f7b 100644 --- a/tests/helpers/linux/test_mm.py +++ b/tests/helpers/linux/test_mm.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import contextlib import ctypes diff --git a/tests/helpers/linux/test_net.py b/tests/helpers/linux/test_net.py index ff909a139..b0373fcfc 100644 --- a/tests/helpers/linux/test_net.py +++ b/tests/helpers/linux/test_net.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import os diff --git a/tests/helpers/linux/test_percpu.py b/tests/helpers/linux/test_percpu.py index a17b8f53c..672532ee7 100644 --- a/tests/helpers/linux/test_percpu.py +++ b/tests/helpers/linux/test_percpu.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later from drgn.helpers.linux.cpumask import for_each_possible_cpu from drgn.helpers.linux.percpu import per_cpu diff --git a/tests/helpers/linux/test_pid.py b/tests/helpers/linux/test_pid.py index ae0c90fac..b29dce951 100644 --- a/tests/helpers/linux/test_pid.py +++ b/tests/helpers/linux/test_pid.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import os diff --git a/tests/helpers/linux/test_sched.py b/tests/helpers/linux/test_sched.py index 51eaf5d86..4a4253c68 100644 --- a/tests/helpers/linux/test_sched.py +++ b/tests/helpers/linux/test_sched.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import os import signal diff --git a/tests/helpers/linux/test_stack_trace.py b/tests/helpers/linux/test_stack_trace.py index 12cd915de..1420813c2 100644 --- a/tests/helpers/linux/test_stack_trace.py +++ b/tests/helpers/linux/test_stack_trace.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import os import signal diff --git a/tests/helpers/linux/test_tcp.py b/tests/helpers/linux/test_tcp.py index e8fa2056e..0fc7dbd9b 100644 --- a/tests/helpers/linux/test_tcp.py +++ b/tests/helpers/linux/test_tcp.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import os import socket diff --git a/tests/helpers/linux/test_user.py b/tests/helpers/linux/test_user.py index 3ba1be632..1659aedb3 100644 --- a/tests/helpers/linux/test_user.py +++ b/tests/helpers/linux/test_user.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import functools import os diff --git a/tests/helpers/linux/test_uts.py b/tests/helpers/linux/test_uts.py index 0f4db8f96..9a637cc8b 100644 --- a/tests/helpers/linux/test_uts.py +++ b/tests/helpers/linux/test_uts.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import os diff --git a/tests/libdrgn.py b/tests/libdrgn.py index e5059bded..900ecccae 100644 --- a/tests/libdrgn.py +++ b/tests/libdrgn.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import ctypes import enum diff --git a/tests/test_docs.py b/tests/test_docs.py index 1288cf112..5b0cc369e 100644 --- a/tests/test_docs.py +++ b/tests/test_docs.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import pydoc import unittest diff --git a/tests/test_dwarf.py b/tests/test_dwarf.py index 3377924ea..8a63ab575 100644 --- a/tests/test_dwarf.py +++ b/tests/test_dwarf.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import os.path import re @@ -190,7 +190,7 @@ def dwarf_program(*args, **kwds): return prog -def test_type_dies(dies): +def wrap_test_type_dies(dies): if isinstance(dies, DwarfDie): dies = (dies,) return tuple(dies) + ( @@ -206,14 +206,14 @@ def test_type_dies(dies): class TestTypes(TestCase): def test_unknown_tag(self): - prog = dwarf_program(test_type_dies(DwarfDie(0x9999, ()))) + prog = dwarf_program(wrap_test_type_dies(DwarfDie(0x9999, ()))) self.assertRaisesRegex( Exception, "unknown DWARF type tag 0x9999", prog.type, "TEST" ) def test_base_type_missing_byte_size(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( DwarfDie( DW_TAG.base_type, ( @@ -232,7 +232,7 @@ def test_base_type_missing_byte_size(self): def test_base_type_missing_encoding(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( DwarfDie( DW_TAG.base_type, ( @@ -251,7 +251,7 @@ def test_base_type_missing_encoding(self): def test_base_type_missing_name(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( DwarfDie( DW_TAG.base_type, ( @@ -270,7 +270,7 @@ def test_base_type_missing_name(self): def test_unknown_base_type_encoding(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( DwarfDie( DW_TAG.base_type, ( @@ -285,7 +285,7 @@ def test_unknown_base_type_encoding(self): def test_int_type_byteorder(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.base_type, @@ -305,7 +305,7 @@ def test_int_type_byteorder(self): def test_bool_type_byteorder(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.base_type, @@ -323,7 +323,7 @@ def test_bool_type_byteorder(self): def test_float_type_byteorder(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.base_type, @@ -347,7 +347,7 @@ def test_byteorder_by_name(self): # which luckily guarantees that we'll use the standard one when doing a # name lookup. prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.base_type, @@ -373,7 +373,7 @@ def test_byteorder_by_name(self): def test_qualifier(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.const_type, (DwarfAttrib(DW_AT.type, DW_FORM.ref4, 1),) @@ -389,7 +389,7 @@ def test_qualifier(self): def test_multiple_qualifiers(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.const_type, (DwarfAttrib(DW_AT.type, DW_FORM.ref4, 1),) @@ -423,14 +423,14 @@ def test_multiple_qualifiers(self): ) def test_qualifier_void(self): - prog = dwarf_program(test_type_dies(DwarfDie(DW_TAG.const_type, ()))) + prog = dwarf_program(wrap_test_type_dies(DwarfDie(DW_TAG.const_type, ()))) self.assertIdentical( prog.type("TEST").type, prog.void_type(qualifiers=Qualifiers.CONST) ) def test_multiple_qualifiers_void(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.const_type, (DwarfAttrib(DW_AT.type, DW_FORM.ref4, 1),) @@ -459,7 +459,7 @@ def test_multiple_qualifiers_void(self): def test_struct(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.structure_type, @@ -508,7 +508,7 @@ def test_struct(self): def test_struct_anonymous(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.structure_type, @@ -554,7 +554,7 @@ def test_struct_anonymous(self): def test_struct_no_members(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( DwarfDie( DW_TAG.structure_type, (DwarfAttrib(DW_AT.byte_size, DW_FORM.data1, 0),), @@ -565,7 +565,7 @@ def test_struct_no_members(self): def test_struct_incomplete(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( DwarfDie( DW_TAG.structure_type, ( @@ -579,7 +579,7 @@ def test_struct_incomplete(self): def test_struct_unnamed_member(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.structure_type, @@ -627,7 +627,7 @@ def test_struct_unnamed_member(self): def test_struct_member_missing_type(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( DwarfDie( DW_TAG.structure_type, (DwarfAttrib(DW_AT.byte_size, DW_FORM.data1, 4),), @@ -649,7 +649,7 @@ def test_struct_member_missing_type(self): def test_struct_member_invalid_type(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( DwarfDie( DW_TAG.structure_type, (DwarfAttrib(DW_AT.byte_size, DW_FORM.data1, 4),), @@ -672,7 +672,7 @@ def test_struct_member_invalid_type(self): def test_struct_member_invalid_location(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.structure_type, @@ -703,7 +703,7 @@ def test_struct_member_invalid_location(self): ) def test_struct_missing_size(self): - prog = dwarf_program(test_type_dies(DwarfDie(DW_TAG.structure_type, ()))) + prog = dwarf_program(wrap_test_type_dies(DwarfDie(DW_TAG.structure_type, ()))) self.assertRaisesRegex( Exception, "DW_TAG_structure_type has missing or invalid DW_AT_byte_size", @@ -713,7 +713,7 @@ def test_struct_missing_size(self): def test_struct_invalid_name(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( DwarfDie( DW_TAG.structure_type, ( @@ -729,7 +729,7 @@ def test_struct_invalid_name(self): def test_incomplete_to_complete(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.pointer_type, @@ -795,7 +795,7 @@ def test_incomplete_to_complete(self): def test_incomplete_to_complete_ambiguous(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.pointer_type, @@ -881,7 +881,7 @@ def test_incomplete_to_complete_ambiguous(self): def test_incomplete_to_complete_specification(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.pointer_type, @@ -1107,7 +1107,7 @@ def test_bit_field_data_bit_offset(self): ) for little_endian in [True, False]: - prog = dwarf_program(test_type_dies(dies), little_endian=little_endian) + prog = dwarf_program(wrap_test_type_dies(dies), little_endian=little_endian) self.assertIdentical( prog.type("TEST").type, prog.struct_type( @@ -1135,7 +1135,7 @@ def test_bit_field_data_bit_offset(self): def test_bit_field_bit_offset_big_endian(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.structure_type, @@ -1202,7 +1202,7 @@ def test_bit_field_bit_offset_big_endian(self): def test_bit_field_data_member_location_and_bit_offset_big_endian(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.structure_type, @@ -1275,7 +1275,7 @@ def test_bit_field_data_member_location_and_bit_offset_big_endian(self): def test_bit_field_data_member_location_and_bit_offset_little_endian(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.structure_type, @@ -1349,7 +1349,7 @@ def test_bit_field_data_member_location_and_bit_offset_with_byte_size_little_end self, ): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.structure_type, @@ -1423,7 +1423,7 @@ def test_bit_field_data_member_location_and_bit_offset_with_byte_size_little_end def test_union(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.union_type, @@ -1467,7 +1467,7 @@ def test_union(self): def test_class(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.class_type, @@ -1527,7 +1527,7 @@ def test_class(self): def test_class_template(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.class_type, @@ -1576,7 +1576,7 @@ def test_template_value_parameter_missing_value(self): Exception, "DW_AT_template_value_parameter is missing value" ): dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.class_type, @@ -1602,7 +1602,7 @@ def test_template_value_parameter_missing_value(self): def test_lazy_cycle(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.structure_type, @@ -1640,7 +1640,7 @@ def test_lazy_cycle(self): def test_infinite_cycle(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( DwarfDie( DW_TAG.pointer_type, ( @@ -1654,7 +1654,7 @@ def test_infinite_cycle(self): def test_enum(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.enumeration_type, @@ -1706,7 +1706,7 @@ def test_enum(self): def test_enum_anonymous(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.enumeration_type, @@ -1757,7 +1757,7 @@ def test_enum_anonymous(self): def test_enum_no_enumerators(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.enumeration_type, @@ -1778,7 +1778,7 @@ def test_enum_no_enumerators(self): def test_enum_incomplete(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( DwarfDie( DW_TAG.enumeration_type, ( @@ -1793,7 +1793,7 @@ def test_enum_incomplete(self): def test_enum_old_gcc(self): # GCC < 5.1 prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( DwarfDie( DW_TAG.enumeration_type, ( @@ -1842,7 +1842,7 @@ def test_enum_old_gcc(self): def test_enum_old_gcc_signed(self): # GCC < 5.1 prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( DwarfDie( DW_TAG.enumeration_type, ( @@ -1890,7 +1890,7 @@ def test_enum_old_gcc_signed(self): def test_enum_compatible_type_not_integer(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.enumeration_type, @@ -1911,7 +1911,7 @@ def test_enum_compatible_type_not_integer(self): ) def test_enum_missing_compatible_type_and_byte_size(self): - prog = dwarf_program(test_type_dies(DwarfDie(DW_TAG.enumeration_type, ()))) + prog = dwarf_program(wrap_test_type_dies(DwarfDie(DW_TAG.enumeration_type, ()))) self.assertRaisesRegex( Exception, "DW_TAG_enumeration_type has missing or invalid DW_AT_byte_size", @@ -1921,7 +1921,7 @@ def test_enum_missing_compatible_type_and_byte_size(self): def test_enum_invalid_name(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.enumeration_type, @@ -1944,7 +1944,7 @@ def test_enum_invalid_name(self): def test_enum_enumerator_missing_name(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.enumeration_type, @@ -1972,7 +1972,7 @@ def test_enum_enumerator_missing_name(self): def test_enum_enumerator_missing_const_value(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.enumeration_type, @@ -2000,7 +2000,7 @@ def test_enum_enumerator_missing_const_value(self): def test_enum_enumerator_invalid_const_value(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.enumeration_type, @@ -2183,7 +2183,7 @@ def test_tagged_by_name(self): def test_typedef(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.typedef, @@ -2203,7 +2203,7 @@ def test_typedef(self): def test_typedef_missing_name(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.typedef, (DwarfAttrib(DW_AT.type, DW_FORM.ref4, 1),) @@ -2221,7 +2221,7 @@ def test_typedef_missing_name(self): def test_typedef_void(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( DwarfDie( DW_TAG.typedef, (DwarfAttrib(DW_AT.name, DW_FORM.string, "VOID"),) ) @@ -2251,7 +2251,7 @@ def test_typedef_by_name(self): def test_pointer(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.pointer_type, @@ -2270,7 +2270,7 @@ def test_pointer(self): def test_pointer_explicit_size(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.pointer_type, @@ -2288,14 +2288,14 @@ def test_pointer_explicit_size(self): ) def test_pointer_void(self): - prog = dwarf_program(test_type_dies(DwarfDie(DW_TAG.pointer_type, ()))) + prog = dwarf_program(wrap_test_type_dies(DwarfDie(DW_TAG.pointer_type, ()))) self.assertIdentical( prog.type("TEST").type, prog.pointer_type(prog.void_type()) ) def test_array(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.array_type, @@ -2317,7 +2317,7 @@ def test_array(self): def test_array_two_dimensional(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.array_type, @@ -2344,7 +2344,7 @@ def test_array_two_dimensional(self): def test_array_three_dimensional(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.array_type, @@ -2377,7 +2377,7 @@ def test_array_three_dimensional(self): def test_array_missing_type(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.array_type, @@ -2399,7 +2399,7 @@ def test_array_missing_type(self): def test_array_zero_length_count(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.array_type, @@ -2421,7 +2421,7 @@ def test_array_zero_length_count(self): def test_array_zero_length_upper_bound(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.array_type, @@ -2443,7 +2443,7 @@ def test_array_zero_length_upper_bound(self): def test_incomplete_array_no_subrange(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.array_type, (DwarfAttrib(DW_AT.type, DW_FORM.ref4, 1),) @@ -2458,7 +2458,7 @@ def test_incomplete_array_no_subrange(self): def test_incomplete_array_empty_subrange(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.array_type, @@ -2475,7 +2475,7 @@ def test_incomplete_array_empty_subrange(self): def test_incomplete_array_of_array(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( # int [3][] ( DwarfDie( @@ -2500,7 +2500,7 @@ def test_incomplete_array_of_array(self): def test_array_of_zero_length_array(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( # int [3][0] ( DwarfDie( @@ -2529,7 +2529,7 @@ def test_array_of_zero_length_array(self): def test_array_of_zero_length_array_old_gcc(self): # GCC < 9.0 prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( # int [3][0] ( DwarfDie( @@ -2554,7 +2554,7 @@ def test_array_of_zero_length_array_old_gcc(self): def test_array_of_zero_length_array_typedef(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( # ZARRAY [3] DwarfDie( @@ -2603,7 +2603,7 @@ def test_array_of_zero_length_array_typedef_old_gcc(self): # GCC actually squashes arrays of typedef arrays into one array type, # but let's handle it like GCC < 9.0 anyways. prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( # ZARRAY [3] DwarfDie( @@ -2649,7 +2649,7 @@ def test_flexible_array_member(self): # int a[]; # }; prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.structure_type, @@ -2695,7 +2695,7 @@ def test_flexible_array_member(self): def test_typedef_flexible_array_member(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( # struct { # int i; @@ -2762,7 +2762,7 @@ def test_zero_length_array_only_member(self): # int a[0]; # }; prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.structure_type, @@ -2806,7 +2806,7 @@ def test_zero_length_array_only_member_old_gcc(self): # int a[0]; # }; prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.structure_type, @@ -2845,7 +2845,7 @@ def test_qualified_zero_length_array_only_member_old_gcc(self): # const int a[0]; # }; prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.structure_type, @@ -2892,7 +2892,7 @@ def test_qualified_zero_length_array_only_member_old_gcc(self): def test_typedef_zero_length_array_only_member(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( # struct foo { @@ -2984,7 +2984,7 @@ def test_typedef_zero_length_array_only_member_old_gcc(self): int_die, ) - prog = dwarf_program(test_type_dies(dies)) + prog = dwarf_program(wrap_test_type_dies(dies)) self.assertIdentical( prog.type("TEST").type, prog.struct_type( @@ -3009,7 +3009,7 @@ def test_typedef_zero_length_array_only_member_old_gcc(self): ) # Make sure it still works if we parse the array type first. - prog = dwarf_program(test_type_dies(dies)) + prog = dwarf_program(wrap_test_type_dies(dies)) self.assertIdentical( prog.type("ZARRAY"), prog.typedef_type("ZARRAY", prog.array_type(prog.int_type("int", 4, True))), @@ -3036,7 +3036,7 @@ def test_zero_length_array_not_last_member(self): # int i; # }; prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.structure_type, @@ -3091,7 +3091,7 @@ def test_zero_length_array_not_last_member_old_gcc(self): # int i; # }; prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.structure_type, @@ -3140,7 +3140,7 @@ def test_zero_length_array_in_union(self): # int a[0]; # }; prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.union_type, @@ -3195,7 +3195,7 @@ def test_zero_length_array_in_union_old_gcc(self): # int a[0]; # }; prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.union_type, @@ -3247,7 +3247,7 @@ def test_pointer_size(self): def test_function_no_parameters(self): # int foo(void) prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.subroutine_type, @@ -3264,7 +3264,7 @@ def test_function_no_parameters(self): def test_function_void_return(self): # void foo(void) - prog = dwarf_program(test_type_dies(DwarfDie(DW_TAG.subroutine_type, ()))) + prog = dwarf_program(wrap_test_type_dies(DwarfDie(DW_TAG.subroutine_type, ()))) self.assertIdentical( prog.type("TEST").type, prog.function_type(prog.void_type(), (), False) ) @@ -3272,7 +3272,7 @@ def test_function_void_return(self): def test_function_unnamed_parameter(self): # int foo(char) prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.subroutine_type, @@ -3301,7 +3301,7 @@ def test_function_unnamed_parameter(self): def test_function_named_parameter(self): # int foo(char c) prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.subroutine_type, @@ -3333,7 +3333,7 @@ def test_function_named_parameter(self): def test_function_unspecified_parameters(self): # int foo() prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.subroutine_type, @@ -3352,7 +3352,7 @@ def test_function_unspecified_parameters(self): def test_function_variadic(self): # int foo(char, ...) prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.subroutine_type, @@ -3384,7 +3384,7 @@ def test_function_incomplete_array_parameter(self): # Note that in C, this is equivalent to void foo(int *), so GCC and # Clang emit the DWARF for the latter. prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.subroutine_type, @@ -3414,7 +3414,7 @@ def test_function_incomplete_array_parameter(self): def test_function_template(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( DwarfDie( DW_TAG.subroutine_type, @@ -3458,12 +3458,12 @@ def test_function_template(self): def test_language(self): for name, lang in DW_LANG.__members__.items(): if re.fullmatch("C[0-9]*", name): - prog = dwarf_program(test_type_dies(int_die), lang=lang) + prog = dwarf_program(wrap_test_type_dies(int_die), lang=lang) self.assertIdentical( prog.type("TEST").type, prog.int_type("int", 4, True, language=Language.C), ) - prog = dwarf_program(test_type_dies(int_die), lang=DW_LANG.BLISS) + prog = dwarf_program(wrap_test_type_dies(int_die), lang=DW_LANG.BLISS) self.assertIdentical( prog.type("TEST").type, prog.int_type("int", 4, True, language=DEFAULT_LANGUAGE), @@ -3571,7 +3571,7 @@ def test_constant_unsigned_enum(self): def test_function(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( int_die, DwarfDie( @@ -3614,7 +3614,7 @@ def test_function(self): def test_function_no_address(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( DwarfDie( DW_TAG.subprogram, (DwarfAttrib(DW_AT.name, DW_FORM.string, "abort"),), @@ -3627,7 +3627,7 @@ def test_function_no_address(self): def test_variable(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( int_die, DwarfDie( @@ -3660,7 +3660,7 @@ def test_variable(self): def test_variable_no_address(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( int_die, DwarfDie( @@ -3677,7 +3677,7 @@ def test_variable_no_address(self): def test_variable_unimplemented_location(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( int_die, DwarfDie( @@ -3703,7 +3703,7 @@ def test_variable_const_signed(self): ): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( int_die, DwarfDie( @@ -3730,7 +3730,7 @@ def test_variable_const_unsigned(self): DW_FORM.udata, ): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( unsigned_int_die, DwarfDie( @@ -3750,7 +3750,7 @@ def test_variable_const_unsigned(self): def test_variable_const_block(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( int_die, DwarfDie( @@ -3785,7 +3785,7 @@ def test_variable_const_block(self): def test_variable_const_block_too_small(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( int_die, DwarfDie( @@ -3817,7 +3817,7 @@ def test_variable_const_block_too_small(self): def test_specification(self): prog = dwarf_program( - test_type_dies( + wrap_test_type_dies( ( int_die, DwarfDie( @@ -4086,7 +4086,7 @@ def test_reference_counting_type_member(self): self.assertIsNotNone(repr(dwarf_program(dies).type("struct foo").members[0])) def test_reference_counting_type_parameter(self): - dies = test_type_dies( + dies = wrap_test_type_dies( ( DwarfDie( DW_TAG.subroutine_type, diff --git a/tests/test_language_c.py b/tests/test_language_c.py index 9ec4c3cee..76b8a8f9e 100644 --- a/tests/test_language_c.py +++ b/tests/test_language_c.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later from functools import reduce import operator diff --git a/tests/test_lexer.py b/tests/test_lexer.py index db92b4481..0b8a7786c 100644 --- a/tests/test_lexer.py +++ b/tests/test_lexer.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import unittest diff --git a/tests/test_object.py b/tests/test_object.py index e4ba9c14f..0d6994bfc 100644 --- a/tests/test_object.py +++ b/tests/test_object.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import math import operator diff --git a/tests/test_path.py b/tests/test_path.py index e3c0a7b9d..10b96c358 100644 --- a/tests/test_path.py +++ b/tests/test_path.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import itertools import os.path diff --git a/tests/test_platform.py b/tests/test_platform.py index 2d2402785..9e11c65bf 100644 --- a/tests/test_platform.py +++ b/tests/test_platform.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import itertools import unittest diff --git a/tests/test_program.py b/tests/test_program.py index e88d08df9..87d2f0b1e 100644 --- a/tests/test_program.py +++ b/tests/test_program.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import ctypes import itertools @@ -320,7 +320,7 @@ def test_invalid_read_fn(self): ) self.assertRaisesRegex( ValueError, - "memory read callback returned buffer of length 0 \(expected 8\)", + r"memory read callback returned buffer of length 0 \(expected 8\)", prog.read, 0xFFFF0000, 8, diff --git a/tests/test_python.py b/tests/test_python.py index 183495e6a..5a108b676 100644 --- a/tests/test_python.py +++ b/tests/test_python.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import unittest diff --git a/tests/test_serialize.py b/tests/test_serialize.py index eb52e05c9..ae03048bc 100644 --- a/tests/test_serialize.py +++ b/tests/test_serialize.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import unittest diff --git a/tests/test_type.py b/tests/test_type.py index 79fdd4993..2ebfa1ad6 100644 --- a/tests/test_type.py +++ b/tests/test_type.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import operator @@ -862,7 +862,7 @@ def test_function(self): ) self.assertRaisesRegex( - TypeError, "must be _drgn\.Type", self.prog.function_type, None, () + TypeError, r"must be _drgn\.Type", self.prog.function_type, None, () ) self.assertRaisesRegex( TypeError, diff --git a/tests/test_util.py b/tests/test_util.py index a88e4761b..20eadfe94 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later from functools import cmp_to_key import unittest diff --git a/tools/bpf_inspect.py b/tools/bpf_inspect.py index 09d263370..177494050 100755 --- a/tools/bpf_inspect.py +++ b/tools/bpf_inspect.py @@ -1,6 +1,6 @@ #!/usr/bin/env drgn # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later DESCRIPTION = """ drgn script to list BPF programs or maps and their properties diff --git a/util.py b/util.py index cc00103ed..6a3070ab1 100644 --- a/util.py +++ b/util.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later from functools import total_ordering import os diff --git a/vmtest/download.py b/vmtest/download.py index 3a7395698..bfaad391c 100644 --- a/vmtest/download.py +++ b/vmtest/download.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import fnmatch import glob diff --git a/vmtest/manage.py b/vmtest/manage.py index 16fb2a4bc..0f53a123e 100644 --- a/vmtest/manage.py +++ b/vmtest/manage.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import argparse import asyncio diff --git a/vmtest/onoatimehack.c b/vmtest/onoatimehack.c index b4390bf08..9042c7380 100644 --- a/vmtest/onoatimehack.c +++ b/vmtest/onoatimehack.c @@ -1,5 +1,5 @@ // Copyright (c) Facebook, Inc. and its affiliates. -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: GPL-3.0-or-later /* * QEMU's 9pfs server passes through O_NOATIME from the client. If the server diff --git a/vmtest/vm.py b/vmtest/vm.py index 685f32439..eae3c4e7c 100644 --- a/vmtest/vm.py +++ b/vmtest/vm.py @@ -1,5 +1,5 @@ # Copyright (c) Facebook, Inc. and its affiliates. -# SPDX-License-Identifier: GPL-3.0+ +# SPDX-License-Identifier: GPL-3.0-or-later import errno import os