diff --git a/tools/msys/mingw32/bin/gdb-add-index b/tools/msys/mingw32/bin/gdb-add-index new file mode 100644 index 0000000000000000000000000000000000000000..b8324f1b21e98bd231dc93e3431f4ce71e53e5ec --- /dev/null +++ b/tools/msys/mingw32/bin/gdb-add-index @@ -0,0 +1,160 @@ +#! /bin/sh + +# Add a .gdb_index section to a file. + +# Copyright (C) 2010-2020 Free Software Foundation, Inc. +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# This program assumes gdb and objcopy are in $PATH. +# If not, or you want others, pass the following in the environment +GDB=${GDB:=gdb} +OBJCOPY=${OBJCOPY:=objcopy} +READELF=${READELF:=readelf} + +myname="${0##*/}" + +dwarf5="" +if [ "$1" = "-dwarf-5" ]; then + dwarf5="$1" + shift +fi + +if test $# != 1; then + echo "usage: $myname [-dwarf-5] FILE" 1>&2 + exit 1 +fi + +file="$1" + +if test ! -r "$file"; then + echo "$myname: unable to access: $file" 1>&2 + exit 1 +fi + +dir="${file%/*}" +test "$dir" = "$file" && dir="." + +dwz_file="" +if $READELF -S "$file" | grep -q " \.gnu_debugaltlink "; then + dwz_file=$($READELF --string-dump=.gnu_debugaltlink "$file" \ + | grep -A1 "'\.gnu_debugaltlink':" \ + | tail -n +2 \ + | sed 's/.*]//') + dwz_file=$(echo $dwz_file) + if $READELF -S "$dwz_file" | grep -E -q " \.(gdb_index|debug_names) "; then + # Already has an index, skip it. + dwz_file="" + fi +fi + +set_files () +{ + local file="$1" + + index4="${file}.gdb-index" + index5="${file}.debug_names" + debugstr="${file}.debug_str" + debugstrmerge="${file}.debug_str.merge" + debugstrerr="${file}.debug_str.err" +} + +tmp_files= +for f in "$file" "$dwz_file"; do + if [ "$f" = "" ]; then + continue + fi + set_files "$f" + tmp_files="$tmp_files $index4 $index5 $debugstr $debugstrmerge $debugstrerr" +done + +rm -f $tmp_files + +# Ensure intermediate index file is removed when we exit. +trap "rm -f $tmp_files" 0 + +$GDB --batch -nx -iex 'set auto-load no' \ + -ex "file $file" -ex "save gdb-index $dwarf5 $dir" || { + # Just in case. + status=$? + echo "$myname: gdb error generating index for $file" 1>&2 + exit $status +} + +# In some situations gdb can exit without creating an index. This is +# not an error. +# E.g., if $file is stripped. This behaviour is akin to stripping an +# already stripped binary, it's a no-op. +status=0 + +handle_file () +{ + local file + file="$1" + + set_files "$file" + + if test -f "$index4" -a -f "$index5"; then + echo "$myname: Both index types were created for $file" 1>&2 + status=1 + elif test -f "$index4" -o -f "$index5"; then + if test -f "$index4"; then + index="$index4" + section=".gdb_index" + else + index="$index5" + section=".debug_names" + fi + debugstradd=false + debugstrupdate=false + if test -s "$debugstr"; then + if ! $OBJCOPY --dump-section .debug_str="$debugstrmerge" "$file" \ + /dev/null 2>$debugstrerr; then + cat >&2 $debugstrerr + exit 1 + fi + if grep -q "can't dump section '.debug_str' - it does not exist" \ + $debugstrerr; then + debugstradd=true + else + debugstrupdate=true + cat >&2 $debugstrerr + fi + cat "$debugstr" >>"$debugstrmerge" + fi + + $OBJCOPY --add-section $section="$index" \ + --set-section-flags $section=readonly \ + $(if $debugstradd; then \ + echo --add-section .debug_str="$debugstrmerge"; \ + echo --set-section-flags .debug_str=readonly; \ + fi; \ + if $debugstrupdate; then \ + echo --update-section .debug_str="$debugstrmerge"; \ + fi) \ + "$file" "$file" + + status=$? + else + echo "$myname: No index was created for $file" 1>&2 + echo "$myname: [Was there no debuginfo? Was there already an index?]" \ + 1>&2 + fi +} + +handle_file "$file" +if [ "$dwz_file" != "" ]; then + handle_file "$dwz_file" +fi + +exit $status diff --git a/tools/msys/mingw32/bin/gdb.exe b/tools/msys/mingw32/bin/gdb.exe new file mode 100644 index 0000000000000000000000000000000000000000..9a267b4f743d9f2fc8864e48da30c85dc57c266c Binary files /dev/null and b/tools/msys/mingw32/bin/gdb.exe differ diff --git a/tools/msys/mingw32/bin/gdbserver.exe b/tools/msys/mingw32/bin/gdbserver.exe new file mode 100644 index 0000000000000000000000000000000000000000..5ef7c97d27ccbe95604f0c38b72054dde3b6abc9 Binary files /dev/null and b/tools/msys/mingw32/bin/gdbserver.exe differ diff --git a/tools/msys/mingw32/bin/libxxhash.dll b/tools/msys/mingw32/bin/libxxhash.dll new file mode 100644 index 0000000000000000000000000000000000000000..c74c196a5761fb23d275acca2faf2c5e93704aa3 Binary files /dev/null and b/tools/msys/mingw32/bin/libxxhash.dll differ diff --git a/tools/msys/mingw32/bin/xxhsum.exe b/tools/msys/mingw32/bin/xxhsum.exe new file mode 100644 index 0000000000000000000000000000000000000000..f9970a2e65ce2bf2792331dd70de1d8449f30f54 Binary files /dev/null and b/tools/msys/mingw32/bin/xxhsum.exe differ diff --git a/tools/msys/mingw32/include/gdb/jit-reader.h b/tools/msys/mingw32/include/gdb/jit-reader.h new file mode 100644 index 0000000000000000000000000000000000000000..a51031f06ff89bcb52b47aa37de58fd68f4cf39c --- /dev/null +++ b/tools/msys/mingw32/include/gdb/jit-reader.h @@ -0,0 +1,346 @@ +/* JIT declarations for GDB, the GNU Debugger. + + Copyright (C) 2011-2020 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#ifndef GDB_JIT_READER_H +#define GDB_JIT_READER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Versioning information. See gdb_reader_funcs. */ + +#define GDB_READER_INTERFACE_VERSION 1 + +/* Readers must be released under a GPL compatible license. To + declare that the reader is indeed released under a GPL compatible + license, invoke the macro GDB_DECLARE_GPL_COMPATIBLE in a source + file. */ + +#ifdef __cplusplus +#define GDB_DECLARE_GPL_COMPATIBLE_READER \ + extern "C" { \ + extern int plugin_is_GPL_compatible (void); \ + extern int plugin_is_GPL_compatible (void) \ + { \ + return 0; \ + } \ + } + +#else + +#define GDB_DECLARE_GPL_COMPATIBLE_READER \ + extern int plugin_is_GPL_compatible (void); \ + extern int plugin_is_GPL_compatible (void) \ + { \ + return 0; \ + } + +#endif + +/* Represents an address on the target system. */ + +typedef unsigned long long GDB_CORE_ADDR; + +/* Return status codes. */ + +enum gdb_status { + GDB_FAIL = 0, + GDB_SUCCESS = 1 +}; + +struct gdb_object; +struct gdb_symtab; +struct gdb_block; +struct gdb_symbol_callbacks; + +/* An array of these are used to represent a map from code addresses to line + numbers in the source file. */ + +struct gdb_line_mapping +{ + int line; + GDB_CORE_ADDR pc; +}; + +/* Create a new GDB code object. Each code object can have one or + more symbol tables, each representing a compiled source file. */ + +typedef struct gdb_object *(gdb_object_open) (struct gdb_symbol_callbacks *cb); + +/* The callback used to create new symbol table. CB is the + gdb_symbol_callbacks which the structure is part of. FILE_NAME is + an (optionally NULL) file name to associate with this new symbol + table. + + Returns a new instance to gdb_symtab that can later be passed to + gdb_block_new, gdb_symtab_add_line_mapping and gdb_symtab_close. */ + +typedef struct gdb_symtab *(gdb_symtab_open) (struct gdb_symbol_callbacks *cb, + struct gdb_object *obj, + const char *file_name); + +/* Creates a new block in a given symbol table. A symbol table is a + forest of blocks, each block representing an code address range and + a corresponding (optionally NULL) NAME. In case the block + corresponds to a function, the NAME passed should be the name of + the function. + + If the new block to be created is a child of (i.e. is nested in) + another block, the parent block can be passed in PARENT. SYMTAB is + the symbol table the new block is to belong in. BEGIN, END is the + code address range the block corresponds to. + + Returns a new instance of gdb_block, which, as of now, has no use. + Note that the gdb_block returned must not be freed by the + caller. */ + +typedef struct gdb_block *(gdb_block_open) (struct gdb_symbol_callbacks *cb, + struct gdb_symtab *symtab, + struct gdb_block *parent, + GDB_CORE_ADDR begin, + GDB_CORE_ADDR end, + const char *name); + +/* Adds a PC to line number mapping for the symbol table SYMTAB. + NLINES is the number of elements in LINES, each element + corresponding to one (PC, line) pair. */ + +typedef void (gdb_symtab_add_line_mapping) (struct gdb_symbol_callbacks *cb, + struct gdb_symtab *symtab, + int nlines, + struct gdb_line_mapping *lines); + +/* Close the symtab SYMTAB. This signals to GDB that no more blocks + will be opened on this symtab. */ + +typedef void (gdb_symtab_close) (struct gdb_symbol_callbacks *cb, + struct gdb_symtab *symtab); + + +/* Closes the gdb_object OBJ and adds the emitted information into + GDB's internal structures. Once this is done, the debug + information will be picked up and used; this will usually be the + last operation in gdb_read_debug_info. */ + +typedef void (gdb_object_close) (struct gdb_symbol_callbacks *cb, + struct gdb_object *obj); + +/* Reads LEN bytes from TARGET_MEM in the target's virtual address + space into GDB_BUF. + + Returns GDB_FAIL on failure, and GDB_SUCCESS on success. */ + +typedef enum gdb_status (gdb_target_read) (GDB_CORE_ADDR target_mem, + void *gdb_buf, int len); + +/* The list of callbacks that are passed to read. These callbacks are + to be used to construct the symbol table. The functions have been + described above. */ + +struct gdb_symbol_callbacks +{ + gdb_object_open *object_open; + gdb_symtab_open *symtab_open; + gdb_block_open *block_open; + gdb_symtab_close *symtab_close; + gdb_object_close *object_close; + + gdb_symtab_add_line_mapping *line_mapping_add; + gdb_target_read *target_read; + + /* For internal use by GDB. */ + void *priv_data; +}; + +/* Forward declaration. */ + +struct gdb_reg_value; + +/* A function of this type is used to free a gdb_reg_value. See the + comment on `free' in struct gdb_reg_value. */ + +typedef void (gdb_reg_value_free) (struct gdb_reg_value *); + +/* Denotes the value of a register. */ + +struct gdb_reg_value +{ + /* The size of the register in bytes. The reader need not set this + field. This will be set for (defined) register values being read + from GDB using reg_get. */ + int size; + + /* Set to non-zero if the value for the register is known. The + registers for which the reader does not call reg_set are also + assumed to be undefined */ + int defined; + + /* Since gdb_reg_value is a variable sized structure, it will + usually be allocated on the heap. This function is expected to + contain the corresponding "free" function. + + When a pointer to gdb_reg_value is being sent from GDB to the + reader (via gdb_unwind_reg_get), the reader is expected to call + this function (with the same gdb_reg_value as argument) once it + is done with the value. + + When the function sends the a gdb_reg_value to GDB (via + gdb_unwind_reg_set), it is expected to set this field to point to + an appropriate cleanup routine (or to NULL if no cleanup is + required). */ + gdb_reg_value_free *free; + + /* The value of the register. */ + unsigned char value[1]; +}; + +/* get_frame_id in gdb_reader_funcs is to return a gdb_frame_id + corresponding to the current frame. The registers corresponding to + the current frame can be read using reg_get. Calling get_frame_id + on a particular frame should return the same gdb_frame_id + throughout its lifetime (i.e. till before it gets unwound). One + way to do this is by having the CODE_ADDRESS point to the + function's first instruction and STACK_ADDRESS point to the value + of the stack pointer when entering the function. */ + +struct gdb_frame_id +{ + GDB_CORE_ADDR code_address; + GDB_CORE_ADDR stack_address; +}; + +/* Forward declaration. */ + +struct gdb_unwind_callbacks; + +/* Returns the value of a particular register in the current frame. + The current frame is the frame that needs to be unwound into the + outer (earlier) frame. + + CB is the struct gdb_unwind_callbacks * the callback belongs to. + REGNUM is the DWARF register number of the register that needs to + be unwound. + + Returns the gdb_reg_value corresponding to the register requested. + In case the value of the register has been optimized away or + otherwise unavailable, the defined flag in the returned + gdb_reg_value will be zero. */ + +typedef struct gdb_reg_value *(gdb_unwind_reg_get) + (struct gdb_unwind_callbacks *cb, int regnum); + +/* Sets the previous value of a particular register. REGNUM is the + (DWARF) register number whose value is to be set. VAL is the value + the register is to be set to. + + VAL is *not* copied, so the memory allocated to it cannot be + reused. Once GDB no longer needs the value, it is deallocated + using the FREE function (see gdb_reg_value). + + A register can also be "set" to an undefined value by setting the + defined in VAL to zero. */ + +typedef void (gdb_unwind_reg_set) (struct gdb_unwind_callbacks *cb, int regnum, + struct gdb_reg_value *val); + +/* This struct is passed to unwind in gdb_reader_funcs, and is to be + used to unwind the current frame (current being the frame whose + registers can be read using reg_get) into the earlier frame. The + functions have been described above. */ + +struct gdb_unwind_callbacks +{ + gdb_unwind_reg_get *reg_get; + gdb_unwind_reg_set *reg_set; + gdb_target_read *target_read; + + /* For internal use by GDB. */ + void *priv_data; +}; + +/* Forward declaration. */ + +struct gdb_reader_funcs; + +/* Parse the debug info off a block of memory, pointed to by MEMORY + (already copied to GDB's address space) and MEMORY_SZ bytes long. + The implementation has to use the functions in CB to actually emit + the parsed data into GDB. SELF is the same structure returned by + gdb_init_reader. + + Return GDB_FAIL on failure and GDB_SUCCESS on success. */ + +typedef enum gdb_status (gdb_read_debug_info) (struct gdb_reader_funcs *self, + struct gdb_symbol_callbacks *cb, + void *memory, long memory_sz); + +/* Unwind the current frame, CB is the set of unwind callbacks that + are to be used to do this. + + Return GDB_FAIL on failure and GDB_SUCCESS on success. */ + +typedef enum gdb_status (gdb_unwind_frame) (struct gdb_reader_funcs *self, + struct gdb_unwind_callbacks *cb); + +/* Return the frame ID corresponding to the current frame, using C to + read the current register values. See the comment on struct + gdb_frame_id. */ + +typedef struct gdb_frame_id (gdb_get_frame_id) (struct gdb_reader_funcs *self, + struct gdb_unwind_callbacks *c); + +/* Called when a reader is being unloaded. This function should also + free SELF, if required. */ + +typedef void (gdb_destroy_reader) (struct gdb_reader_funcs *self); + +/* Called when the reader is loaded. Must either return a properly + populated gdb_reader_funcs or NULL. The memory allocated for the + gdb_reader_funcs is to be managed by the reader itself (i.e. if it + is allocated from the heap, it must also be freed in + gdb_destroy_reader). */ + +extern struct gdb_reader_funcs *gdb_init_reader (void); + +/* Pointer to the functions which implement the reader's + functionality. The individual functions have been documented + above. + + None of the fields are optional. */ + +struct gdb_reader_funcs +{ + /* Must be set to GDB_READER_INTERFACE_VERSION. */ + int reader_version; + + /* For use by the reader. */ + void *priv_data; + + gdb_read_debug_info *read; + gdb_unwind_frame *unwind; + gdb_get_frame_id *get_frame_id; + gdb_destroy_reader *destroy; +}; + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/tools/msys/mingw32/include/xxh3.h b/tools/msys/mingw32/include/xxh3.h new file mode 100644 index 0000000000000000000000000000000000000000..7e83e6418af2c01312ef8b1308bf45b9f3ae6ac2 --- /dev/null +++ b/tools/msys/mingw32/include/xxh3.h @@ -0,0 +1,55 @@ +/* + * xxHash - Extremely Fast Hash algorithm + * Development source file for `xxh3` + * Copyright (C) 2019-2020 Yann Collet + * + * BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * You can contact the author at: + * - xxHash homepage: https://www.xxhash.com + * - xxHash source repository: https://github.com/Cyan4973/xxHash + */ + +/* + * Note: This file used to host the source code of XXH3_* variants. + * during the development period. + * The source code is now properly integrated within xxhash.h. + * + * xxh3.h is no longer useful, + * but it is still provided for compatibility with source code + * which used to include it directly. + * + * Programs are now highly discourage to include xxh3.h. + * Include `xxhash.h` instead, which is the officially supported interface. + * + * In the future, xxh3.h will start to generate warnings, then errors, + * then it will be removed from source package and from include directory. + */ + +/* Simulate the same impact as including the old xxh3.h source file */ + +#define XXH_INLINE_ALL +#include "xxhash.h" diff --git a/tools/msys/mingw32/include/xxhash.h b/tools/msys/mingw32/include/xxhash.h new file mode 100644 index 0000000000000000000000000000000000000000..2d56d23c5d0beac4c1a4cab22da660674d0e0080 --- /dev/null +++ b/tools/msys/mingw32/include/xxhash.h @@ -0,0 +1,4766 @@ +/* + * xxHash - Extremely Fast Hash algorithm + * Header File + * Copyright (C) 2012-2020 Yann Collet + * + * BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * You can contact the author at: + * - xxHash homepage: https://www.xxhash.com + * - xxHash source repository: https://github.com/Cyan4973/xxHash + */ + +/* TODO: update */ +/* Notice extracted from xxHash homepage: + +xxHash is an extremely fast hash algorithm, running at RAM speed limits. +It also successfully passes all tests from the SMHasher suite. + +Comparison (single thread, Windows Seven 32 bits, using SMHasher on a Core 2 Duo @3GHz) + +Name Speed Q.Score Author +xxHash 5.4 GB/s 10 +CrapWow 3.2 GB/s 2 Andrew +MumurHash 3a 2.7 GB/s 10 Austin Appleby +SpookyHash 2.0 GB/s 10 Bob Jenkins +SBox 1.4 GB/s 9 Bret Mulvey +Lookup3 1.2 GB/s 9 Bob Jenkins +SuperFastHash 1.2 GB/s 1 Paul Hsieh +CityHash64 1.05 GB/s 10 Pike & Alakuijala +FNV 0.55 GB/s 5 Fowler, Noll, Vo +CRC32 0.43 GB/s 9 +MD5-32 0.33 GB/s 10 Ronald L. Rivest +SHA1-32 0.28 GB/s 10 + +Q.Score is a measure of quality of the hash function. +It depends on successfully passing SMHasher test set. +10 is a perfect score. + +Note: SMHasher's CRC32 implementation is not the fastest one. +Other speed-oriented implementations can be faster, +especially in combination with PCLMUL instruction: +https://fastcompression.blogspot.com/2019/03/presenting-xxh3.html?showComment=1552696407071#c3490092340461170735 + +A 64-bit version, named XXH64, is available since r35. +It offers much better speed, but for 64-bit applications only. +Name Speed on 64 bits Speed on 32 bits +XXH64 13.8 GB/s 1.9 GB/s +XXH32 6.8 GB/s 6.0 GB/s +*/ + +#if defined (__cplusplus) +extern "C" { +#endif + +/* **************************** + * INLINE mode + ******************************/ +/*! + * XXH_INLINE_ALL (and XXH_PRIVATE_API) + * Use these build macros to inline xxhash into the target unit. + * Inlining improves performance on small inputs, especially when the length is + * expressed as a compile-time constant: + * + * https://fastcompression.blogspot.com/2018/03/xxhash-for-small-keys-impressive-power.html + * + * It also keeps xxHash symbols private to the unit, so they are not exported. + * + * Usage: + * #define XXH_INLINE_ALL + * #include "xxhash.h" + * + * Do not compile and link xxhash.o as a separate object, as it is not useful. + */ +#if (defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API)) \ + && !defined(XXH_INLINE_ALL_31684351384) + /* this section should be traversed only once */ +# define XXH_INLINE_ALL_31684351384 + /* give access to the advanced API, required to compile implementations */ +# undef XXH_STATIC_LINKING_ONLY /* avoid macro redef */ +# define XXH_STATIC_LINKING_ONLY + /* make all functions private */ +# undef XXH_PUBLIC_API +# if defined(__GNUC__) +# define XXH_PUBLIC_API static __inline __attribute__((unused)) +# elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) +# define XXH_PUBLIC_API static inline +# elif defined(_MSC_VER) +# define XXH_PUBLIC_API static __inline +# else + /* note: this version may generate warnings for unused static functions */ +# define XXH_PUBLIC_API static +# endif + + /* + * This part deals with the special case where a unit wants to inline xxHash, + * but "xxhash.h" has previously been included without XXH_INLINE_ALL, such + * as part of some previously included *.h header file. + * Without further action, the new include would just be ignored, + * and functions would effectively _not_ be inlined (silent failure). + * The following macros solve this situation by prefixing all inlined names, + * avoiding naming collision with previous inclusions. + */ +# ifdef XXH_NAMESPACE +# error "XXH_INLINE_ALL with XXH_NAMESPACE is not supported" + /* + * Note: Alternative: #undef all symbols (it's a pretty large list). + * Without #error: it compiles, but functions are actually not inlined. + */ +# endif +# define XXH_NAMESPACE XXH_INLINE_ + /* + * Some identifiers (enums, type names) are not symbols, but they must + * still be renamed to avoid redeclaration. + * Alternative solution: do not redeclare them. + * However, this requires some #ifdefs, and is a more dispersed action. + * Meanwhile, renaming can be achieved in a single block + */ +# define XXH_IPREF(Id) XXH_INLINE_ ## Id +# define XXH_OK XXH_IPREF(XXH_OK) +# define XXH_ERROR XXH_IPREF(XXH_ERROR) +# define XXH_errorcode XXH_IPREF(XXH_errorcode) +# define XXH32_canonical_t XXH_IPREF(XXH32_canonical_t) +# define XXH64_canonical_t XXH_IPREF(XXH64_canonical_t) +# define XXH128_canonical_t XXH_IPREF(XXH128_canonical_t) +# define XXH32_state_s XXH_IPREF(XXH32_state_s) +# define XXH32_state_t XXH_IPREF(XXH32_state_t) +# define XXH64_state_s XXH_IPREF(XXH64_state_s) +# define XXH64_state_t XXH_IPREF(XXH64_state_t) +# define XXH3_state_s XXH_IPREF(XXH3_state_s) +# define XXH3_state_t XXH_IPREF(XXH3_state_t) +# define XXH128_hash_t XXH_IPREF(XXH128_hash_t) + /* Ensure the header is parsed again, even if it was previously included */ +# undef XXHASH_H_5627135585666179 +# undef XXHASH_H_STATIC_13879238742 +#endif /* XXH_INLINE_ALL || XXH_PRIVATE_API */ + + + +/* **************************************************************** + * Stable API + *****************************************************************/ +#ifndef XXHASH_H_5627135585666179 +#define XXHASH_H_5627135585666179 1 + +/* specific declaration modes for Windows */ +#if !defined(XXH_INLINE_ALL) && !defined(XXH_PRIVATE_API) +# if defined(WIN32) && defined(_MSC_VER) && (defined(XXH_IMPORT) || defined(XXH_EXPORT)) +# ifdef XXH_EXPORT +# define XXH_PUBLIC_API __declspec(dllexport) +# elif XXH_IMPORT +# define XXH_PUBLIC_API __declspec(dllimport) +# endif +# else +# define XXH_PUBLIC_API /* do nothing */ +# endif +#endif + +/*! + * XXH_NAMESPACE, aka Namespace Emulation: + * + * If you want to include _and expose_ xxHash functions from within your own + * library, but also want to avoid symbol collisions with other libraries which + * may also include xxHash, you can use XXH_NAMESPACE to automatically prefix + * any public symbol from xxhash library with the value of XXH_NAMESPACE + * (therefore, avoid empty or numeric values). + * + * Note that no change is required within the calling program as long as it + * includes `xxhash.h`: Regular symbol names will be automatically translated + * by this header. + */ +#ifdef XXH_NAMESPACE +# define XXH_CAT(A,B) A##B +# define XXH_NAME2(A,B) XXH_CAT(A,B) +# define XXH_versionNumber XXH_NAME2(XXH_NAMESPACE, XXH_versionNumber) +/* XXH32 */ +# define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32) +# define XXH32_createState XXH_NAME2(XXH_NAMESPACE, XXH32_createState) +# define XXH32_freeState XXH_NAME2(XXH_NAMESPACE, XXH32_freeState) +# define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset) +# define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update) +# define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest) +# define XXH32_copyState XXH_NAME2(XXH_NAMESPACE, XXH32_copyState) +# define XXH32_canonicalFromHash XXH_NAME2(XXH_NAMESPACE, XXH32_canonicalFromHash) +# define XXH32_hashFromCanonical XXH_NAME2(XXH_NAMESPACE, XXH32_hashFromCanonical) +/* XXH64 */ +# define XXH64 XXH_NAME2(XXH_NAMESPACE, XXH64) +# define XXH64_createState XXH_NAME2(XXH_NAMESPACE, XXH64_createState) +# define XXH64_freeState XXH_NAME2(XXH_NAMESPACE, XXH64_freeState) +# define XXH64_reset XXH_NAME2(XXH_NAMESPACE, XXH64_reset) +# define XXH64_update XXH_NAME2(XXH_NAMESPACE, XXH64_update) +# define XXH64_digest XXH_NAME2(XXH_NAMESPACE, XXH64_digest) +# define XXH64_copyState XXH_NAME2(XXH_NAMESPACE, XXH64_copyState) +# define XXH64_canonicalFromHash XXH_NAME2(XXH_NAMESPACE, XXH64_canonicalFromHash) +# define XXH64_hashFromCanonical XXH_NAME2(XXH_NAMESPACE, XXH64_hashFromCanonical) +/* XXH3_64bits */ +# define XXH3_64bits XXH_NAME2(XXH_NAMESPACE, XXH3_64bits) +# define XXH3_64bits_withSecret XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_withSecret) +# define XXH3_64bits_withSeed XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_withSeed) +# define XXH3_createState XXH_NAME2(XXH_NAMESPACE, XXH3_createState) +# define XXH3_freeState XXH_NAME2(XXH_NAMESPACE, XXH3_freeState) +# define XXH3_copyState XXH_NAME2(XXH_NAMESPACE, XXH3_copyState) +# define XXH3_64bits_reset XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_reset) +# define XXH3_64bits_reset_withSeed XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_reset_withSeed) +# define XXH3_64bits_reset_withSecret XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_reset_withSecret) +# define XXH3_64bits_update XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_update) +# define XXH3_64bits_digest XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_digest) +# define XXH3_generateSecret XXH_NAME2(XXH_NAMESPACE, XXH3_generateSecret) +/* XXH3_128bits */ +# define XXH128 XXH_NAME2(XXH_NAMESPACE, XXH128) +# define XXH3_128bits XXH_NAME2(XXH_NAMESPACE, XXH3_128bits) +# define XXH3_128bits_withSeed XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_withSeed) +# define XXH3_128bits_withSecret XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_withSecret) +# define XXH3_128bits_reset XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_reset) +# define XXH3_128bits_reset_withSeed XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_reset_withSeed) +# define XXH3_128bits_reset_withSecret XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_reset_withSecret) +# define XXH3_128bits_update XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_update) +# define XXH3_128bits_digest XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_digest) +# define XXH128_isEqual XXH_NAME2(XXH_NAMESPACE, XXH128_isEqual) +# define XXH128_cmp XXH_NAME2(XXH_NAMESPACE, XXH128_cmp) +# define XXH128_canonicalFromHash XXH_NAME2(XXH_NAMESPACE, XXH128_canonicalFromHash) +# define XXH128_hashFromCanonical XXH_NAME2(XXH_NAMESPACE, XXH128_hashFromCanonical) +#endif + + +/* ************************************* +* Version +***************************************/ +#define XXH_VERSION_MAJOR 0 +#define XXH_VERSION_MINOR 8 +#define XXH_VERSION_RELEASE 0 +#define XXH_VERSION_NUMBER (XXH_VERSION_MAJOR *100*100 + XXH_VERSION_MINOR *100 + XXH_VERSION_RELEASE) +XXH_PUBLIC_API unsigned XXH_versionNumber (void); + + +/* **************************** +* Definitions +******************************/ +#include <stddef.h> /* size_t */ +typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode; + + +/*-********************************************************************** +* 32-bit hash +************************************************************************/ +#if !defined (__VMS) \ + && (defined (__cplusplus) \ + || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) +# include <stdint.h> + typedef uint32_t XXH32_hash_t; +#else +# include <limits.h> +# if UINT_MAX == 0xFFFFFFFFUL + typedef unsigned int XXH32_hash_t; +# else +# if ULONG_MAX == 0xFFFFFFFFUL + typedef unsigned long XXH32_hash_t; +# else +# error "unsupported platform: need a 32-bit type" +# endif +# endif +#endif + +/*! + * XXH32(): + * Calculate the 32-bit hash of sequence "length" bytes stored at memory address "input". + * The memory between input & input+length must be valid (allocated and read-accessible). + * "seed" can be used to alter the result predictably. + * Speed on Core 2 Duo @ 3 GHz (single thread, SMHasher benchmark): 5.4 GB/s + * + * Note: XXH3 provides competitive speed for both 32-bit and 64-bit systems, + * and offers true 64/128 bit hash results. It provides a superior level of + * dispersion, and greatly reduces the risks of collisions. + */ +XXH_PUBLIC_API XXH32_hash_t XXH32 (const void* input, size_t length, XXH32_hash_t seed); + +/******* Streaming *******/ + +/* + * Streaming functions generate the xxHash value from an incrememtal input. + * This method is slower than single-call functions, due to state management. + * For small inputs, prefer `XXH32()` and `XXH64()`, which are better optimized. + * + * An XXH state must first be allocated using `XXH*_createState()`. + * + * Start a new hash by initializing the state with a seed using `XXH*_reset()`. + * + * Then, feed the hash state by calling `XXH*_update()` as many times as necessary. + * + * The function returns an error code, with 0 meaning OK, and any other value + * meaning there is an error. + * + * Finally, a hash value can be produced anytime, by using `XXH*_digest()`. + * This function returns the nn-bits hash as an int or long long. + * + * It's still possible to continue inserting input into the hash state after a + * digest, and generate new hash values later on by invoking `XXH*_digest()`. + * + * When done, release the state using `XXH*_freeState()`. + */ + +typedef struct XXH32_state_s XXH32_state_t; /* incomplete type */ +XXH_PUBLIC_API XXH32_state_t* XXH32_createState(void); +XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr); +XXH_PUBLIC_API void XXH32_copyState(XXH32_state_t* dst_state, const XXH32_state_t* src_state); + +XXH_PUBLIC_API XXH_errorcode XXH32_reset (XXH32_state_t* statePtr, XXH32_hash_t seed); +XXH_PUBLIC_API XXH_errorcode XXH32_update (XXH32_state_t* statePtr, const void* input, size_t length); +XXH_PUBLIC_API XXH32_hash_t XXH32_digest (const XXH32_state_t* statePtr); + +/******* Canonical representation *******/ + +/* + * The default return values from XXH functions are unsigned 32 and 64 bit + * integers. + * This the simplest and fastest format for further post-processing. + * + * However, this leaves open the question of what is the order on the byte level, + * since little and big endian conventions will store the same number differently. + * + * The canonical representation settles this issue by mandating big-endian + * convention, the same convention as human-readable numbers (large digits first). + * + * When writing hash values to storage, sending them over a network, or printing + * them, it's highly recommended to use the canonical representation to ensure + * portability across a wider range of systems, present and future. + * + * The following functions allow transformation of hash values to and from + * canonical format. + */ + +typedef struct { unsigned char digest[4]; } XXH32_canonical_t; +XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash); +XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src); + + +#ifndef XXH_NO_LONG_LONG +/*-********************************************************************** +* 64-bit hash +************************************************************************/ +#if !defined (__VMS) \ + && (defined (__cplusplus) \ + || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) +# include <stdint.h> + typedef uint64_t XXH64_hash_t; +#else + /* the following type must have a width of 64-bit */ + typedef unsigned long long XXH64_hash_t; +#endif + +/*! + * XXH64(): + * Returns the 64-bit hash of sequence of length @length stored at memory + * address @input. + * @seed can be used to alter the result predictably. + * + * This function usually runs faster on 64-bit systems, but slower on 32-bit + * systems (see benchmark). + * + * Note: XXH3 provides competitive speed for both 32-bit and 64-bit systems, + * and offers true 64/128 bit hash results. It provides a superior level of + * dispersion, and greatly reduces the risks of collisions. + */ +XXH_PUBLIC_API XXH64_hash_t XXH64 (const void* input, size_t length, XXH64_hash_t seed); + +/******* Streaming *******/ +typedef struct XXH64_state_s XXH64_state_t; /* incomplete type */ +XXH_PUBLIC_API XXH64_state_t* XXH64_createState(void); +XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr); +XXH_PUBLIC_API void XXH64_copyState(XXH64_state_t* dst_state, const XXH64_state_t* src_state); + +XXH_PUBLIC_API XXH_errorcode XXH64_reset (XXH64_state_t* statePtr, XXH64_hash_t seed); +XXH_PUBLIC_API XXH_errorcode XXH64_update (XXH64_state_t* statePtr, const void* input, size_t length); +XXH_PUBLIC_API XXH64_hash_t XXH64_digest (const XXH64_state_t* statePtr); + +/******* Canonical representation *******/ +typedef struct { unsigned char digest[sizeof(XXH64_hash_t)]; } XXH64_canonical_t; +XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash); +XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src); + + +/*-********************************************************************** +* XXH3 64-bit variant +************************************************************************/ + +/* ************************************************************************ + * XXH3 is a new hash algorithm featuring: + * - Improved speed for both small and large inputs + * - True 64-bit and 128-bit outputs + * - SIMD acceleration + * - Improved 32-bit viability + * + * Speed analysis methodology is explained here: + * + * https://fastcompression.blogspot.com/2019/03/presenting-xxh3.html + * + * In general, expect XXH3 to run about ~2x faster on large inputs and >3x + * faster on small ones compared to XXH64, though exact differences depend on + * the platform. + * + * The algorithm is portable: Like XXH32 and XXH64, it generates the same hash + * on all platforms. + * + * It benefits greatly from SIMD and 64-bit arithmetic, but does not require it. + * + * Almost all 32-bit and 64-bit targets that can run XXH32 smoothly can run + * XXH3 at competitive speeds, even if XXH64 runs slowly. Further details are + * explained in the implementation. + * + * Optimized implementations are provided for AVX512, AVX2, SSE2, NEON, POWER8, + * ZVector and scalar targets. This can be controlled with the XXH_VECTOR macro. + * + * XXH3 offers 2 variants, _64bits and _128bits. + * When only 64 bits are needed, prefer calling the _64bits variant, as it + * reduces the amount of mixing, resulting in faster speed on small inputs. + * + * It's also generally simpler to manipulate a scalar return type than a struct. + * + * The 128-bit version adds additional strength, but it is slightly slower. + * + * The XXH3 algorithm is still in development. + * The results it produces may still change in future versions. + * + * Results produced by v0.7.x are not comparable with results from v0.7.y. + * However, the API is completely stable, and it can safely be used for + * ephemeral data (local sessions). + * + * Avoid storing values in long-term storage until the algorithm is finalized. + * XXH3's return values will be officially finalized upon reaching v0.8.0. + * + * After which, return values of XXH3 and XXH128 will no longer change in + * future versions. + * + * The API supports one-shot hashing, streaming mode, and custom secrets. + */ + +/* XXH3_64bits(): + * default 64-bit variant, using default secret and default seed of 0. + * It's the fastest variant. */ +XXH_PUBLIC_API XXH64_hash_t XXH3_64bits(const void* data, size_t len); + +/* + * XXH3_64bits_withSeed(): + * This variant generates a custom secret on the fly + * based on default secret altered using the `seed` value. + * While this operation is decently fast, note that it's not completely free. + * Note: seed==0 produces the same results as XXH3_64bits(). + */ +XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSeed(const void* data, size_t len, XXH64_hash_t seed); + +/* + * XXH3_64bits_withSecret(): + * It's possible to provide any blob of bytes as a "secret" to generate the hash. + * This makes it more difficult for an external actor to prepare an intentional collision. + * The main condition is that secretSize *must* be large enough (>= XXH3_SECRET_SIZE_MIN). + * However, the quality of produced hash values depends on secret's entropy. + * Technically, the secret must look like a bunch of random bytes. + * Avoid "trivial" or structured data such as repeated sequences or a text document. + * Whenever unsure about the "randomness" of the blob of bytes, + * consider relabelling it as a "custom seed" instead, + * and employ "XXH3_generateSecret()" (see below) + * to generate a high entropy secret derived from the custom seed. + */ +#define XXH3_SECRET_SIZE_MIN 136 +XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSecret(const void* data, size_t len, const void* secret, size_t secretSize); + + +/******* Streaming *******/ +/* + * Streaming requires state maintenance. + * This operation costs memory and CPU. + * As a consequence, streaming is slower than one-shot hashing. + * For better performance, prefer one-shot functions whenever applicable. + */ +typedef struct XXH3_state_s XXH3_state_t; +XXH_PUBLIC_API XXH3_state_t* XXH3_createState(void); +XXH_PUBLIC_API XXH_errorcode XXH3_freeState(XXH3_state_t* statePtr); +XXH_PUBLIC_API void XXH3_copyState(XXH3_state_t* dst_state, const XXH3_state_t* src_state); + +/* + * XXH3_64bits_reset(): + * Initialize with default parameters. + * digest will be equivalent to `XXH3_64bits()`. + */ +XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset(XXH3_state_t* statePtr); +/* + * XXH3_64bits_reset_withSeed(): + * Generate a custom secret from `seed`, and store it into `statePtr`. + * digest will be equivalent to `XXH3_64bits_withSeed()`. + */ +XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed); +/* + * XXH3_64bits_reset_withSecret(): + * `secret` is referenced, it _must outlive_ the hash streaming session. + * Similar to one-shot API, `secretSize` must be >= `XXH3_SECRET_SIZE_MIN`, + * and the quality of produced hash values depends on secret's entropy + * (secret's content should look like a bunch of random bytes). + * When in doubt about the randomness of a candidate `secret`, + * consider employing `XXH3_generateSecret()` instead (see below). + */ +XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t secretSize); + +XXH_PUBLIC_API XXH_errorcode XXH3_64bits_update (XXH3_state_t* statePtr, const void* input, size_t length); +XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_digest (const XXH3_state_t* statePtr); + +/* note : canonical representation of XXH3 is the same as XXH64 + * since they both produce XXH64_hash_t values */ + + +/*-********************************************************************** +* XXH3 128-bit variant +************************************************************************/ + +typedef struct { + XXH64_hash_t low64; + XXH64_hash_t high64; +} XXH128_hash_t; + +XXH_PUBLIC_API XXH128_hash_t XXH3_128bits(const void* data, size_t len); +XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_withSeed(const void* data, size_t len, XXH64_hash_t seed); +XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_withSecret(const void* data, size_t len, const void* secret, size_t secretSize); + +/******* Streaming *******/ +/* + * Streaming requires state maintenance. + * This operation costs memory and CPU. + * As a consequence, streaming is slower than one-shot hashing. + * For better performance, prefer one-shot functions whenever applicable. + * + * XXH3_128bits uses the same XXH3_state_t as XXH3_64bits(). + * Use already declared XXH3_createState() and XXH3_freeState(). + * + * All reset and streaming functions have same meaning as their 64-bit counterpart. + */ + +XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset(XXH3_state_t* statePtr); +XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed); +XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t secretSize); + +XXH_PUBLIC_API XXH_errorcode XXH3_128bits_update (XXH3_state_t* statePtr, const void* input, size_t length); +XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_digest (const XXH3_state_t* statePtr); + +/* Following helper functions make it possible to compare XXH128_hast_t values. + * Since XXH128_hash_t is a structure, this capability is not offered by the language. + * Note: For better performance, these functions can be inlined using XXH_INLINE_ALL */ + +/*! + * XXH128_isEqual(): + * Return: 1 if `h1` and `h2` are equal, 0 if they are not. + */ +XXH_PUBLIC_API int XXH128_isEqual(XXH128_hash_t h1, XXH128_hash_t h2); + +/*! + * XXH128_cmp(): + * + * This comparator is compatible with stdlib's `qsort()`/`bsearch()`. + * + * return: >0 if *h128_1 > *h128_2 + * =0 if *h128_1 == *h128_2 + * <0 if *h128_1 < *h128_2 + */ +XXH_PUBLIC_API int XXH128_cmp(const void* h128_1, const void* h128_2); + + +/******* Canonical representation *******/ +typedef struct { unsigned char digest[sizeof(XXH128_hash_t)]; } XXH128_canonical_t; +XXH_PUBLIC_API void XXH128_canonicalFromHash(XXH128_canonical_t* dst, XXH128_hash_t hash); +XXH_PUBLIC_API XXH128_hash_t XXH128_hashFromCanonical(const XXH128_canonical_t* src); + + +#endif /* XXH_NO_LONG_LONG */ + +#endif /* XXHASH_H_5627135585666179 */ + + + +#if defined(XXH_STATIC_LINKING_ONLY) && !defined(XXHASH_H_STATIC_13879238742) +#define XXHASH_H_STATIC_13879238742 +/* **************************************************************************** + * This section contains declarations which are not guaranteed to remain stable. + * They may change in future versions, becoming incompatible with a different + * version of the library. + * These declarations should only be used with static linking. + * Never use them in association with dynamic linking! + ***************************************************************************** */ + +/* + * These definitions are only present to allow static allocation + * of XXH states, on stack or in a struct, for example. + * Never **ever** access their members directly. + */ + +struct XXH32_state_s { + XXH32_hash_t total_len_32; + XXH32_hash_t large_len; + XXH32_hash_t v1; + XXH32_hash_t v2; + XXH32_hash_t v3; + XXH32_hash_t v4; + XXH32_hash_t mem32[4]; + XXH32_hash_t memsize; + XXH32_hash_t reserved; /* never read nor write, might be removed in a future version */ +}; /* typedef'd to XXH32_state_t */ + + +#ifndef XXH_NO_LONG_LONG /* defined when there is no 64-bit support */ + +struct XXH64_state_s { + XXH64_hash_t total_len; + XXH64_hash_t v1; + XXH64_hash_t v2; + XXH64_hash_t v3; + XXH64_hash_t v4; + XXH64_hash_t mem64[4]; + XXH32_hash_t memsize; + XXH32_hash_t reserved32; /* required for padding anyway */ + XXH64_hash_t reserved64; /* never read nor write, might be removed in a future version */ +}; /* typedef'd to XXH64_state_t */ + +#if defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11+ */ +# include <stdalign.h> +# define XXH_ALIGN(n) alignas(n) +#elif defined(__GNUC__) +# define XXH_ALIGN(n) __attribute__ ((aligned(n))) +#elif defined(_MSC_VER) +# define XXH_ALIGN(n) __declspec(align(n)) +#else +# define XXH_ALIGN(n) /* disabled */ +#endif + +/* Old GCC versions only accept the attribute after the type in structures. */ +#if !(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) /* C11+ */ \ + && defined(__GNUC__) +# define XXH_ALIGN_MEMBER(align, type) type XXH_ALIGN(align) +#else +# define XXH_ALIGN_MEMBER(align, type) XXH_ALIGN(align) type +#endif + +#define XXH3_INTERNALBUFFER_SIZE 256 +#define XXH3_SECRET_DEFAULT_SIZE 192 +struct XXH3_state_s { + XXH_ALIGN_MEMBER(64, XXH64_hash_t acc[8]); + /* used to store a custom secret generated from a seed */ + XXH_ALIGN_MEMBER(64, unsigned char customSecret[XXH3_SECRET_DEFAULT_SIZE]); + XXH_ALIGN_MEMBER(64, unsigned char buffer[XXH3_INTERNALBUFFER_SIZE]); + XXH32_hash_t bufferedSize; + XXH32_hash_t reserved32; + size_t nbStripesSoFar; + XXH64_hash_t totalLen; + size_t nbStripesPerBlock; + size_t secretLimit; + XXH64_hash_t seed; + XXH64_hash_t reserved64; + const unsigned char* extSecret; /* reference to external secret; + * if == NULL, use .customSecret instead */ + /* note: there may be some padding at the end due to alignment on 64 bytes */ +}; /* typedef'd to XXH3_state_t */ + +#undef XXH_ALIGN_MEMBER + +/* When the XXH3_state_t structure is merely emplaced on stack, + * it should be initialized with XXH3_INITSTATE() or a memset() + * in case its first reset uses XXH3_NNbits_reset_withSeed(). + * This init can be omitted if the first reset uses default or _withSecret mode. + * This operation isn't necessary when the state is created with XXH3_createState(). + * Note that this doesn't prepare the state for a streaming operation, + * it's still necessary to use XXH3_NNbits_reset*() afterwards. + */ +#define XXH3_INITSTATE(XXH3_state_ptr) { (XXH3_state_ptr)->seed = 0; } + + +/* === Experimental API === */ +/* Symbols defined below must be considered tied to a specific library version. */ + +/* + * XXH3_generateSecret(): + * + * Derive a high-entropy secret from any user-defined content, named customSeed. + * The generated secret can be used in combination with `*_withSecret()` functions. + * The `_withSecret()` variants are useful to provide a higher level of protection than 64-bit seed, + * as it becomes much more difficult for an external actor to guess how to impact the calculation logic. + * + * The function accepts as input a custom seed of any length and any content, + * and derives from it a high-entropy secret of length XXH3_SECRET_DEFAULT_SIZE + * into an already allocated buffer secretBuffer. + * The generated secret is _always_ XXH_SECRET_DEFAULT_SIZE bytes long. + * + * The generated secret can then be used with any `*_withSecret()` variant. + * Functions `XXH3_128bits_withSecret()`, `XXH3_64bits_withSecret()`, + * `XXH3_128bits_reset_withSecret()` and `XXH3_64bits_reset_withSecret()` + * are part of this list. They all accept a `secret` parameter + * which must be very long for implementation reasons (>= XXH3_SECRET_SIZE_MIN) + * _and_ feature very high entropy (consist of random-looking bytes). + * These conditions can be a high bar to meet, so + * this function can be used to generate a secret of proper quality. + * + * customSeed can be anything. It can have any size, even small ones, + * and its content can be anything, even stupidly "low entropy" source such as a bunch of zeroes. + * The resulting `secret` will nonetheless provide all expected qualities. + * + * Supplying NULL as the customSeed copies the default secret into `secretBuffer`. + * When customSeedSize > 0, supplying NULL as customSeed is undefined behavior. + */ +XXH_PUBLIC_API void XXH3_generateSecret(void* secretBuffer, const void* customSeed, size_t customSeedSize); + + +/* simple short-cut to pre-selected XXH3_128bits variant */ +XXH_PUBLIC_API XXH128_hash_t XXH128(const void* data, size_t len, XXH64_hash_t seed); + + +#endif /* XXH_NO_LONG_LONG */ + + +#if defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API) +# define XXH_IMPLEMENTATION +#endif + +#endif /* defined(XXH_STATIC_LINKING_ONLY) && !defined(XXHASH_H_STATIC_13879238742) */ + + +/* ======================================================================== */ +/* ======================================================================== */ +/* ======================================================================== */ + + +/*-********************************************************************** + * xxHash implementation + *-********************************************************************** + * xxHash's implementation used to be hosted inside xxhash.c. + * + * However, inlining requires implementation to be visible to the compiler, + * hence be included alongside the header. + * Previously, implementation was hosted inside xxhash.c, + * which was then #included when inlining was activated. + * This construction created issues with a few build and install systems, + * as it required xxhash.c to be stored in /include directory. + * + * xxHash implementation is now directly integrated within xxhash.h. + * As a consequence, xxhash.c is no longer needed in /include. + * + * xxhash.c is still available and is still useful. + * In a "normal" setup, when xxhash is not inlined, + * xxhash.h only exposes the prototypes and public symbols, + * while xxhash.c can be built into an object file xxhash.o + * which can then be linked into the final binary. + ************************************************************************/ + +#if ( defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API) \ + || defined(XXH_IMPLEMENTATION) ) && !defined(XXH_IMPLEM_13a8737387) +# define XXH_IMPLEM_13a8737387 + +/* ************************************* +* Tuning parameters +***************************************/ +/*! + * XXH_FORCE_MEMORY_ACCESS: + * By default, access to unaligned memory is controlled by `memcpy()`, which is + * safe and portable. + * + * Unfortunately, on some target/compiler combinations, the generated assembly + * is sub-optimal. + * + * The below switch allow selection of a different access method + * in the search for improved performance. + * Method 0 (default): + * Use `memcpy()`. Safe and portable. Default. + * Method 1: + * `__attribute__((packed))` statement. It depends on compiler extensions + * and is therefore not portable. + * This method is safe if your compiler supports it, and *generally* as + * fast or faster than `memcpy`. + * Method 2: + * Direct access via cast. This method doesn't depend on the compiler but + * violates the C standard. + * It can generate buggy code on targets which do not support unaligned + * memory accesses. + * But in some circumstances, it's the only known way to get the most + * performance (example: GCC + ARMv6) + * Method 3: + * Byteshift. This can generate the best code on old compilers which don't + * inline small `memcpy()` calls, and it might also be faster on big-endian + * systems which lack a native byteswap instruction. + * See https://stackoverflow.com/a/32095106/646947 for details. + * Prefer these methods in priority order (0 > 1 > 2 > 3) + */ +#ifndef XXH_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */ +# if !defined(__clang__) && defined(__GNUC__) && defined(__ARM_FEATURE_UNALIGNED) && defined(__ARM_ARCH) && (__ARM_ARCH == 6) +# define XXH_FORCE_MEMORY_ACCESS 2 +# elif !defined(__clang__) && ((defined(__INTEL_COMPILER) && !defined(_WIN32)) || \ + (defined(__GNUC__) && (defined(__ARM_ARCH) && __ARM_ARCH >= 7))) +# define XXH_FORCE_MEMORY_ACCESS 1 +# endif +#endif + +/*! + * XXH_ACCEPT_NULL_INPUT_POINTER: + * If the input pointer is NULL, xxHash's default behavior is to dereference it, + * triggering a segfault. + * When this macro is enabled, xxHash actively checks the input for a null pointer. + * If it is, the result for null input pointers is the same as a zero-length input. + */ +#ifndef XXH_ACCEPT_NULL_INPUT_POINTER /* can be defined externally */ +# define XXH_ACCEPT_NULL_INPUT_POINTER 0 +#endif + +/*! + * XXH_FORCE_ALIGN_CHECK: + * This is an important performance trick + * for architectures without decent unaligned memory access performance. + * It checks for input alignment, and when conditions are met, + * uses a "fast path" employing direct 32-bit/64-bit read, + * resulting in _dramatically faster_ read speed. + * + * The check costs one initial branch per hash, which is generally negligible, but not zero. + * Moreover, it's not useful to generate binary for an additional code path + * if memory access uses same instruction for both aligned and unaligned adresses. + * + * In these cases, the alignment check can be removed by setting this macro to 0. + * Then the code will always use unaligned memory access. + * Align check is automatically disabled on x86, x64 & arm64, + * which are platforms known to offer good unaligned memory accesses performance. + * + * This option does not affect XXH3 (only XXH32 and XXH64). + */ +#ifndef XXH_FORCE_ALIGN_CHECK /* can be defined externally */ +# if defined(__i386) || defined(__x86_64__) || defined(__aarch64__) \ + || defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM64) /* visual */ +# define XXH_FORCE_ALIGN_CHECK 0 +# else +# define XXH_FORCE_ALIGN_CHECK 1 +# endif +#endif + +/*! + * XXH_NO_INLINE_HINTS: + * + * By default, xxHash tries to force the compiler to inline almost all internal + * functions. + * + * This can usually improve performance due to reduced jumping and improved + * constant folding, but significantly increases the size of the binary which + * might not be favorable. + * + * Additionally, sometimes the forced inlining can be detrimental to performance, + * depending on the architecture. + * + * XXH_NO_INLINE_HINTS marks all internal functions as static, giving the + * compiler full control on whether to inline or not. + * + * When not optimizing (-O0), optimizing for size (-Os, -Oz), or using + * -fno-inline with GCC or Clang, this will automatically be defined. + */ +#ifndef XXH_NO_INLINE_HINTS +# if defined(__OPTIMIZE_SIZE__) /* -Os, -Oz */ \ + || defined(__NO_INLINE__) /* -O0, -fno-inline */ +# define XXH_NO_INLINE_HINTS 1 +# else +# define XXH_NO_INLINE_HINTS 0 +# endif +#endif + +/*! + * XXH_REROLL: + * Whether to reroll XXH32_finalize, and XXH64_finalize, + * instead of using an unrolled jump table/if statement loop. + * + * This is automatically defined on -Os/-Oz on GCC and Clang. + */ +#ifndef XXH_REROLL +# if defined(__OPTIMIZE_SIZE__) +# define XXH_REROLL 1 +# else +# define XXH_REROLL 0 +# endif +#endif + + +/* ************************************* +* Includes & Memory related functions +***************************************/ +/*! + * Modify the local functions below should you wish to use + * different memory routines for malloc() and free() + */ +#include <stdlib.h> + +static void* XXH_malloc(size_t s) { return malloc(s); } +static void XXH_free(void* p) { free(p); } + +/*! and for memcpy() */ +#include <string.h> +static void* XXH_memcpy(void* dest, const void* src, size_t size) +{ + return memcpy(dest,src,size); +} + +#include <limits.h> /* ULLONG_MAX */ + + +/* ************************************* +* Compiler Specific Options +***************************************/ +#ifdef _MSC_VER /* Visual Studio warning fix */ +# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ +#endif + +#if XXH_NO_INLINE_HINTS /* disable inlining hints */ +# if defined(__GNUC__) +# define XXH_FORCE_INLINE static __attribute__((unused)) +# else +# define XXH_FORCE_INLINE static +# endif +# define XXH_NO_INLINE static +/* enable inlining hints */ +#elif defined(_MSC_VER) /* Visual Studio */ +# define XXH_FORCE_INLINE static __forceinline +# define XXH_NO_INLINE static __declspec(noinline) +#elif defined(__GNUC__) +# define XXH_FORCE_INLINE static __inline__ __attribute__((always_inline, unused)) +# define XXH_NO_INLINE static __attribute__((noinline)) +#elif defined (__cplusplus) \ + || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) /* C99 */ +# define XXH_FORCE_INLINE static inline +# define XXH_NO_INLINE static +#else +# define XXH_FORCE_INLINE static +# define XXH_NO_INLINE static +#endif + + + +/* ************************************* +* Debug +***************************************/ +/* + * XXH_DEBUGLEVEL is expected to be defined externally, typically via the + * compiler's command line options. The value must be a number. + */ +#ifndef XXH_DEBUGLEVEL +# ifdef DEBUGLEVEL /* backwards compat */ +# define XXH_DEBUGLEVEL DEBUGLEVEL +# else +# define XXH_DEBUGLEVEL 0 +# endif +#endif + +#if (XXH_DEBUGLEVEL>=1) +# include <assert.h> /* note: can still be disabled with NDEBUG */ +# define XXH_ASSERT(c) assert(c) +#else +# define XXH_ASSERT(c) ((void)0) +#endif + +/* note: use after variable declarations */ +#define XXH_STATIC_ASSERT(c) do { enum { XXH_sa = 1/(int)(!!(c)) }; } while (0) + + +/* ************************************* +* Basic Types +***************************************/ +#if !defined (__VMS) \ + && (defined (__cplusplus) \ + || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) +# include <stdint.h> + typedef uint8_t xxh_u8; +#else + typedef unsigned char xxh_u8; +#endif +typedef XXH32_hash_t xxh_u32; + +#ifdef XXH_OLD_NAMES +# define BYTE xxh_u8 +# define U8 xxh_u8 +# define U32 xxh_u32 +#endif + +/* *** Memory access *** */ + +#if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==3)) +/* + * Manual byteshift. Best for old compilers which don't inline memcpy. + * We actually directly use XXH_readLE32 and XXH_readBE32. + */ +#elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==2)) + +/* + * Force direct memory access. Only works on CPU which support unaligned memory + * access in hardware. + */ +static xxh_u32 XXH_read32(const void* memPtr) { return *(const xxh_u32*) memPtr; } + +#elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==1)) + +/* + * __pack instructions are safer but compiler specific, hence potentially + * problematic for some compilers. + * + * Currently only defined for GCC and ICC. + */ +#ifdef XXH_OLD_NAMES +typedef union { xxh_u32 u32; } __attribute__((packed)) unalign; +#endif +static xxh_u32 XXH_read32(const void* ptr) +{ + typedef union { xxh_u32 u32; } __attribute__((packed)) xxh_unalign; + return ((const xxh_unalign*)ptr)->u32; +} + +#else + +/* + * Portable and safe solution. Generally efficient. + * see: https://stackoverflow.com/a/32095106/646947 + */ +static xxh_u32 XXH_read32(const void* memPtr) +{ + xxh_u32 val; + memcpy(&val, memPtr, sizeof(val)); + return val; +} + +#endif /* XXH_FORCE_DIRECT_MEMORY_ACCESS */ + + +/* *** Endianess *** */ +typedef enum { XXH_bigEndian=0, XXH_littleEndian=1 } XXH_endianess; + +/*! + * XXH_CPU_LITTLE_ENDIAN: + * Defined to 1 if the target is little endian, or 0 if it is big endian. + * It can be defined externally, for example on the compiler command line. + * + * If it is not defined, a runtime check (which is usually constant folded) + * is used instead. + */ +#ifndef XXH_CPU_LITTLE_ENDIAN +/* + * Try to detect endianness automatically, to avoid the nonstandard behavior + * in `XXH_isLittleEndian()` + */ +# if defined(_WIN32) /* Windows is always little endian */ \ + || defined(__LITTLE_ENDIAN__) \ + || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) +# define XXH_CPU_LITTLE_ENDIAN 1 +# elif defined(__BIG_ENDIAN__) \ + || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) +# define XXH_CPU_LITTLE_ENDIAN 0 +# else +/* + * runtime test, presumed to simplify to a constant by compiler + */ +static int XXH_isLittleEndian(void) +{ + /* + * Portable and well-defined behavior. + * Don't use static: it is detrimental to performance. + */ + const union { xxh_u32 u; xxh_u8 c[4]; } one = { 1 }; + return one.c[0]; +} +# define XXH_CPU_LITTLE_ENDIAN XXH_isLittleEndian() +# endif +#endif + + + + +/* **************************************** +* Compiler-specific Functions and Macros +******************************************/ +#define XXH_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) + +#ifdef __has_builtin +# define XXH_HAS_BUILTIN(x) __has_builtin(x) +#else +# define XXH_HAS_BUILTIN(x) 0 +#endif + +#if !defined(NO_CLANG_BUILTIN) && XXH_HAS_BUILTIN(__builtin_rotateleft32) \ + && XXH_HAS_BUILTIN(__builtin_rotateleft64) +# define XXH_rotl32 __builtin_rotateleft32 +# define XXH_rotl64 __builtin_rotateleft64 +/* Note: although _rotl exists for minGW (GCC under windows), performance seems poor */ +#elif defined(_MSC_VER) +# define XXH_rotl32(x,r) _rotl(x,r) +# define XXH_rotl64(x,r) _rotl64(x,r) +#else +# define XXH_rotl32(x,r) (((x) << (r)) | ((x) >> (32 - (r)))) +# define XXH_rotl64(x,r) (((x) << (r)) | ((x) >> (64 - (r)))) +#endif + +#if defined(_MSC_VER) /* Visual Studio */ +# define XXH_swap32 _byteswap_ulong +#elif XXH_GCC_VERSION >= 403 +# define XXH_swap32 __builtin_bswap32 +#else +static xxh_u32 XXH_swap32 (xxh_u32 x) +{ + return ((x << 24) & 0xff000000 ) | + ((x << 8) & 0x00ff0000 ) | + ((x >> 8) & 0x0000ff00 ) | + ((x >> 24) & 0x000000ff ); +} +#endif + + +/* *************************** +* Memory reads +*****************************/ +typedef enum { XXH_aligned, XXH_unaligned } XXH_alignment; + +/* + * XXH_FORCE_MEMORY_ACCESS==3 is an endian-independent byteshift load. + * + * This is ideal for older compilers which don't inline memcpy. + */ +#if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==3)) + +XXH_FORCE_INLINE xxh_u32 XXH_readLE32(const void* memPtr) +{ + const xxh_u8* bytePtr = (const xxh_u8 *)memPtr; + return bytePtr[0] + | ((xxh_u32)bytePtr[1] << 8) + | ((xxh_u32)bytePtr[2] << 16) + | ((xxh_u32)bytePtr[3] << 24); +} + +XXH_FORCE_INLINE xxh_u32 XXH_readBE32(const void* memPtr) +{ + const xxh_u8* bytePtr = (const xxh_u8 *)memPtr; + return bytePtr[3] + | ((xxh_u32)bytePtr[2] << 8) + | ((xxh_u32)bytePtr[1] << 16) + | ((xxh_u32)bytePtr[0] << 24); +} + +#else +XXH_FORCE_INLINE xxh_u32 XXH_readLE32(const void* ptr) +{ + return XXH_CPU_LITTLE_ENDIAN ? XXH_read32(ptr) : XXH_swap32(XXH_read32(ptr)); +} + +static xxh_u32 XXH_readBE32(const void* ptr) +{ + return XXH_CPU_LITTLE_ENDIAN ? XXH_swap32(XXH_read32(ptr)) : XXH_read32(ptr); +} +#endif + +XXH_FORCE_INLINE xxh_u32 +XXH_readLE32_align(const void* ptr, XXH_alignment align) +{ + if (align==XXH_unaligned) { + return XXH_readLE32(ptr); + } else { + return XXH_CPU_LITTLE_ENDIAN ? *(const xxh_u32*)ptr : XXH_swap32(*(const xxh_u32*)ptr); + } +} + + +/* ************************************* +* Misc +***************************************/ +XXH_PUBLIC_API unsigned XXH_versionNumber (void) { return XXH_VERSION_NUMBER; } + + +/* ******************************************************************* +* 32-bit hash functions +*********************************************************************/ +static const xxh_u32 XXH_PRIME32_1 = 0x9E3779B1U; /* 0b10011110001101110111100110110001 */ +static const xxh_u32 XXH_PRIME32_2 = 0x85EBCA77U; /* 0b10000101111010111100101001110111 */ +static const xxh_u32 XXH_PRIME32_3 = 0xC2B2AE3DU; /* 0b11000010101100101010111000111101 */ +static const xxh_u32 XXH_PRIME32_4 = 0x27D4EB2FU; /* 0b00100111110101001110101100101111 */ +static const xxh_u32 XXH_PRIME32_5 = 0x165667B1U; /* 0b00010110010101100110011110110001 */ + +#ifdef XXH_OLD_NAMES +# define PRIME32_1 XXH_PRIME32_1 +# define PRIME32_2 XXH_PRIME32_2 +# define PRIME32_3 XXH_PRIME32_3 +# define PRIME32_4 XXH_PRIME32_4 +# define PRIME32_5 XXH_PRIME32_5 +#endif + +static xxh_u32 XXH32_round(xxh_u32 acc, xxh_u32 input) +{ + acc += input * XXH_PRIME32_2; + acc = XXH_rotl32(acc, 13); + acc *= XXH_PRIME32_1; +#if defined(__GNUC__) && defined(__SSE4_1__) && !defined(XXH_ENABLE_AUTOVECTORIZE) + /* + * UGLY HACK: + * This inline assembly hack forces acc into a normal register. This is the + * only thing that prevents GCC and Clang from autovectorizing the XXH32 + * loop (pragmas and attributes don't work for some resason) without globally + * disabling SSE4.1. + * + * The reason we want to avoid vectorization is because despite working on + * 4 integers at a time, there are multiple factors slowing XXH32 down on + * SSE4: + * - There's a ridiculous amount of lag from pmulld (10 cycles of latency on + * newer chips!) making it slightly slower to multiply four integers at + * once compared to four integers independently. Even when pmulld was + * fastest, Sandy/Ivy Bridge, it is still not worth it to go into SSE + * just to multiply unless doing a long operation. + * + * - Four instructions are required to rotate, + * movqda tmp, v // not required with VEX encoding + * pslld tmp, 13 // tmp <<= 13 + * psrld v, 19 // x >>= 19 + * por v, tmp // x |= tmp + * compared to one for scalar: + * roll v, 13 // reliably fast across the board + * shldl v, v, 13 // Sandy Bridge and later prefer this for some reason + * + * - Instruction level parallelism is actually more beneficial here because + * the SIMD actually serializes this operation: While v1 is rotating, v2 + * can load data, while v3 can multiply. SSE forces them to operate + * together. + * + * How this hack works: + * __asm__("" // Declare an assembly block but don't declare any instructions + * : // However, as an Input/Output Operand, + * "+r" // constrain a read/write operand (+) as a general purpose register (r). + * (acc) // and set acc as the operand + * ); + * + * Because of the 'r', the compiler has promised that seed will be in a + * general purpose register and the '+' says that it will be 'read/write', + * so it has to assume it has changed. It is like volatile without all the + * loads and stores. + * + * Since the argument has to be in a normal register (not an SSE register), + * each time XXH32_round is called, it is impossible to vectorize. + */ + __asm__("" : "+r" (acc)); +#endif + return acc; +} + +/* mix all bits */ +static xxh_u32 XXH32_avalanche(xxh_u32 h32) +{ + h32 ^= h32 >> 15; + h32 *= XXH_PRIME32_2; + h32 ^= h32 >> 13; + h32 *= XXH_PRIME32_3; + h32 ^= h32 >> 16; + return(h32); +} + +#define XXH_get32bits(p) XXH_readLE32_align(p, align) + +static xxh_u32 +XXH32_finalize(xxh_u32 h32, const xxh_u8* ptr, size_t len, XXH_alignment align) +{ +#define XXH_PROCESS1 do { \ + h32 += (*ptr++) * XXH_PRIME32_5; \ + h32 = XXH_rotl32(h32, 11) * XXH_PRIME32_1; \ +} while (0) + +#define XXH_PROCESS4 do { \ + h32 += XXH_get32bits(ptr) * XXH_PRIME32_3; \ + ptr += 4; \ + h32 = XXH_rotl32(h32, 17) * XXH_PRIME32_4; \ +} while (0) + + /* Compact rerolled version */ + if (XXH_REROLL) { + len &= 15; + while (len >= 4) { + XXH_PROCESS4; + len -= 4; + } + while (len > 0) { + XXH_PROCESS1; + --len; + } + return XXH32_avalanche(h32); + } else { + switch(len&15) /* or switch(bEnd - p) */ { + case 12: XXH_PROCESS4; + /* fallthrough */ + case 8: XXH_PROCESS4; + /* fallthrough */ + case 4: XXH_PROCESS4; + return XXH32_avalanche(h32); + + case 13: XXH_PROCESS4; + /* fallthrough */ + case 9: XXH_PROCESS4; + /* fallthrough */ + case 5: XXH_PROCESS4; + XXH_PROCESS1; + return XXH32_avalanche(h32); + + case 14: XXH_PROCESS4; + /* fallthrough */ + case 10: XXH_PROCESS4; + /* fallthrough */ + case 6: XXH_PROCESS4; + XXH_PROCESS1; + XXH_PROCESS1; + return XXH32_avalanche(h32); + + case 15: XXH_PROCESS4; + /* fallthrough */ + case 11: XXH_PROCESS4; + /* fallthrough */ + case 7: XXH_PROCESS4; + /* fallthrough */ + case 3: XXH_PROCESS1; + /* fallthrough */ + case 2: XXH_PROCESS1; + /* fallthrough */ + case 1: XXH_PROCESS1; + /* fallthrough */ + case 0: return XXH32_avalanche(h32); + } + XXH_ASSERT(0); + return h32; /* reaching this point is deemed impossible */ + } +} + +#ifdef XXH_OLD_NAMES +# define PROCESS1 XXH_PROCESS1 +# define PROCESS4 XXH_PROCESS4 +#else +# undef XXH_PROCESS1 +# undef XXH_PROCESS4 +#endif + +XXH_FORCE_INLINE xxh_u32 +XXH32_endian_align(const xxh_u8* input, size_t len, xxh_u32 seed, XXH_alignment align) +{ + const xxh_u8* bEnd = input + len; + xxh_u32 h32; + +#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) && (XXH_ACCEPT_NULL_INPUT_POINTER>=1) + if (input==NULL) { + len=0; + bEnd=input=(const xxh_u8*)(size_t)16; + } +#endif + + if (len>=16) { + const xxh_u8* const limit = bEnd - 15; + xxh_u32 v1 = seed + XXH_PRIME32_1 + XXH_PRIME32_2; + xxh_u32 v2 = seed + XXH_PRIME32_2; + xxh_u32 v3 = seed + 0; + xxh_u32 v4 = seed - XXH_PRIME32_1; + + do { + v1 = XXH32_round(v1, XXH_get32bits(input)); input += 4; + v2 = XXH32_round(v2, XXH_get32bits(input)); input += 4; + v3 = XXH32_round(v3, XXH_get32bits(input)); input += 4; + v4 = XXH32_round(v4, XXH_get32bits(input)); input += 4; + } while (input < limit); + + h32 = XXH_rotl32(v1, 1) + XXH_rotl32(v2, 7) + + XXH_rotl32(v3, 12) + XXH_rotl32(v4, 18); + } else { + h32 = seed + XXH_PRIME32_5; + } + + h32 += (xxh_u32)len; + + return XXH32_finalize(h32, input, len&15, align); +} + + +XXH_PUBLIC_API XXH32_hash_t XXH32 (const void* input, size_t len, XXH32_hash_t seed) +{ +#if 0 + /* Simple version, good for code maintenance, but unfortunately slow for small inputs */ + XXH32_state_t state; + XXH32_reset(&state, seed); + XXH32_update(&state, (const xxh_u8*)input, len); + return XXH32_digest(&state); + +#else + + if (XXH_FORCE_ALIGN_CHECK) { + if ((((size_t)input) & 3) == 0) { /* Input is 4-bytes aligned, leverage the speed benefit */ + return XXH32_endian_align((const xxh_u8*)input, len, seed, XXH_aligned); + } } + + return XXH32_endian_align((const xxh_u8*)input, len, seed, XXH_unaligned); +#endif +} + + + +/******* Hash streaming *******/ + +XXH_PUBLIC_API XXH32_state_t* XXH32_createState(void) +{ + return (XXH32_state_t*)XXH_malloc(sizeof(XXH32_state_t)); +} +XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr) +{ + XXH_free(statePtr); + return XXH_OK; +} + +XXH_PUBLIC_API void XXH32_copyState(XXH32_state_t* dstState, const XXH32_state_t* srcState) +{ + memcpy(dstState, srcState, sizeof(*dstState)); +} + +XXH_PUBLIC_API XXH_errorcode XXH32_reset(XXH32_state_t* statePtr, XXH32_hash_t seed) +{ + XXH32_state_t state; /* using a local state to memcpy() in order to avoid strict-aliasing warnings */ + memset(&state, 0, sizeof(state)); + state.v1 = seed + XXH_PRIME32_1 + XXH_PRIME32_2; + state.v2 = seed + XXH_PRIME32_2; + state.v3 = seed + 0; + state.v4 = seed - XXH_PRIME32_1; + /* do not write into reserved, planned to be removed in a future version */ + memcpy(statePtr, &state, sizeof(state) - sizeof(state.reserved)); + return XXH_OK; +} + + +XXH_PUBLIC_API XXH_errorcode +XXH32_update(XXH32_state_t* state, const void* input, size_t len) +{ + if (input==NULL) +#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) && (XXH_ACCEPT_NULL_INPUT_POINTER>=1) + return XXH_OK; +#else + return XXH_ERROR; +#endif + + { const xxh_u8* p = (const xxh_u8*)input; + const xxh_u8* const bEnd = p + len; + + state->total_len_32 += (XXH32_hash_t)len; + state->large_len |= (XXH32_hash_t)((len>=16) | (state->total_len_32>=16)); + + if (state->memsize + len < 16) { /* fill in tmp buffer */ + XXH_memcpy((xxh_u8*)(state->mem32) + state->memsize, input, len); + state->memsize += (XXH32_hash_t)len; + return XXH_OK; + } + + if (state->memsize) { /* some data left from previous update */ + XXH_memcpy((xxh_u8*)(state->mem32) + state->memsize, input, 16-state->memsize); + { const xxh_u32* p32 = state->mem32; + state->v1 = XXH32_round(state->v1, XXH_readLE32(p32)); p32++; + state->v2 = XXH32_round(state->v2, XXH_readLE32(p32)); p32++; + state->v3 = XXH32_round(state->v3, XXH_readLE32(p32)); p32++; + state->v4 = XXH32_round(state->v4, XXH_readLE32(p32)); + } + p += 16-state->memsize; + state->memsize = 0; + } + + if (p <= bEnd-16) { + const xxh_u8* const limit = bEnd - 16; + xxh_u32 v1 = state->v1; + xxh_u32 v2 = state->v2; + xxh_u32 v3 = state->v3; + xxh_u32 v4 = state->v4; + + do { + v1 = XXH32_round(v1, XXH_readLE32(p)); p+=4; + v2 = XXH32_round(v2, XXH_readLE32(p)); p+=4; + v3 = XXH32_round(v3, XXH_readLE32(p)); p+=4; + v4 = XXH32_round(v4, XXH_readLE32(p)); p+=4; + } while (p<=limit); + + state->v1 = v1; + state->v2 = v2; + state->v3 = v3; + state->v4 = v4; + } + + if (p < bEnd) { + XXH_memcpy(state->mem32, p, (size_t)(bEnd-p)); + state->memsize = (unsigned)(bEnd-p); + } + } + + return XXH_OK; +} + + +XXH_PUBLIC_API XXH32_hash_t XXH32_digest (const XXH32_state_t* state) +{ + xxh_u32 h32; + + if (state->large_len) { + h32 = XXH_rotl32(state->v1, 1) + + XXH_rotl32(state->v2, 7) + + XXH_rotl32(state->v3, 12) + + XXH_rotl32(state->v4, 18); + } else { + h32 = state->v3 /* == seed */ + XXH_PRIME32_5; + } + + h32 += state->total_len_32; + + return XXH32_finalize(h32, (const xxh_u8*)state->mem32, state->memsize, XXH_aligned); +} + + +/******* Canonical representation *******/ + +/* + * The default return values from XXH functions are unsigned 32 and 64 bit + * integers. + * + * The canonical representation uses big endian convention, the same convention + * as human-readable numbers (large digits first). + * + * This way, hash values can be written into a file or buffer, remaining + * comparable across different systems. + * + * The following functions allow transformation of hash values to and from their + * canonical format. + */ +XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash) +{ + XXH_STATIC_ASSERT(sizeof(XXH32_canonical_t) == sizeof(XXH32_hash_t)); + if (XXH_CPU_LITTLE_ENDIAN) hash = XXH_swap32(hash); + memcpy(dst, &hash, sizeof(*dst)); +} + +XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src) +{ + return XXH_readBE32(src); +} + + +#ifndef XXH_NO_LONG_LONG + +/* ******************************************************************* +* 64-bit hash functions +*********************************************************************/ + +/******* Memory access *******/ + +typedef XXH64_hash_t xxh_u64; + +#ifdef XXH_OLD_NAMES +# define U64 xxh_u64 +#endif + +/*! + * XXH_REROLL_XXH64: + * Whether to reroll the XXH64_finalize() loop. + * + * Just like XXH32, we can unroll the XXH64_finalize() loop. This can be a + * performance gain on 64-bit hosts, as only one jump is required. + * + * However, on 32-bit hosts, because arithmetic needs to be done with two 32-bit + * registers, and 64-bit arithmetic needs to be simulated, it isn't beneficial + * to unroll. The code becomes ridiculously large (the largest function in the + * binary on i386!), and rerolling it saves anywhere from 3kB to 20kB. It is + * also slightly faster because it fits into cache better and is more likely + * to be inlined by the compiler. + * + * If XXH_REROLL is defined, this is ignored and the loop is always rerolled. + */ +#ifndef XXH_REROLL_XXH64 +# if (defined(__ILP32__) || defined(_ILP32)) /* ILP32 is often defined on 32-bit GCC family */ \ + || !(defined(__x86_64__) || defined(_M_X64) || defined(_M_AMD64) /* x86-64 */ \ + || defined(_M_ARM64) || defined(__aarch64__) || defined(__arm64__) /* aarch64 */ \ + || defined(__PPC64__) || defined(__PPC64LE__) || defined(__ppc64__) || defined(__powerpc64__) /* ppc64 */ \ + || defined(__mips64__) || defined(__mips64)) /* mips64 */ \ + || (!defined(SIZE_MAX) || SIZE_MAX < ULLONG_MAX) /* check limits */ +# define XXH_REROLL_XXH64 1 +# else +# define XXH_REROLL_XXH64 0 +# endif +#endif /* !defined(XXH_REROLL_XXH64) */ + +#if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==3)) +/* + * Manual byteshift. Best for old compilers which don't inline memcpy. + * We actually directly use XXH_readLE64 and XXH_readBE64. + */ +#elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==2)) + +/* Force direct memory access. Only works on CPU which support unaligned memory access in hardware */ +static xxh_u64 XXH_read64(const void* memPtr) { return *(const xxh_u64*) memPtr; } + +#elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==1)) + +/* + * __pack instructions are safer, but compiler specific, hence potentially + * problematic for some compilers. + * + * Currently only defined for GCC and ICC. + */ +#ifdef XXH_OLD_NAMES +typedef union { xxh_u32 u32; xxh_u64 u64; } __attribute__((packed)) unalign64; +#endif +static xxh_u64 XXH_read64(const void* ptr) +{ + typedef union { xxh_u32 u32; xxh_u64 u64; } __attribute__((packed)) xxh_unalign64; + return ((const xxh_unalign64*)ptr)->u64; +} + +#else + +/* + * Portable and safe solution. Generally efficient. + * see: https://stackoverflow.com/a/32095106/646947 + */ +static xxh_u64 XXH_read64(const void* memPtr) +{ + xxh_u64 val; + memcpy(&val, memPtr, sizeof(val)); + return val; +} + +#endif /* XXH_FORCE_DIRECT_MEMORY_ACCESS */ + +#if defined(_MSC_VER) /* Visual Studio */ +# define XXH_swap64 _byteswap_uint64 +#elif XXH_GCC_VERSION >= 403 +# define XXH_swap64 __builtin_bswap64 +#else +static xxh_u64 XXH_swap64 (xxh_u64 x) +{ + return ((x << 56) & 0xff00000000000000ULL) | + ((x << 40) & 0x00ff000000000000ULL) | + ((x << 24) & 0x0000ff0000000000ULL) | + ((x << 8) & 0x000000ff00000000ULL) | + ((x >> 8) & 0x00000000ff000000ULL) | + ((x >> 24) & 0x0000000000ff0000ULL) | + ((x >> 40) & 0x000000000000ff00ULL) | + ((x >> 56) & 0x00000000000000ffULL); +} +#endif + + +/* XXH_FORCE_MEMORY_ACCESS==3 is an endian-independent byteshift load. */ +#if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==3)) + +XXH_FORCE_INLINE xxh_u64 XXH_readLE64(const void* memPtr) +{ + const xxh_u8* bytePtr = (const xxh_u8 *)memPtr; + return bytePtr[0] + | ((xxh_u64)bytePtr[1] << 8) + | ((xxh_u64)bytePtr[2] << 16) + | ((xxh_u64)bytePtr[3] << 24) + | ((xxh_u64)bytePtr[4] << 32) + | ((xxh_u64)bytePtr[5] << 40) + | ((xxh_u64)bytePtr[6] << 48) + | ((xxh_u64)bytePtr[7] << 56); +} + +XXH_FORCE_INLINE xxh_u64 XXH_readBE64(const void* memPtr) +{ + const xxh_u8* bytePtr = (const xxh_u8 *)memPtr; + return bytePtr[7] + | ((xxh_u64)bytePtr[6] << 8) + | ((xxh_u64)bytePtr[5] << 16) + | ((xxh_u64)bytePtr[4] << 24) + | ((xxh_u64)bytePtr[3] << 32) + | ((xxh_u64)bytePtr[2] << 40) + | ((xxh_u64)bytePtr[1] << 48) + | ((xxh_u64)bytePtr[0] << 56); +} + +#else +XXH_FORCE_INLINE xxh_u64 XXH_readLE64(const void* ptr) +{ + return XXH_CPU_LITTLE_ENDIAN ? XXH_read64(ptr) : XXH_swap64(XXH_read64(ptr)); +} + +static xxh_u64 XXH_readBE64(const void* ptr) +{ + return XXH_CPU_LITTLE_ENDIAN ? XXH_swap64(XXH_read64(ptr)) : XXH_read64(ptr); +} +#endif + +XXH_FORCE_INLINE xxh_u64 +XXH_readLE64_align(const void* ptr, XXH_alignment align) +{ + if (align==XXH_unaligned) + return XXH_readLE64(ptr); + else + return XXH_CPU_LITTLE_ENDIAN ? *(const xxh_u64*)ptr : XXH_swap64(*(const xxh_u64*)ptr); +} + + +/******* xxh64 *******/ + +static const xxh_u64 XXH_PRIME64_1 = 0x9E3779B185EBCA87ULL; /* 0b1001111000110111011110011011000110000101111010111100101010000111 */ +static const xxh_u64 XXH_PRIME64_2 = 0xC2B2AE3D27D4EB4FULL; /* 0b1100001010110010101011100011110100100111110101001110101101001111 */ +static const xxh_u64 XXH_PRIME64_3 = 0x165667B19E3779F9ULL; /* 0b0001011001010110011001111011000110011110001101110111100111111001 */ +static const xxh_u64 XXH_PRIME64_4 = 0x85EBCA77C2B2AE63ULL; /* 0b1000010111101011110010100111011111000010101100101010111001100011 */ +static const xxh_u64 XXH_PRIME64_5 = 0x27D4EB2F165667C5ULL; /* 0b0010011111010100111010110010111100010110010101100110011111000101 */ + +#ifdef XXH_OLD_NAMES +# define PRIME64_1 XXH_PRIME64_1 +# define PRIME64_2 XXH_PRIME64_2 +# define PRIME64_3 XXH_PRIME64_3 +# define PRIME64_4 XXH_PRIME64_4 +# define PRIME64_5 XXH_PRIME64_5 +#endif + +static xxh_u64 XXH64_round(xxh_u64 acc, xxh_u64 input) +{ + acc += input * XXH_PRIME64_2; + acc = XXH_rotl64(acc, 31); + acc *= XXH_PRIME64_1; + return acc; +} + +static xxh_u64 XXH64_mergeRound(xxh_u64 acc, xxh_u64 val) +{ + val = XXH64_round(0, val); + acc ^= val; + acc = acc * XXH_PRIME64_1 + XXH_PRIME64_4; + return acc; +} + +static xxh_u64 XXH64_avalanche(xxh_u64 h64) +{ + h64 ^= h64 >> 33; + h64 *= XXH_PRIME64_2; + h64 ^= h64 >> 29; + h64 *= XXH_PRIME64_3; + h64 ^= h64 >> 32; + return h64; +} + + +#define XXH_get64bits(p) XXH_readLE64_align(p, align) + +static xxh_u64 +XXH64_finalize(xxh_u64 h64, const xxh_u8* ptr, size_t len, XXH_alignment align) +{ +#define XXH_PROCESS1_64 do { \ + h64 ^= (*ptr++) * XXH_PRIME64_5; \ + h64 = XXH_rotl64(h64, 11) * XXH_PRIME64_1; \ +} while (0) + +#define XXH_PROCESS4_64 do { \ + h64 ^= (xxh_u64)(XXH_get32bits(ptr)) * XXH_PRIME64_1; \ + ptr += 4; \ + h64 = XXH_rotl64(h64, 23) * XXH_PRIME64_2 + XXH_PRIME64_3; \ +} while (0) + +#define XXH_PROCESS8_64 do { \ + xxh_u64 const k1 = XXH64_round(0, XXH_get64bits(ptr)); \ + ptr += 8; \ + h64 ^= k1; \ + h64 = XXH_rotl64(h64,27) * XXH_PRIME64_1 + XXH_PRIME64_4; \ +} while (0) + + /* Rerolled version for 32-bit targets is faster and much smaller. */ + if (XXH_REROLL || XXH_REROLL_XXH64) { + len &= 31; + while (len >= 8) { + XXH_PROCESS8_64; + len -= 8; + } + if (len >= 4) { + XXH_PROCESS4_64; + len -= 4; + } + while (len > 0) { + XXH_PROCESS1_64; + --len; + } + return XXH64_avalanche(h64); + } else { + switch(len & 31) { + case 24: XXH_PROCESS8_64; + /* fallthrough */ + case 16: XXH_PROCESS8_64; + /* fallthrough */ + case 8: XXH_PROCESS8_64; + return XXH64_avalanche(h64); + + case 28: XXH_PROCESS8_64; + /* fallthrough */ + case 20: XXH_PROCESS8_64; + /* fallthrough */ + case 12: XXH_PROCESS8_64; + /* fallthrough */ + case 4: XXH_PROCESS4_64; + return XXH64_avalanche(h64); + + case 25: XXH_PROCESS8_64; + /* fallthrough */ + case 17: XXH_PROCESS8_64; + /* fallthrough */ + case 9: XXH_PROCESS8_64; + XXH_PROCESS1_64; + return XXH64_avalanche(h64); + + case 29: XXH_PROCESS8_64; + /* fallthrough */ + case 21: XXH_PROCESS8_64; + /* fallthrough */ + case 13: XXH_PROCESS8_64; + /* fallthrough */ + case 5: XXH_PROCESS4_64; + XXH_PROCESS1_64; + return XXH64_avalanche(h64); + + case 26: XXH_PROCESS8_64; + /* fallthrough */ + case 18: XXH_PROCESS8_64; + /* fallthrough */ + case 10: XXH_PROCESS8_64; + XXH_PROCESS1_64; + XXH_PROCESS1_64; + return XXH64_avalanche(h64); + + case 30: XXH_PROCESS8_64; + /* fallthrough */ + case 22: XXH_PROCESS8_64; + /* fallthrough */ + case 14: XXH_PROCESS8_64; + /* fallthrough */ + case 6: XXH_PROCESS4_64; + XXH_PROCESS1_64; + XXH_PROCESS1_64; + return XXH64_avalanche(h64); + + case 27: XXH_PROCESS8_64; + /* fallthrough */ + case 19: XXH_PROCESS8_64; + /* fallthrough */ + case 11: XXH_PROCESS8_64; + XXH_PROCESS1_64; + XXH_PROCESS1_64; + XXH_PROCESS1_64; + return XXH64_avalanche(h64); + + case 31: XXH_PROCESS8_64; + /* fallthrough */ + case 23: XXH_PROCESS8_64; + /* fallthrough */ + case 15: XXH_PROCESS8_64; + /* fallthrough */ + case 7: XXH_PROCESS4_64; + /* fallthrough */ + case 3: XXH_PROCESS1_64; + /* fallthrough */ + case 2: XXH_PROCESS1_64; + /* fallthrough */ + case 1: XXH_PROCESS1_64; + /* fallthrough */ + case 0: return XXH64_avalanche(h64); + } + } + /* impossible to reach */ + XXH_ASSERT(0); + return 0; /* unreachable, but some compilers complain without it */ +} + +#ifdef XXH_OLD_NAMES +# define PROCESS1_64 XXH_PROCESS1_64 +# define PROCESS4_64 XXH_PROCESS4_64 +# define PROCESS8_64 XXH_PROCESS8_64 +#else +# undef XXH_PROCESS1_64 +# undef XXH_PROCESS4_64 +# undef XXH_PROCESS8_64 +#endif + +XXH_FORCE_INLINE xxh_u64 +XXH64_endian_align(const xxh_u8* input, size_t len, xxh_u64 seed, XXH_alignment align) +{ + const xxh_u8* bEnd = input + len; + xxh_u64 h64; + +#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) && (XXH_ACCEPT_NULL_INPUT_POINTER>=1) + if (input==NULL) { + len=0; + bEnd=input=(const xxh_u8*)(size_t)32; + } +#endif + + if (len>=32) { + const xxh_u8* const limit = bEnd - 32; + xxh_u64 v1 = seed + XXH_PRIME64_1 + XXH_PRIME64_2; + xxh_u64 v2 = seed + XXH_PRIME64_2; + xxh_u64 v3 = seed + 0; + xxh_u64 v4 = seed - XXH_PRIME64_1; + + do { + v1 = XXH64_round(v1, XXH_get64bits(input)); input+=8; + v2 = XXH64_round(v2, XXH_get64bits(input)); input+=8; + v3 = XXH64_round(v3, XXH_get64bits(input)); input+=8; + v4 = XXH64_round(v4, XXH_get64bits(input)); input+=8; + } while (input<=limit); + + h64 = XXH_rotl64(v1, 1) + XXH_rotl64(v2, 7) + XXH_rotl64(v3, 12) + XXH_rotl64(v4, 18); + h64 = XXH64_mergeRound(h64, v1); + h64 = XXH64_mergeRound(h64, v2); + h64 = XXH64_mergeRound(h64, v3); + h64 = XXH64_mergeRound(h64, v4); + + } else { + h64 = seed + XXH_PRIME64_5; + } + + h64 += (xxh_u64) len; + + return XXH64_finalize(h64, input, len, align); +} + + +XXH_PUBLIC_API XXH64_hash_t XXH64 (const void* input, size_t len, XXH64_hash_t seed) +{ +#if 0 + /* Simple version, good for code maintenance, but unfortunately slow for small inputs */ + XXH64_state_t state; + XXH64_reset(&state, seed); + XXH64_update(&state, (const xxh_u8*)input, len); + return XXH64_digest(&state); + +#else + + if (XXH_FORCE_ALIGN_CHECK) { + if ((((size_t)input) & 7)==0) { /* Input is aligned, let's leverage the speed advantage */ + return XXH64_endian_align((const xxh_u8*)input, len, seed, XXH_aligned); + } } + + return XXH64_endian_align((const xxh_u8*)input, len, seed, XXH_unaligned); + +#endif +} + +/******* Hash Streaming *******/ + +XXH_PUBLIC_API XXH64_state_t* XXH64_createState(void) +{ + return (XXH64_state_t*)XXH_malloc(sizeof(XXH64_state_t)); +} +XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr) +{ + XXH_free(statePtr); + return XXH_OK; +} + +XXH_PUBLIC_API void XXH64_copyState(XXH64_state_t* dstState, const XXH64_state_t* srcState) +{ + memcpy(dstState, srcState, sizeof(*dstState)); +} + +XXH_PUBLIC_API XXH_errorcode XXH64_reset(XXH64_state_t* statePtr, XXH64_hash_t seed) +{ + XXH64_state_t state; /* use a local state to memcpy() in order to avoid strict-aliasing warnings */ + memset(&state, 0, sizeof(state)); + state.v1 = seed + XXH_PRIME64_1 + XXH_PRIME64_2; + state.v2 = seed + XXH_PRIME64_2; + state.v3 = seed + 0; + state.v4 = seed - XXH_PRIME64_1; + /* do not write into reserved64, might be removed in a future version */ + memcpy(statePtr, &state, sizeof(state) - sizeof(state.reserved64)); + return XXH_OK; +} + +XXH_PUBLIC_API XXH_errorcode +XXH64_update (XXH64_state_t* state, const void* input, size_t len) +{ + if (input==NULL) +#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) && (XXH_ACCEPT_NULL_INPUT_POINTER>=1) + return XXH_OK; +#else + return XXH_ERROR; +#endif + + { const xxh_u8* p = (const xxh_u8*)input; + const xxh_u8* const bEnd = p + len; + + state->total_len += len; + + if (state->memsize + len < 32) { /* fill in tmp buffer */ + XXH_memcpy(((xxh_u8*)state->mem64) + state->memsize, input, len); + state->memsize += (xxh_u32)len; + return XXH_OK; + } + + if (state->memsize) { /* tmp buffer is full */ + XXH_memcpy(((xxh_u8*)state->mem64) + state->memsize, input, 32-state->memsize); + state->v1 = XXH64_round(state->v1, XXH_readLE64(state->mem64+0)); + state->v2 = XXH64_round(state->v2, XXH_readLE64(state->mem64+1)); + state->v3 = XXH64_round(state->v3, XXH_readLE64(state->mem64+2)); + state->v4 = XXH64_round(state->v4, XXH_readLE64(state->mem64+3)); + p += 32-state->memsize; + state->memsize = 0; + } + + if (p+32 <= bEnd) { + const xxh_u8* const limit = bEnd - 32; + xxh_u64 v1 = state->v1; + xxh_u64 v2 = state->v2; + xxh_u64 v3 = state->v3; + xxh_u64 v4 = state->v4; + + do { + v1 = XXH64_round(v1, XXH_readLE64(p)); p+=8; + v2 = XXH64_round(v2, XXH_readLE64(p)); p+=8; + v3 = XXH64_round(v3, XXH_readLE64(p)); p+=8; + v4 = XXH64_round(v4, XXH_readLE64(p)); p+=8; + } while (p<=limit); + + state->v1 = v1; + state->v2 = v2; + state->v3 = v3; + state->v4 = v4; + } + + if (p < bEnd) { + XXH_memcpy(state->mem64, p, (size_t)(bEnd-p)); + state->memsize = (unsigned)(bEnd-p); + } + } + + return XXH_OK; +} + + +XXH_PUBLIC_API XXH64_hash_t XXH64_digest (const XXH64_state_t* state) +{ + xxh_u64 h64; + + if (state->total_len >= 32) { + xxh_u64 const v1 = state->v1; + xxh_u64 const v2 = state->v2; + xxh_u64 const v3 = state->v3; + xxh_u64 const v4 = state->v4; + + h64 = XXH_rotl64(v1, 1) + XXH_rotl64(v2, 7) + XXH_rotl64(v3, 12) + XXH_rotl64(v4, 18); + h64 = XXH64_mergeRound(h64, v1); + h64 = XXH64_mergeRound(h64, v2); + h64 = XXH64_mergeRound(h64, v3); + h64 = XXH64_mergeRound(h64, v4); + } else { + h64 = state->v3 /*seed*/ + XXH_PRIME64_5; + } + + h64 += (xxh_u64) state->total_len; + + return XXH64_finalize(h64, (const xxh_u8*)state->mem64, (size_t)state->total_len, XXH_aligned); +} + + +/******* Canonical representation *******/ + +XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash) +{ + XXH_STATIC_ASSERT(sizeof(XXH64_canonical_t) == sizeof(XXH64_hash_t)); + if (XXH_CPU_LITTLE_ENDIAN) hash = XXH_swap64(hash); + memcpy(dst, &hash, sizeof(*dst)); +} + +XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src) +{ + return XXH_readBE64(src); +} + + + +/* ********************************************************************* +* XXH3 +* New generation hash designed for speed on small keys and vectorization +************************************************************************ */ + +/* === Compiler specifics === */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* >= C99 */ +# define XXH_RESTRICT restrict +#else +/* Note: it might be useful to define __restrict or __restrict__ for some C++ compilers */ +# define XXH_RESTRICT /* disable */ +#endif + +#if (defined(__GNUC__) && (__GNUC__ >= 3)) \ + || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800)) \ + || defined(__clang__) +# define XXH_likely(x) __builtin_expect(x, 1) +# define XXH_unlikely(x) __builtin_expect(x, 0) +#else +# define XXH_likely(x) (x) +# define XXH_unlikely(x) (x) +#endif + +#if defined(__GNUC__) +# if defined(__AVX2__) +# include <immintrin.h> +# elif defined(__SSE2__) +# include <emmintrin.h> +# elif defined(__ARM_NEON__) || defined(__ARM_NEON) +# define inline __inline__ /* circumvent a clang bug */ +# include <arm_neon.h> +# undef inline +# endif +#elif defined(_MSC_VER) +# include <intrin.h> +#endif + +/* + * One goal of XXH3 is to make it fast on both 32-bit and 64-bit, while + * remaining a true 64-bit/128-bit hash function. + * + * This is done by prioritizing a subset of 64-bit operations that can be + * emulated without too many steps on the average 32-bit machine. + * + * For example, these two lines seem similar, and run equally fast on 64-bit: + * + * xxh_u64 x; + * x ^= (x >> 47); // good + * x ^= (x >> 13); // bad + * + * However, to a 32-bit machine, there is a major difference. + * + * x ^= (x >> 47) looks like this: + * + * x.lo ^= (x.hi >> (47 - 32)); + * + * while x ^= (x >> 13) looks like this: + * + * // note: funnel shifts are not usually cheap. + * x.lo ^= (x.lo >> 13) | (x.hi << (32 - 13)); + * x.hi ^= (x.hi >> 13); + * + * The first one is significantly faster than the second, simply because the + * shift is larger than 32. This means: + * - All the bits we need are in the upper 32 bits, so we can ignore the lower + * 32 bits in the shift. + * - The shift result will always fit in the lower 32 bits, and therefore, + * we can ignore the upper 32 bits in the xor. + * + * Thanks to this optimization, XXH3 only requires these features to be efficient: + * + * - Usable unaligned access + * - A 32-bit or 64-bit ALU + * - If 32-bit, a decent ADC instruction + * - A 32 or 64-bit multiply with a 64-bit result + * - For the 128-bit variant, a decent byteswap helps short inputs. + * + * The first two are already required by XXH32, and almost all 32-bit and 64-bit + * platforms which can run XXH32 can run XXH3 efficiently. + * + * Thumb-1, the classic 16-bit only subset of ARM's instruction set, is one + * notable exception. + * + * First of all, Thumb-1 lacks support for the UMULL instruction which + * performs the important long multiply. This means numerous __aeabi_lmul + * calls. + * + * Second of all, the 8 functional registers are just not enough. + * Setup for __aeabi_lmul, byteshift loads, pointers, and all arithmetic need + * Lo registers, and this shuffling results in thousands more MOVs than A32. + * + * A32 and T32 don't have this limitation. They can access all 14 registers, + * do a 32->64 multiply with UMULL, and the flexible operand allowing free + * shifts is helpful, too. + * + * Therefore, we do a quick sanity check. + * + * If compiling Thumb-1 for a target which supports ARM instructions, we will + * emit a warning, as it is not a "sane" platform to compile for. + * + * Usually, if this happens, it is because of an accident and you probably need + * to specify -march, as you likely meant to compile for a newer architecture. + * + * Credit: large sections of the vectorial and asm source code paths + * have been contributed by @easyaspi314 + */ +#if defined(__thumb__) && !defined(__thumb2__) && defined(__ARM_ARCH_ISA_ARM) +# warning "XXH3 is highly inefficient without ARM or Thumb-2." +#endif + +/* ========================================== + * Vectorization detection + * ========================================== */ +#define XXH_SCALAR 0 /* Portable scalar version */ +#define XXH_SSE2 1 /* SSE2 for Pentium 4 and all x86_64 */ +#define XXH_AVX2 2 /* AVX2 for Haswell and Bulldozer */ +#define XXH_AVX512 3 /* AVX512 for Skylake and Icelake */ +#define XXH_NEON 4 /* NEON for most ARMv7-A and all AArch64 */ +#define XXH_VSX 5 /* VSX and ZVector for POWER8/z13 */ + +#ifndef XXH_VECTOR /* can be defined on command line */ +# if defined(__AVX512F__) +# define XXH_VECTOR XXH_AVX512 +# elif defined(__AVX2__) +# define XXH_VECTOR XXH_AVX2 +# elif defined(__SSE2__) || defined(_M_AMD64) || defined(_M_X64) || (defined(_M_IX86_FP) && (_M_IX86_FP == 2)) +# define XXH_VECTOR XXH_SSE2 +# elif defined(__GNUC__) /* msvc support maybe later */ \ + && (defined(__ARM_NEON__) || defined(__ARM_NEON)) \ + && (defined(__LITTLE_ENDIAN__) /* We only support little endian NEON */ \ + || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) +# define XXH_VECTOR XXH_NEON +# elif (defined(__PPC64__) && defined(__POWER8_VECTOR__)) \ + || (defined(__s390x__) && defined(__VEC__)) \ + && defined(__GNUC__) /* TODO: IBM XL */ +# define XXH_VECTOR XXH_VSX +# else +# define XXH_VECTOR XXH_SCALAR +# endif +#endif + +/* + * Controls the alignment of the accumulator, + * for compatibility with aligned vector loads, which are usually faster. + */ +#ifndef XXH_ACC_ALIGN +# if defined(XXH_X86DISPATCH) +# define XXH_ACC_ALIGN 64 /* for compatibility with avx512 */ +# elif XXH_VECTOR == XXH_SCALAR /* scalar */ +# define XXH_ACC_ALIGN 8 +# elif XXH_VECTOR == XXH_SSE2 /* sse2 */ +# define XXH_ACC_ALIGN 16 +# elif XXH_VECTOR == XXH_AVX2 /* avx2 */ +# define XXH_ACC_ALIGN 32 +# elif XXH_VECTOR == XXH_NEON /* neon */ +# define XXH_ACC_ALIGN 16 +# elif XXH_VECTOR == XXH_VSX /* vsx */ +# define XXH_ACC_ALIGN 16 +# elif XXH_VECTOR == XXH_AVX512 /* avx512 */ +# define XXH_ACC_ALIGN 64 +# endif +#endif + +#if defined(XXH_X86DISPATCH) || XXH_VECTOR == XXH_SSE2 \ + || XXH_VECTOR == XXH_AVX2 || XXH_VECTOR == XXH_AVX512 +# define XXH_SEC_ALIGN XXH_ACC_ALIGN +#else +# define XXH_SEC_ALIGN 8 +#endif + +/* + * UGLY HACK: + * GCC usually generates the best code with -O3 for xxHash. + * + * However, when targeting AVX2, it is overzealous in its unrolling resulting + * in code roughly 3/4 the speed of Clang. + * + * There are other issues, such as GCC splitting _mm256_loadu_si256 into + * _mm_loadu_si128 + _mm256_inserti128_si256. This is an optimization which + * only applies to Sandy and Ivy Bridge... which don't even support AVX2. + * + * That is why when compiling the AVX2 version, it is recommended to use either + * -O2 -mavx2 -march=haswell + * or + * -O2 -mavx2 -mno-avx256-split-unaligned-load + * for decent performance, or to use Clang instead. + * + * Fortunately, we can control the first one with a pragma that forces GCC into + * -O2, but the other one we can't control without "failed to inline always + * inline function due to target mismatch" warnings. + */ +#if XXH_VECTOR == XXH_AVX2 /* AVX2 */ \ + && defined(__GNUC__) && !defined(__clang__) /* GCC, not Clang */ \ + && defined(__OPTIMIZE__) && !defined(__OPTIMIZE_SIZE__) /* respect -O0 and -Os */ +# pragma GCC push_options +# pragma GCC optimize("-O2") +#endif + + +#if XXH_VECTOR == XXH_NEON +/* + * NEON's setup for vmlal_u32 is a little more complicated than it is on + * SSE2, AVX2, and VSX. + * + * While PMULUDQ and VMULEUW both perform a mask, VMLAL.U32 performs an upcast. + * + * To do the same operation, the 128-bit 'Q' register needs to be split into + * two 64-bit 'D' registers, performing this operation:: + * + * [ a | b ] + * | '---------. .--------' | + * | x | + * | .---------' '--------. | + * [ a & 0xFFFFFFFF | b & 0xFFFFFFFF ],[ a >> 32 | b >> 32 ] + * + * Due to significant changes in aarch64, the fastest method for aarch64 is + * completely different than the fastest method for ARMv7-A. + * + * ARMv7-A treats D registers as unions overlaying Q registers, so modifying + * D11 will modify the high half of Q5. This is similar to how modifying AH + * will only affect bits 8-15 of AX on x86. + * + * VZIP takes two registers, and puts even lanes in one register and odd lanes + * in the other. + * + * On ARMv7-A, this strangely modifies both parameters in place instead of + * taking the usual 3-operand form. + * + * Therefore, if we want to do this, we can simply use a D-form VZIP.32 on the + * lower and upper halves of the Q register to end up with the high and low + * halves where we want - all in one instruction. + * + * vzip.32 d10, d11 @ d10 = { d10[0], d11[0] }; d11 = { d10[1], d11[1] } + * + * Unfortunately we need inline assembly for this: Instructions modifying two + * registers at once is not possible in GCC or Clang's IR, and they have to + * create a copy. + * + * aarch64 requires a different approach. + * + * In order to make it easier to write a decent compiler for aarch64, many + * quirks were removed, such as conditional execution. + * + * NEON was also affected by this. + * + * aarch64 cannot access the high bits of a Q-form register, and writes to a + * D-form register zero the high bits, similar to how writes to W-form scalar + * registers (or DWORD registers on x86_64) work. + * + * The formerly free vget_high intrinsics now require a vext (with a few + * exceptions) + * + * Additionally, VZIP was replaced by ZIP1 and ZIP2, which are the equivalent + * of PUNPCKL* and PUNPCKH* in SSE, respectively, in order to only modify one + * operand. + * + * The equivalent of the VZIP.32 on the lower and upper halves would be this + * mess: + * + * ext v2.4s, v0.4s, v0.4s, #2 // v2 = { v0[2], v0[3], v0[0], v0[1] } + * zip1 v1.2s, v0.2s, v2.2s // v1 = { v0[0], v2[0] } + * zip2 v0.2s, v0.2s, v1.2s // v0 = { v0[1], v2[1] } + * + * Instead, we use a literal downcast, vmovn_u64 (XTN), and vshrn_n_u64 (SHRN): + * + * shrn v1.2s, v0.2d, #32 // v1 = (uint32x2_t)(v0 >> 32); + * xtn v0.2s, v0.2d // v0 = (uint32x2_t)(v0 & 0xFFFFFFFF); + * + * This is available on ARMv7-A, but is less efficient than a single VZIP.32. + */ + +/* + * Function-like macro: + * void XXH_SPLIT_IN_PLACE(uint64x2_t &in, uint32x2_t &outLo, uint32x2_t &outHi) + * { + * outLo = (uint32x2_t)(in & 0xFFFFFFFF); + * outHi = (uint32x2_t)(in >> 32); + * in = UNDEFINED; + * } + */ +# if !defined(XXH_NO_VZIP_HACK) /* define to disable */ \ + && defined(__GNUC__) \ + && !defined(__aarch64__) && !defined(__arm64__) +# define XXH_SPLIT_IN_PLACE(in, outLo, outHi) \ + do { \ + /* Undocumented GCC/Clang operand modifier: %e0 = lower D half, %f0 = upper D half */ \ + /* https://github.com/gcc-mirror/gcc/blob/38cf91e5/gcc/config/arm/arm.c#L22486 */ \ + /* https://github.com/llvm-mirror/llvm/blob/2c4ca683/lib/Target/ARM/ARMAsmPrinter.cpp#L399 */ \ + __asm__("vzip.32 %e0, %f0" : "+w" (in)); \ + (outLo) = vget_low_u32 (vreinterpretq_u32_u64(in)); \ + (outHi) = vget_high_u32(vreinterpretq_u32_u64(in)); \ + } while (0) +# else +# define XXH_SPLIT_IN_PLACE(in, outLo, outHi) \ + do { \ + (outLo) = vmovn_u64 (in); \ + (outHi) = vshrn_n_u64 ((in), 32); \ + } while (0) +# endif +#endif /* XXH_VECTOR == XXH_NEON */ + +/* + * VSX and Z Vector helpers. + * + * This is very messy, and any pull requests to clean this up are welcome. + * + * There are a lot of problems with supporting VSX and s390x, due to + * inconsistent intrinsics, spotty coverage, and multiple endiannesses. + */ +#if XXH_VECTOR == XXH_VSX +# if defined(__s390x__) +# include <s390intrin.h> +# else +/* gcc's altivec.h can have the unwanted consequence to unconditionally + * #define bool, vector, and pixel keywords, + * with bad consequences for programs already using these keywords for other purposes. + * The paragraph defining these macros is skipped when __APPLE_ALTIVEC__ is defined. + * __APPLE_ALTIVEC__ is _generally_ defined automatically by the compiler, + * but it seems that, in some cases, it isn't. + * Force the build macro to be defined, so that keywords are not altered. + */ +# if defined(__GNUC__) && !defined(__APPLE_ALTIVEC__) +# define __APPLE_ALTIVEC__ +# endif +# include <altivec.h> +# endif + +typedef __vector unsigned long long xxh_u64x2; +typedef __vector unsigned char xxh_u8x16; +typedef __vector unsigned xxh_u32x4; + +# ifndef XXH_VSX_BE +# if defined(__BIG_ENDIAN__) \ + || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) +# define XXH_VSX_BE 1 +# elif defined(__VEC_ELEMENT_REG_ORDER__) && __VEC_ELEMENT_REG_ORDER__ == __ORDER_BIG_ENDIAN__ +# warning "-maltivec=be is not recommended. Please use native endianness." +# define XXH_VSX_BE 1 +# else +# define XXH_VSX_BE 0 +# endif +# endif /* !defined(XXH_VSX_BE) */ + +# if XXH_VSX_BE +/* A wrapper for POWER9's vec_revb. */ +# if defined(__POWER9_VECTOR__) || (defined(__clang__) && defined(__s390x__)) +# define XXH_vec_revb vec_revb +# else +XXH_FORCE_INLINE xxh_u64x2 XXH_vec_revb(xxh_u64x2 val) +{ + xxh_u8x16 const vByteSwap = { 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, + 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08 }; + return vec_perm(val, val, vByteSwap); +} +# endif +# endif /* XXH_VSX_BE */ + +/* + * Performs an unaligned load and byte swaps it on big endian. + */ +XXH_FORCE_INLINE xxh_u64x2 XXH_vec_loadu(const void *ptr) +{ + xxh_u64x2 ret; + memcpy(&ret, ptr, sizeof(xxh_u64x2)); +# if XXH_VSX_BE + ret = XXH_vec_revb(ret); +# endif + return ret; +} + +/* + * vec_mulo and vec_mule are very problematic intrinsics on PowerPC + * + * These intrinsics weren't added until GCC 8, despite existing for a while, + * and they are endian dependent. Also, their meaning swap depending on version. + * */ +# if defined(__s390x__) + /* s390x is always big endian, no issue on this platform */ +# define XXH_vec_mulo vec_mulo +# define XXH_vec_mule vec_mule +# elif defined(__clang__) && XXH_HAS_BUILTIN(__builtin_altivec_vmuleuw) +/* Clang has a better way to control this, we can just use the builtin which doesn't swap. */ +# define XXH_vec_mulo __builtin_altivec_vmulouw +# define XXH_vec_mule __builtin_altivec_vmuleuw +# else +/* gcc needs inline assembly */ +/* Adapted from https://github.com/google/highwayhash/blob/master/highwayhash/hh_vsx.h. */ +XXH_FORCE_INLINE xxh_u64x2 XXH_vec_mulo(xxh_u32x4 a, xxh_u32x4 b) +{ + xxh_u64x2 result; + __asm__("vmulouw %0, %1, %2" : "=v" (result) : "v" (a), "v" (b)); + return result; +} +XXH_FORCE_INLINE xxh_u64x2 XXH_vec_mule(xxh_u32x4 a, xxh_u32x4 b) +{ + xxh_u64x2 result; + __asm__("vmuleuw %0, %1, %2" : "=v" (result) : "v" (a), "v" (b)); + return result; +} +# endif /* XXH_vec_mulo, XXH_vec_mule */ +#endif /* XXH_VECTOR == XXH_VSX */ + + +/* prefetch + * can be disabled, by declaring XXH_NO_PREFETCH build macro */ +#if defined(XXH_NO_PREFETCH) +# define XXH_PREFETCH(ptr) (void)(ptr) /* disabled */ +#else +# if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_I86)) /* _mm_prefetch() is not defined outside of x86/x64 */ +# include <mmintrin.h> /* https://msdn.microsoft.com/fr-fr/library/84szxsww(v=vs.90).aspx */ +# define XXH_PREFETCH(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T0) +# elif defined(__GNUC__) && ( (__GNUC__ >= 4) || ( (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1) ) ) +# define XXH_PREFETCH(ptr) __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */) +# else +# define XXH_PREFETCH(ptr) (void)(ptr) /* disabled */ +# endif +#endif /* XXH_NO_PREFETCH */ + + +/* ========================================== + * XXH3 default settings + * ========================================== */ + +#define XXH_SECRET_DEFAULT_SIZE 192 /* minimum XXH3_SECRET_SIZE_MIN */ + +#if (XXH_SECRET_DEFAULT_SIZE < XXH3_SECRET_SIZE_MIN) +# error "default keyset is not large enough" +#endif + +/* Pseudorandom secret taken directly from FARSH */ +XXH_ALIGN(64) static const xxh_u8 XXH3_kSecret[XXH_SECRET_DEFAULT_SIZE] = { + 0xb8, 0xfe, 0x6c, 0x39, 0x23, 0xa4, 0x4b, 0xbe, 0x7c, 0x01, 0x81, 0x2c, 0xf7, 0x21, 0xad, 0x1c, + 0xde, 0xd4, 0x6d, 0xe9, 0x83, 0x90, 0x97, 0xdb, 0x72, 0x40, 0xa4, 0xa4, 0xb7, 0xb3, 0x67, 0x1f, + 0xcb, 0x79, 0xe6, 0x4e, 0xcc, 0xc0, 0xe5, 0x78, 0x82, 0x5a, 0xd0, 0x7d, 0xcc, 0xff, 0x72, 0x21, + 0xb8, 0x08, 0x46, 0x74, 0xf7, 0x43, 0x24, 0x8e, 0xe0, 0x35, 0x90, 0xe6, 0x81, 0x3a, 0x26, 0x4c, + 0x3c, 0x28, 0x52, 0xbb, 0x91, 0xc3, 0x00, 0xcb, 0x88, 0xd0, 0x65, 0x8b, 0x1b, 0x53, 0x2e, 0xa3, + 0x71, 0x64, 0x48, 0x97, 0xa2, 0x0d, 0xf9, 0x4e, 0x38, 0x19, 0xef, 0x46, 0xa9, 0xde, 0xac, 0xd8, + 0xa8, 0xfa, 0x76, 0x3f, 0xe3, 0x9c, 0x34, 0x3f, 0xf9, 0xdc, 0xbb, 0xc7, 0xc7, 0x0b, 0x4f, 0x1d, + 0x8a, 0x51, 0xe0, 0x4b, 0xcd, 0xb4, 0x59, 0x31, 0xc8, 0x9f, 0x7e, 0xc9, 0xd9, 0x78, 0x73, 0x64, + 0xea, 0xc5, 0xac, 0x83, 0x34, 0xd3, 0xeb, 0xc3, 0xc5, 0x81, 0xa0, 0xff, 0xfa, 0x13, 0x63, 0xeb, + 0x17, 0x0d, 0xdd, 0x51, 0xb7, 0xf0, 0xda, 0x49, 0xd3, 0x16, 0x55, 0x26, 0x29, 0xd4, 0x68, 0x9e, + 0x2b, 0x16, 0xbe, 0x58, 0x7d, 0x47, 0xa1, 0xfc, 0x8f, 0xf8, 0xb8, 0xd1, 0x7a, 0xd0, 0x31, 0xce, + 0x45, 0xcb, 0x3a, 0x8f, 0x95, 0x16, 0x04, 0x28, 0xaf, 0xd7, 0xfb, 0xca, 0xbb, 0x4b, 0x40, 0x7e, +}; + + +#ifdef XXH_OLD_NAMES +# define kSecret XXH3_kSecret +#endif + +/* + * Calculates a 32-bit to 64-bit long multiply. + * + * Wraps __emulu on MSVC x86 because it tends to call __allmul when it doesn't + * need to (but it shouldn't need to anyways, it is about 7 instructions to do + * a 64x64 multiply...). Since we know that this will _always_ emit MULL, we + * use that instead of the normal method. + * + * If you are compiling for platforms like Thumb-1 and don't have a better option, + * you may also want to write your own long multiply routine here. + * + * XXH_FORCE_INLINE xxh_u64 XXH_mult32to64(xxh_u64 x, xxh_u64 y) + * { + * return (x & 0xFFFFFFFF) * (y & 0xFFFFFFFF); + * } + */ +#if defined(_MSC_VER) && defined(_M_IX86) +# include <intrin.h> +# define XXH_mult32to64(x, y) __emulu((unsigned)(x), (unsigned)(y)) +#else +/* + * Downcast + upcast is usually better than masking on older compilers like + * GCC 4.2 (especially 32-bit ones), all without affecting newer compilers. + * + * The other method, (x & 0xFFFFFFFF) * (y & 0xFFFFFFFF), will AND both operands + * and perform a full 64x64 multiply -- entirely redundant on 32-bit. + */ +# define XXH_mult32to64(x, y) ((xxh_u64)(xxh_u32)(x) * (xxh_u64)(xxh_u32)(y)) +#endif + +/* + * Calculates a 64->128-bit long multiply. + * + * Uses __uint128_t and _umul128 if available, otherwise uses a scalar version. + */ +static XXH128_hash_t +XXH_mult64to128(xxh_u64 lhs, xxh_u64 rhs) +{ + /* + * GCC/Clang __uint128_t method. + * + * On most 64-bit targets, GCC and Clang define a __uint128_t type. + * This is usually the best way as it usually uses a native long 64-bit + * multiply, such as MULQ on x86_64 or MUL + UMULH on aarch64. + * + * Usually. + * + * Despite being a 32-bit platform, Clang (and emscripten) define this type + * despite not having the arithmetic for it. This results in a laggy + * compiler builtin call which calculates a full 128-bit multiply. + * In that case it is best to use the portable one. + * https://github.com/Cyan4973/xxHash/issues/211#issuecomment-515575677 + */ +#if defined(__GNUC__) && !defined(__wasm__) \ + && defined(__SIZEOF_INT128__) \ + || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 128) + + __uint128_t const product = (__uint128_t)lhs * (__uint128_t)rhs; + XXH128_hash_t r128; + r128.low64 = (xxh_u64)(product); + r128.high64 = (xxh_u64)(product >> 64); + return r128; + + /* + * MSVC for x64's _umul128 method. + * + * xxh_u64 _umul128(xxh_u64 Multiplier, xxh_u64 Multiplicand, xxh_u64 *HighProduct); + * + * This compiles to single operand MUL on x64. + */ +#elif defined(_M_X64) || defined(_M_IA64) + +#ifndef _MSC_VER +# pragma intrinsic(_umul128) +#endif + xxh_u64 product_high; + xxh_u64 const product_low = _umul128(lhs, rhs, &product_high); + XXH128_hash_t r128; + r128.low64 = product_low; + r128.high64 = product_high; + return r128; + +#else + /* + * Portable scalar method. Optimized for 32-bit and 64-bit ALUs. + * + * This is a fast and simple grade school multiply, which is shown below + * with base 10 arithmetic instead of base 0x100000000. + * + * 9 3 // D2 lhs = 93 + * x 7 5 // D2 rhs = 75 + * ---------- + * 1 5 // D2 lo_lo = (93 % 10) * (75 % 10) = 15 + * 4 5 | // D2 hi_lo = (93 / 10) * (75 % 10) = 45 + * 2 1 | // D2 lo_hi = (93 % 10) * (75 / 10) = 21 + * + 6 3 | | // D2 hi_hi = (93 / 10) * (75 / 10) = 63 + * --------- + * 2 7 | // D2 cross = (15 / 10) + (45 % 10) + 21 = 27 + * + 6 7 | | // D2 upper = (27 / 10) + (45 / 10) + 63 = 67 + * --------- + * 6 9 7 5 // D4 res = (27 * 10) + (15 % 10) + (67 * 100) = 6975 + * + * The reasons for adding the products like this are: + * 1. It avoids manual carry tracking. Just like how + * (9 * 9) + 9 + 9 = 99, the same applies with this for UINT64_MAX. + * This avoids a lot of complexity. + * + * 2. It hints for, and on Clang, compiles to, the powerful UMAAL + * instruction available in ARM's Digital Signal Processing extension + * in 32-bit ARMv6 and later, which is shown below: + * + * void UMAAL(xxh_u32 *RdLo, xxh_u32 *RdHi, xxh_u32 Rn, xxh_u32 Rm) + * { + * xxh_u64 product = (xxh_u64)*RdLo * (xxh_u64)*RdHi + Rn + Rm; + * *RdLo = (xxh_u32)(product & 0xFFFFFFFF); + * *RdHi = (xxh_u32)(product >> 32); + * } + * + * This instruction was designed for efficient long multiplication, and + * allows this to be calculated in only 4 instructions at speeds + * comparable to some 64-bit ALUs. + * + * 3. It isn't terrible on other platforms. Usually this will be a couple + * of 32-bit ADD/ADCs. + */ + + /* First calculate all of the cross products. */ + xxh_u64 const lo_lo = XXH_mult32to64(lhs & 0xFFFFFFFF, rhs & 0xFFFFFFFF); + xxh_u64 const hi_lo = XXH_mult32to64(lhs >> 32, rhs & 0xFFFFFFFF); + xxh_u64 const lo_hi = XXH_mult32to64(lhs & 0xFFFFFFFF, rhs >> 32); + xxh_u64 const hi_hi = XXH_mult32to64(lhs >> 32, rhs >> 32); + + /* Now add the products together. These will never overflow. */ + xxh_u64 const cross = (lo_lo >> 32) + (hi_lo & 0xFFFFFFFF) + lo_hi; + xxh_u64 const upper = (hi_lo >> 32) + (cross >> 32) + hi_hi; + xxh_u64 const lower = (cross << 32) | (lo_lo & 0xFFFFFFFF); + + XXH128_hash_t r128; + r128.low64 = lower; + r128.high64 = upper; + return r128; +#endif +} + +/* + * Does a 64-bit to 128-bit multiply, then XOR folds it. + * + * The reason for the separate function is to prevent passing too many structs + * around by value. This will hopefully inline the multiply, but we don't force it. + */ +static xxh_u64 +XXH3_mul128_fold64(xxh_u64 lhs, xxh_u64 rhs) +{ + XXH128_hash_t product = XXH_mult64to128(lhs, rhs); + return product.low64 ^ product.high64; +} + +/* Seems to produce slightly better code on GCC for some reason. */ +XXH_FORCE_INLINE xxh_u64 XXH_xorshift64(xxh_u64 v64, int shift) +{ + XXH_ASSERT(0 <= shift && shift < 64); + return v64 ^ (v64 >> shift); +} + +/* + * This is a fast avalanche stage, + * suitable when input bits are already partially mixed + */ +static XXH64_hash_t XXH3_avalanche(xxh_u64 h64) +{ + h64 = XXH_xorshift64(h64, 37); + h64 *= 0x165667919E3779F9ULL; + h64 = XXH_xorshift64(h64, 32); + return h64; +} + +/* + * This is a stronger avalanche, + * inspired by Pelle Evensen's rrmxmx + * preferable when input has not been previously mixed + */ +static XXH64_hash_t XXH3_rrmxmx(xxh_u64 h64, xxh_u64 len) +{ + /* this mix is inspired by Pelle Evensen's rrmxmx */ + h64 ^= XXH_rotl64(h64, 49) ^ XXH_rotl64(h64, 24); + h64 *= 0x9FB21C651E98DF25ULL; + h64 ^= (h64 >> 35) + len ; + h64 *= 0x9FB21C651E98DF25ULL; + return XXH_xorshift64(h64, 28); +} + + +/* ========================================== + * Short keys + * ========================================== + * One of the shortcomings of XXH32 and XXH64 was that their performance was + * sub-optimal on short lengths. It used an iterative algorithm which strongly + * favored lengths that were a multiple of 4 or 8. + * + * Instead of iterating over individual inputs, we use a set of single shot + * functions which piece together a range of lengths and operate in constant time. + * + * Additionally, the number of multiplies has been significantly reduced. This + * reduces latency, especially when emulating 64-bit multiplies on 32-bit. + * + * Depending on the platform, this may or may not be faster than XXH32, but it + * is almost guaranteed to be faster than XXH64. + */ + +/* + * At very short lengths, there isn't enough input to fully hide secrets, or use + * the entire secret. + * + * There is also only a limited amount of mixing we can do before significantly + * impacting performance. + * + * Therefore, we use different sections of the secret and always mix two secret + * samples with an XOR. This should have no effect on performance on the + * seedless or withSeed variants because everything _should_ be constant folded + * by modern compilers. + * + * The XOR mixing hides individual parts of the secret and increases entropy. + * + * This adds an extra layer of strength for custom secrets. + */ +XXH_FORCE_INLINE XXH64_hash_t +XXH3_len_1to3_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) +{ + XXH_ASSERT(input != NULL); + XXH_ASSERT(1 <= len && len <= 3); + XXH_ASSERT(secret != NULL); + /* + * len = 1: combined = { input[0], 0x01, input[0], input[0] } + * len = 2: combined = { input[1], 0x02, input[0], input[1] } + * len = 3: combined = { input[2], 0x03, input[0], input[1] } + */ + { xxh_u8 const c1 = input[0]; + xxh_u8 const c2 = input[len >> 1]; + xxh_u8 const c3 = input[len - 1]; + xxh_u32 const combined = ((xxh_u32)c1 << 16) | ((xxh_u32)c2 << 24) + | ((xxh_u32)c3 << 0) | ((xxh_u32)len << 8); + xxh_u64 const bitflip = (XXH_readLE32(secret) ^ XXH_readLE32(secret+4)) + seed; + xxh_u64 const keyed = (xxh_u64)combined ^ bitflip; + return XXH64_avalanche(keyed); + } +} + +XXH_FORCE_INLINE XXH64_hash_t +XXH3_len_4to8_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) +{ + XXH_ASSERT(input != NULL); + XXH_ASSERT(secret != NULL); + XXH_ASSERT(4 <= len && len < 8); + seed ^= (xxh_u64)XXH_swap32((xxh_u32)seed) << 32; + { xxh_u32 const input1 = XXH_readLE32(input); + xxh_u32 const input2 = XXH_readLE32(input + len - 4); + xxh_u64 const bitflip = (XXH_readLE64(secret+8) ^ XXH_readLE64(secret+16)) - seed; + xxh_u64 const input64 = input2 + (((xxh_u64)input1) << 32); + xxh_u64 const keyed = input64 ^ bitflip; + return XXH3_rrmxmx(keyed, len); + } +} + +XXH_FORCE_INLINE XXH64_hash_t +XXH3_len_9to16_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) +{ + XXH_ASSERT(input != NULL); + XXH_ASSERT(secret != NULL); + XXH_ASSERT(8 <= len && len <= 16); + { xxh_u64 const bitflip1 = (XXH_readLE64(secret+24) ^ XXH_readLE64(secret+32)) + seed; + xxh_u64 const bitflip2 = (XXH_readLE64(secret+40) ^ XXH_readLE64(secret+48)) - seed; + xxh_u64 const input_lo = XXH_readLE64(input) ^ bitflip1; + xxh_u64 const input_hi = XXH_readLE64(input + len - 8) ^ bitflip2; + xxh_u64 const acc = len + + XXH_swap64(input_lo) + input_hi + + XXH3_mul128_fold64(input_lo, input_hi); + return XXH3_avalanche(acc); + } +} + +XXH_FORCE_INLINE XXH64_hash_t +XXH3_len_0to16_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) +{ + XXH_ASSERT(len <= 16); + { if (XXH_likely(len > 8)) return XXH3_len_9to16_64b(input, len, secret, seed); + if (XXH_likely(len >= 4)) return XXH3_len_4to8_64b(input, len, secret, seed); + if (len) return XXH3_len_1to3_64b(input, len, secret, seed); + return XXH64_avalanche(seed ^ (XXH_readLE64(secret+56) ^ XXH_readLE64(secret+64))); + } +} + +/* + * DISCLAIMER: There are known *seed-dependent* multicollisions here due to + * multiplication by zero, affecting hashes of lengths 17 to 240. + * + * However, they are very unlikely. + * + * Keep this in mind when using the unseeded XXH3_64bits() variant: As with all + * unseeded non-cryptographic hashes, it does not attempt to defend itself + * against specially crafted inputs, only random inputs. + * + * Compared to classic UMAC where a 1 in 2^31 chance of 4 consecutive bytes + * cancelling out the secret is taken an arbitrary number of times (addressed + * in XXH3_accumulate_512), this collision is very unlikely with random inputs + * and/or proper seeding: + * + * This only has a 1 in 2^63 chance of 8 consecutive bytes cancelling out, in a + * function that is only called up to 16 times per hash with up to 240 bytes of + * input. + * + * This is not too bad for a non-cryptographic hash function, especially with + * only 64 bit outputs. + * + * The 128-bit variant (which trades some speed for strength) is NOT affected + * by this, although it is always a good idea to use a proper seed if you care + * about strength. + */ +XXH_FORCE_INLINE xxh_u64 XXH3_mix16B(const xxh_u8* XXH_RESTRICT input, + const xxh_u8* XXH_RESTRICT secret, xxh_u64 seed64) +{ +#if defined(__GNUC__) && !defined(__clang__) /* GCC, not Clang */ \ + && defined(__i386__) && defined(__SSE2__) /* x86 + SSE2 */ \ + && !defined(XXH_ENABLE_AUTOVECTORIZE) /* Define to disable like XXH32 hack */ + /* + * UGLY HACK: + * GCC for x86 tends to autovectorize the 128-bit multiply, resulting in + * slower code. + * + * By forcing seed64 into a register, we disrupt the cost model and + * cause it to scalarize. See `XXH32_round()` + * + * FIXME: Clang's output is still _much_ faster -- On an AMD Ryzen 3600, + * XXH3_64bits @ len=240 runs at 4.6 GB/s with Clang 9, but 3.3 GB/s on + * GCC 9.2, despite both emitting scalar code. + * + * GCC generates much better scalar code than Clang for the rest of XXH3, + * which is why finding a more optimal codepath is an interest. + */ + __asm__ ("" : "+r" (seed64)); +#endif + { xxh_u64 const input_lo = XXH_readLE64(input); + xxh_u64 const input_hi = XXH_readLE64(input+8); + return XXH3_mul128_fold64( + input_lo ^ (XXH_readLE64(secret) + seed64), + input_hi ^ (XXH_readLE64(secret+8) - seed64) + ); + } +} + +/* For mid range keys, XXH3 uses a Mum-hash variant. */ +XXH_FORCE_INLINE XXH64_hash_t +XXH3_len_17to128_64b(const xxh_u8* XXH_RESTRICT input, size_t len, + const xxh_u8* XXH_RESTRICT secret, size_t secretSize, + XXH64_hash_t seed) +{ + XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); (void)secretSize; + XXH_ASSERT(16 < len && len <= 128); + + { xxh_u64 acc = len * XXH_PRIME64_1; + if (len > 32) { + if (len > 64) { + if (len > 96) { + acc += XXH3_mix16B(input+48, secret+96, seed); + acc += XXH3_mix16B(input+len-64, secret+112, seed); + } + acc += XXH3_mix16B(input+32, secret+64, seed); + acc += XXH3_mix16B(input+len-48, secret+80, seed); + } + acc += XXH3_mix16B(input+16, secret+32, seed); + acc += XXH3_mix16B(input+len-32, secret+48, seed); + } + acc += XXH3_mix16B(input+0, secret+0, seed); + acc += XXH3_mix16B(input+len-16, secret+16, seed); + + return XXH3_avalanche(acc); + } +} + +#define XXH3_MIDSIZE_MAX 240 + +XXH_NO_INLINE XXH64_hash_t +XXH3_len_129to240_64b(const xxh_u8* XXH_RESTRICT input, size_t len, + const xxh_u8* XXH_RESTRICT secret, size_t secretSize, + XXH64_hash_t seed) +{ + XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); (void)secretSize; + XXH_ASSERT(128 < len && len <= XXH3_MIDSIZE_MAX); + + #define XXH3_MIDSIZE_STARTOFFSET 3 + #define XXH3_MIDSIZE_LASTOFFSET 17 + + { xxh_u64 acc = len * XXH_PRIME64_1; + int const nbRounds = (int)len / 16; + int i; + for (i=0; i<8; i++) { + acc += XXH3_mix16B(input+(16*i), secret+(16*i), seed); + } + acc = XXH3_avalanche(acc); + XXH_ASSERT(nbRounds >= 8); +#if defined(__clang__) /* Clang */ \ + && (defined(__ARM_NEON) || defined(__ARM_NEON__)) /* NEON */ \ + && !defined(XXH_ENABLE_AUTOVECTORIZE) /* Define to disable */ + /* + * UGLY HACK: + * Clang for ARMv7-A tries to vectorize this loop, similar to GCC x86. + * In everywhere else, it uses scalar code. + * + * For 64->128-bit multiplies, even if the NEON was 100% optimal, it + * would still be slower than UMAAL (see XXH_mult64to128). + * + * Unfortunately, Clang doesn't handle the long multiplies properly and + * converts them to the nonexistent "vmulq_u64" intrinsic, which is then + * scalarized into an ugly mess of VMOV.32 instructions. + * + * This mess is difficult to avoid without turning autovectorization + * off completely, but they are usually relatively minor and/or not + * worth it to fix. + * + * This loop is the easiest to fix, as unlike XXH32, this pragma + * _actually works_ because it is a loop vectorization instead of an + * SLP vectorization. + */ + #pragma clang loop vectorize(disable) +#endif + for (i=8 ; i < nbRounds; i++) { + acc += XXH3_mix16B(input+(16*i), secret+(16*(i-8)) + XXH3_MIDSIZE_STARTOFFSET, seed); + } + /* last bytes */ + acc += XXH3_mix16B(input + len - 16, secret + XXH3_SECRET_SIZE_MIN - XXH3_MIDSIZE_LASTOFFSET, seed); + return XXH3_avalanche(acc); + } +} + + +/* ======= Long Keys ======= */ + +#define XXH_STRIPE_LEN 64 +#define XXH_SECRET_CONSUME_RATE 8 /* nb of secret bytes consumed at each accumulation */ +#define XXH_ACC_NB (XXH_STRIPE_LEN / sizeof(xxh_u64)) + +#ifdef XXH_OLD_NAMES +# define STRIPE_LEN XXH_STRIPE_LEN +# define ACC_NB XXH_ACC_NB +#endif + +XXH_FORCE_INLINE void XXH_writeLE64(void* dst, xxh_u64 v64) +{ + if (!XXH_CPU_LITTLE_ENDIAN) v64 = XXH_swap64(v64); + memcpy(dst, &v64, sizeof(v64)); +} + +/* Several intrinsic functions below are supposed to accept __int64 as argument, + * as documented in https://software.intel.com/sites/landingpage/IntrinsicsGuide/ . + * However, several environments do not define __int64 type, + * requiring a workaround. + */ +#if !defined (__VMS) \ + && (defined (__cplusplus) \ + || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) + typedef int64_t xxh_i64; +#else + /* the following type must have a width of 64-bit */ + typedef long long xxh_i64; +#endif + +/* + * XXH3_accumulate_512 is the tightest loop for long inputs, and it is the most optimized. + * + * It is a hardened version of UMAC, based off of FARSH's implementation. + * + * This was chosen because it adapts quite well to 32-bit, 64-bit, and SIMD + * implementations, and it is ridiculously fast. + * + * We harden it by mixing the original input to the accumulators as well as the product. + * + * This means that in the (relatively likely) case of a multiply by zero, the + * original input is preserved. + * + * On 128-bit inputs, we swap 64-bit pairs when we add the input to improve + * cross-pollination, as otherwise the upper and lower halves would be + * essentially independent. + * + * This doesn't matter on 64-bit hashes since they all get merged together in + * the end, so we skip the extra step. + * + * Both XXH3_64bits and XXH3_128bits use this subroutine. + */ + +#if (XXH_VECTOR == XXH_AVX512) || defined(XXH_X86DISPATCH) + +#ifndef XXH_TARGET_AVX512 +# define XXH_TARGET_AVX512 /* disable attribute target */ +#endif + +XXH_FORCE_INLINE XXH_TARGET_AVX512 void +XXH3_accumulate_512_avx512(void* XXH_RESTRICT acc, + const void* XXH_RESTRICT input, + const void* XXH_RESTRICT secret) +{ + XXH_ALIGN(64) __m512i* const xacc = (__m512i *) acc; + XXH_ASSERT((((size_t)acc) & 63) == 0); + XXH_STATIC_ASSERT(XXH_STRIPE_LEN == sizeof(__m512i)); + + { + /* data_vec = input[0]; */ + __m512i const data_vec = _mm512_loadu_si512 (input); + /* key_vec = secret[0]; */ + __m512i const key_vec = _mm512_loadu_si512 (secret); + /* data_key = data_vec ^ key_vec; */ + __m512i const data_key = _mm512_xor_si512 (data_vec, key_vec); + /* data_key_lo = data_key >> 32; */ + __m512i const data_key_lo = _mm512_shuffle_epi32 (data_key, (_MM_PERM_ENUM)_MM_SHUFFLE(0, 3, 0, 1)); + /* product = (data_key & 0xffffffff) * (data_key_lo & 0xffffffff); */ + __m512i const product = _mm512_mul_epu32 (data_key, data_key_lo); + /* xacc[0] += swap(data_vec); */ + __m512i const data_swap = _mm512_shuffle_epi32(data_vec, (_MM_PERM_ENUM)_MM_SHUFFLE(1, 0, 3, 2)); + __m512i const sum = _mm512_add_epi64(*xacc, data_swap); + /* xacc[0] += product; */ + *xacc = _mm512_add_epi64(product, sum); + } +} + +/* + * XXH3_scrambleAcc: Scrambles the accumulators to improve mixing. + * + * Multiplication isn't perfect, as explained by Google in HighwayHash: + * + * // Multiplication mixes/scrambles bytes 0-7 of the 64-bit result to + * // varying degrees. In descending order of goodness, bytes + * // 3 4 2 5 1 6 0 7 have quality 228 224 164 160 100 96 36 32. + * // As expected, the upper and lower bytes are much worse. + * + * Source: https://github.com/google/highwayhash/blob/0aaf66b/highwayhash/hh_avx2.h#L291 + * + * Since our algorithm uses a pseudorandom secret to add some variance into the + * mix, we don't need to (or want to) mix as often or as much as HighwayHash does. + * + * This isn't as tight as XXH3_accumulate, but still written in SIMD to avoid + * extraction. + * + * Both XXH3_64bits and XXH3_128bits use this subroutine. + */ + +XXH_FORCE_INLINE XXH_TARGET_AVX512 void +XXH3_scrambleAcc_avx512(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) +{ + XXH_ASSERT((((size_t)acc) & 63) == 0); + XXH_STATIC_ASSERT(XXH_STRIPE_LEN == sizeof(__m512i)); + { XXH_ALIGN(64) __m512i* const xacc = (__m512i*) acc; + const __m512i prime32 = _mm512_set1_epi32((int)XXH_PRIME32_1); + + /* xacc[0] ^= (xacc[0] >> 47) */ + __m512i const acc_vec = *xacc; + __m512i const shifted = _mm512_srli_epi64 (acc_vec, 47); + __m512i const data_vec = _mm512_xor_si512 (acc_vec, shifted); + /* xacc[0] ^= secret; */ + __m512i const key_vec = _mm512_loadu_si512 (secret); + __m512i const data_key = _mm512_xor_si512 (data_vec, key_vec); + + /* xacc[0] *= XXH_PRIME32_1; */ + __m512i const data_key_hi = _mm512_shuffle_epi32 (data_key, (_MM_PERM_ENUM)_MM_SHUFFLE(0, 3, 0, 1)); + __m512i const prod_lo = _mm512_mul_epu32 (data_key, prime32); + __m512i const prod_hi = _mm512_mul_epu32 (data_key_hi, prime32); + *xacc = _mm512_add_epi64(prod_lo, _mm512_slli_epi64(prod_hi, 32)); + } +} + +XXH_FORCE_INLINE XXH_TARGET_AVX512 void +XXH3_initCustomSecret_avx512(void* XXH_RESTRICT customSecret, xxh_u64 seed64) +{ + XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE & 63) == 0); + XXH_STATIC_ASSERT(XXH_SEC_ALIGN == 64); + XXH_ASSERT(((size_t)customSecret & 63) == 0); + (void)(&XXH_writeLE64); + { int const nbRounds = XXH_SECRET_DEFAULT_SIZE / sizeof(__m512i); + __m512i const seed = _mm512_mask_set1_epi64(_mm512_set1_epi64((xxh_i64)seed64), 0xAA, -(xxh_i64)seed64); + + XXH_ALIGN(64) const __m512i* const src = (const __m512i*) XXH3_kSecret; + XXH_ALIGN(64) __m512i* const dest = ( __m512i*) customSecret; + int i; + for (i=0; i < nbRounds; ++i) { + /* GCC has a bug, _mm512_stream_load_si512 accepts 'void*', not 'void const*', + * this will warn "discards ‘const’ qualifier". */ + union { + XXH_ALIGN(64) const __m512i* cp; + XXH_ALIGN(64) void* p; + } remote_const_void; + remote_const_void.cp = src + i; + dest[i] = _mm512_add_epi64(_mm512_stream_load_si512(remote_const_void.p), seed); + } } +} + +#endif + +#if (XXH_VECTOR == XXH_AVX2) || defined(XXH_X86DISPATCH) + +#ifndef XXH_TARGET_AVX2 +# define XXH_TARGET_AVX2 /* disable attribute target */ +#endif + +XXH_FORCE_INLINE XXH_TARGET_AVX2 void +XXH3_accumulate_512_avx2( void* XXH_RESTRICT acc, + const void* XXH_RESTRICT input, + const void* XXH_RESTRICT secret) +{ + XXH_ASSERT((((size_t)acc) & 31) == 0); + { XXH_ALIGN(32) __m256i* const xacc = (__m256i *) acc; + /* Unaligned. This is mainly for pointer arithmetic, and because + * _mm256_loadu_si256 requires a const __m256i * pointer for some reason. */ + const __m256i* const xinput = (const __m256i *) input; + /* Unaligned. This is mainly for pointer arithmetic, and because + * _mm256_loadu_si256 requires a const __m256i * pointer for some reason. */ + const __m256i* const xsecret = (const __m256i *) secret; + + size_t i; + for (i=0; i < XXH_STRIPE_LEN/sizeof(__m256i); i++) { + /* data_vec = xinput[i]; */ + __m256i const data_vec = _mm256_loadu_si256 (xinput+i); + /* key_vec = xsecret[i]; */ + __m256i const key_vec = _mm256_loadu_si256 (xsecret+i); + /* data_key = data_vec ^ key_vec; */ + __m256i const data_key = _mm256_xor_si256 (data_vec, key_vec); + /* data_key_lo = data_key >> 32; */ + __m256i const data_key_lo = _mm256_shuffle_epi32 (data_key, _MM_SHUFFLE(0, 3, 0, 1)); + /* product = (data_key & 0xffffffff) * (data_key_lo & 0xffffffff); */ + __m256i const product = _mm256_mul_epu32 (data_key, data_key_lo); + /* xacc[i] += swap(data_vec); */ + __m256i const data_swap = _mm256_shuffle_epi32(data_vec, _MM_SHUFFLE(1, 0, 3, 2)); + __m256i const sum = _mm256_add_epi64(xacc[i], data_swap); + /* xacc[i] += product; */ + xacc[i] = _mm256_add_epi64(product, sum); + } } +} + +XXH_FORCE_INLINE XXH_TARGET_AVX2 void +XXH3_scrambleAcc_avx2(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) +{ + XXH_ASSERT((((size_t)acc) & 31) == 0); + { XXH_ALIGN(32) __m256i* const xacc = (__m256i*) acc; + /* Unaligned. This is mainly for pointer arithmetic, and because + * _mm256_loadu_si256 requires a const __m256i * pointer for some reason. */ + const __m256i* const xsecret = (const __m256i *) secret; + const __m256i prime32 = _mm256_set1_epi32((int)XXH_PRIME32_1); + + size_t i; + for (i=0; i < XXH_STRIPE_LEN/sizeof(__m256i); i++) { + /* xacc[i] ^= (xacc[i] >> 47) */ + __m256i const acc_vec = xacc[i]; + __m256i const shifted = _mm256_srli_epi64 (acc_vec, 47); + __m256i const data_vec = _mm256_xor_si256 (acc_vec, shifted); + /* xacc[i] ^= xsecret; */ + __m256i const key_vec = _mm256_loadu_si256 (xsecret+i); + __m256i const data_key = _mm256_xor_si256 (data_vec, key_vec); + + /* xacc[i] *= XXH_PRIME32_1; */ + __m256i const data_key_hi = _mm256_shuffle_epi32 (data_key, _MM_SHUFFLE(0, 3, 0, 1)); + __m256i const prod_lo = _mm256_mul_epu32 (data_key, prime32); + __m256i const prod_hi = _mm256_mul_epu32 (data_key_hi, prime32); + xacc[i] = _mm256_add_epi64(prod_lo, _mm256_slli_epi64(prod_hi, 32)); + } + } +} + +XXH_FORCE_INLINE XXH_TARGET_AVX2 void XXH3_initCustomSecret_avx2(void* XXH_RESTRICT customSecret, xxh_u64 seed64) +{ + XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE & 31) == 0); + XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE / sizeof(__m256i)) == 6); + XXH_STATIC_ASSERT(XXH_SEC_ALIGN <= 64); + (void)(&XXH_writeLE64); + XXH_PREFETCH(customSecret); + { __m256i const seed = _mm256_set_epi64x(-(xxh_i64)seed64, (xxh_i64)seed64, -(xxh_i64)seed64, (xxh_i64)seed64); + + XXH_ALIGN(64) const __m256i* const src = (const __m256i*) XXH3_kSecret; + XXH_ALIGN(64) __m256i* dest = ( __m256i*) customSecret; + +# if defined(__GNUC__) || defined(__clang__) + /* + * On GCC & Clang, marking 'dest' as modified will cause the compiler: + * - do not extract the secret from sse registers in the internal loop + * - use less common registers, and avoid pushing these reg into stack + * The asm hack causes Clang to assume that XXH3_kSecretPtr aliases with + * customSecret, and on aarch64, this prevented LDP from merging two + * loads together for free. Putting the loads together before the stores + * properly generates LDP. + */ + __asm__("" : "+r" (dest)); +# endif + + /* GCC -O2 need unroll loop manually */ + dest[0] = _mm256_add_epi64(_mm256_stream_load_si256(src+0), seed); + dest[1] = _mm256_add_epi64(_mm256_stream_load_si256(src+1), seed); + dest[2] = _mm256_add_epi64(_mm256_stream_load_si256(src+2), seed); + dest[3] = _mm256_add_epi64(_mm256_stream_load_si256(src+3), seed); + dest[4] = _mm256_add_epi64(_mm256_stream_load_si256(src+4), seed); + dest[5] = _mm256_add_epi64(_mm256_stream_load_si256(src+5), seed); + } +} + +#endif + +#if (XXH_VECTOR == XXH_SSE2) || defined(XXH_X86DISPATCH) + +#ifndef XXH_TARGET_SSE2 +# define XXH_TARGET_SSE2 /* disable attribute target */ +#endif + +XXH_FORCE_INLINE XXH_TARGET_SSE2 void +XXH3_accumulate_512_sse2( void* XXH_RESTRICT acc, + const void* XXH_RESTRICT input, + const void* XXH_RESTRICT secret) +{ + /* SSE2 is just a half-scale version of the AVX2 version. */ + XXH_ASSERT((((size_t)acc) & 15) == 0); + { XXH_ALIGN(16) __m128i* const xacc = (__m128i *) acc; + /* Unaligned. This is mainly for pointer arithmetic, and because + * _mm_loadu_si128 requires a const __m128i * pointer for some reason. */ + const __m128i* const xinput = (const __m128i *) input; + /* Unaligned. This is mainly for pointer arithmetic, and because + * _mm_loadu_si128 requires a const __m128i * pointer for some reason. */ + const __m128i* const xsecret = (const __m128i *) secret; + + size_t i; + for (i=0; i < XXH_STRIPE_LEN/sizeof(__m128i); i++) { + /* data_vec = xinput[i]; */ + __m128i const data_vec = _mm_loadu_si128 (xinput+i); + /* key_vec = xsecret[i]; */ + __m128i const key_vec = _mm_loadu_si128 (xsecret+i); + /* data_key = data_vec ^ key_vec; */ + __m128i const data_key = _mm_xor_si128 (data_vec, key_vec); + /* data_key_lo = data_key >> 32; */ + __m128i const data_key_lo = _mm_shuffle_epi32 (data_key, _MM_SHUFFLE(0, 3, 0, 1)); + /* product = (data_key & 0xffffffff) * (data_key_lo & 0xffffffff); */ + __m128i const product = _mm_mul_epu32 (data_key, data_key_lo); + /* xacc[i] += swap(data_vec); */ + __m128i const data_swap = _mm_shuffle_epi32(data_vec, _MM_SHUFFLE(1,0,3,2)); + __m128i const sum = _mm_add_epi64(xacc[i], data_swap); + /* xacc[i] += product; */ + xacc[i] = _mm_add_epi64(product, sum); + } } +} + +XXH_FORCE_INLINE XXH_TARGET_SSE2 void +XXH3_scrambleAcc_sse2(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) +{ + XXH_ASSERT((((size_t)acc) & 15) == 0); + { XXH_ALIGN(16) __m128i* const xacc = (__m128i*) acc; + /* Unaligned. This is mainly for pointer arithmetic, and because + * _mm_loadu_si128 requires a const __m128i * pointer for some reason. */ + const __m128i* const xsecret = (const __m128i *) secret; + const __m128i prime32 = _mm_set1_epi32((int)XXH_PRIME32_1); + + size_t i; + for (i=0; i < XXH_STRIPE_LEN/sizeof(__m128i); i++) { + /* xacc[i] ^= (xacc[i] >> 47) */ + __m128i const acc_vec = xacc[i]; + __m128i const shifted = _mm_srli_epi64 (acc_vec, 47); + __m128i const data_vec = _mm_xor_si128 (acc_vec, shifted); + /* xacc[i] ^= xsecret[i]; */ + __m128i const key_vec = _mm_loadu_si128 (xsecret+i); + __m128i const data_key = _mm_xor_si128 (data_vec, key_vec); + + /* xacc[i] *= XXH_PRIME32_1; */ + __m128i const data_key_hi = _mm_shuffle_epi32 (data_key, _MM_SHUFFLE(0, 3, 0, 1)); + __m128i const prod_lo = _mm_mul_epu32 (data_key, prime32); + __m128i const prod_hi = _mm_mul_epu32 (data_key_hi, prime32); + xacc[i] = _mm_add_epi64(prod_lo, _mm_slli_epi64(prod_hi, 32)); + } + } +} + +XXH_FORCE_INLINE XXH_TARGET_SSE2 void XXH3_initCustomSecret_sse2(void* XXH_RESTRICT customSecret, xxh_u64 seed64) +{ + XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE & 15) == 0); + (void)(&XXH_writeLE64); + { int const nbRounds = XXH_SECRET_DEFAULT_SIZE / sizeof(__m128i); + +# if defined(_MSC_VER) && defined(_M_IX86) && _MSC_VER < 1900 + // MSVC 32bit mode does not support _mm_set_epi64x before 2015 + XXH_ALIGN(16) const xxh_i64 seed64x2[2] = { (xxh_i64)seed64, -(xxh_i64)seed64 }; + __m128i const seed = _mm_load_si128((__m128i const*)seed64x2); +# else + __m128i const seed = _mm_set_epi64x(-(xxh_i64)seed64, (xxh_i64)seed64); +# endif + int i; + + XXH_ALIGN(64) const float* const src = (float const*) XXH3_kSecret; + XXH_ALIGN(XXH_SEC_ALIGN) __m128i* dest = (__m128i*) customSecret; +# if defined(__GNUC__) || defined(__clang__) + /* + * On GCC & Clang, marking 'dest' as modified will cause the compiler: + * - do not extract the secret from sse registers in the internal loop + * - use less common registers, and avoid pushing these reg into stack + */ + __asm__("" : "+r" (dest)); +# endif + + for (i=0; i < nbRounds; ++i) { + dest[i] = _mm_add_epi64(_mm_castps_si128(_mm_load_ps(src+i*4)), seed); + } } +} + +#endif + +#if (XXH_VECTOR == XXH_NEON) + +XXH_FORCE_INLINE void +XXH3_accumulate_512_neon( void* XXH_RESTRICT acc, + const void* XXH_RESTRICT input, + const void* XXH_RESTRICT secret) +{ + XXH_ASSERT((((size_t)acc) & 15) == 0); + { + XXH_ALIGN(16) uint64x2_t* const xacc = (uint64x2_t *) acc; + /* We don't use a uint32x4_t pointer because it causes bus errors on ARMv7. */ + uint8_t const* const xinput = (const uint8_t *) input; + uint8_t const* const xsecret = (const uint8_t *) secret; + + size_t i; + for (i=0; i < XXH_STRIPE_LEN / sizeof(uint64x2_t); i++) { + /* data_vec = xinput[i]; */ + uint8x16_t data_vec = vld1q_u8(xinput + (i * 16)); + /* key_vec = xsecret[i]; */ + uint8x16_t key_vec = vld1q_u8(xsecret + (i * 16)); + uint64x2_t data_key; + uint32x2_t data_key_lo, data_key_hi; + /* xacc[i] += swap(data_vec); */ + uint64x2_t const data64 = vreinterpretq_u64_u8(data_vec); + uint64x2_t const swapped = vextq_u64(data64, data64, 1); + xacc[i] = vaddq_u64 (xacc[i], swapped); + /* data_key = data_vec ^ key_vec; */ + data_key = vreinterpretq_u64_u8(veorq_u8(data_vec, key_vec)); + /* data_key_lo = (uint32x2_t) (data_key & 0xFFFFFFFF); + * data_key_hi = (uint32x2_t) (data_key >> 32); + * data_key = UNDEFINED; */ + XXH_SPLIT_IN_PLACE(data_key, data_key_lo, data_key_hi); + /* xacc[i] += (uint64x2_t) data_key_lo * (uint64x2_t) data_key_hi; */ + xacc[i] = vmlal_u32 (xacc[i], data_key_lo, data_key_hi); + + } + } +} + +XXH_FORCE_INLINE void +XXH3_scrambleAcc_neon(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) +{ + XXH_ASSERT((((size_t)acc) & 15) == 0); + + { uint64x2_t* xacc = (uint64x2_t*) acc; + uint8_t const* xsecret = (uint8_t const*) secret; + uint32x2_t prime = vdup_n_u32 (XXH_PRIME32_1); + + size_t i; + for (i=0; i < XXH_STRIPE_LEN/sizeof(uint64x2_t); i++) { + /* xacc[i] ^= (xacc[i] >> 47); */ + uint64x2_t acc_vec = xacc[i]; + uint64x2_t shifted = vshrq_n_u64 (acc_vec, 47); + uint64x2_t data_vec = veorq_u64 (acc_vec, shifted); + + /* xacc[i] ^= xsecret[i]; */ + uint8x16_t key_vec = vld1q_u8(xsecret + (i * 16)); + uint64x2_t data_key = veorq_u64(data_vec, vreinterpretq_u64_u8(key_vec)); + + /* xacc[i] *= XXH_PRIME32_1 */ + uint32x2_t data_key_lo, data_key_hi; + /* data_key_lo = (uint32x2_t) (xacc[i] & 0xFFFFFFFF); + * data_key_hi = (uint32x2_t) (xacc[i] >> 32); + * xacc[i] = UNDEFINED; */ + XXH_SPLIT_IN_PLACE(data_key, data_key_lo, data_key_hi); + { /* + * prod_hi = (data_key >> 32) * XXH_PRIME32_1; + * + * Avoid vmul_u32 + vshll_n_u32 since Clang 6 and 7 will + * incorrectly "optimize" this: + * tmp = vmul_u32(vmovn_u64(a), vmovn_u64(b)); + * shifted = vshll_n_u32(tmp, 32); + * to this: + * tmp = "vmulq_u64"(a, b); // no such thing! + * shifted = vshlq_n_u64(tmp, 32); + * + * However, unlike SSE, Clang lacks a 64-bit multiply routine + * for NEON, and it scalarizes two 64-bit multiplies instead. + * + * vmull_u32 has the same timing as vmul_u32, and it avoids + * this bug completely. + * See https://bugs.llvm.org/show_bug.cgi?id=39967 + */ + uint64x2_t prod_hi = vmull_u32 (data_key_hi, prime); + /* xacc[i] = prod_hi << 32; */ + xacc[i] = vshlq_n_u64(prod_hi, 32); + /* xacc[i] += (prod_hi & 0xFFFFFFFF) * XXH_PRIME32_1; */ + xacc[i] = vmlal_u32(xacc[i], data_key_lo, prime); + } + } } +} + +#endif + +#if (XXH_VECTOR == XXH_VSX) + +XXH_FORCE_INLINE void +XXH3_accumulate_512_vsx( void* XXH_RESTRICT acc, + const void* XXH_RESTRICT input, + const void* XXH_RESTRICT secret) +{ + xxh_u64x2* const xacc = (xxh_u64x2*) acc; /* presumed aligned */ + xxh_u64x2 const* const xinput = (xxh_u64x2 const*) input; /* no alignment restriction */ + xxh_u64x2 const* const xsecret = (xxh_u64x2 const*) secret; /* no alignment restriction */ + xxh_u64x2 const v32 = { 32, 32 }; + size_t i; + for (i = 0; i < XXH_STRIPE_LEN / sizeof(xxh_u64x2); i++) { + /* data_vec = xinput[i]; */ + xxh_u64x2 const data_vec = XXH_vec_loadu(xinput + i); + /* key_vec = xsecret[i]; */ + xxh_u64x2 const key_vec = XXH_vec_loadu(xsecret + i); + xxh_u64x2 const data_key = data_vec ^ key_vec; + /* shuffled = (data_key << 32) | (data_key >> 32); */ + xxh_u32x4 const shuffled = (xxh_u32x4)vec_rl(data_key, v32); + /* product = ((xxh_u64x2)data_key & 0xFFFFFFFF) * ((xxh_u64x2)shuffled & 0xFFFFFFFF); */ + xxh_u64x2 const product = XXH_vec_mulo((xxh_u32x4)data_key, shuffled); + xacc[i] += product; + + /* swap high and low halves */ +#ifdef __s390x__ + xacc[i] += vec_permi(data_vec, data_vec, 2); +#else + xacc[i] += vec_xxpermdi(data_vec, data_vec, 2); +#endif + } +} + +XXH_FORCE_INLINE void +XXH3_scrambleAcc_vsx(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) +{ + XXH_ASSERT((((size_t)acc) & 15) == 0); + + { xxh_u64x2* const xacc = (xxh_u64x2*) acc; + const xxh_u64x2* const xsecret = (const xxh_u64x2*) secret; + /* constants */ + xxh_u64x2 const v32 = { 32, 32 }; + xxh_u64x2 const v47 = { 47, 47 }; + xxh_u32x4 const prime = { XXH_PRIME32_1, XXH_PRIME32_1, XXH_PRIME32_1, XXH_PRIME32_1 }; + size_t i; + for (i = 0; i < XXH_STRIPE_LEN / sizeof(xxh_u64x2); i++) { + /* xacc[i] ^= (xacc[i] >> 47); */ + xxh_u64x2 const acc_vec = xacc[i]; + xxh_u64x2 const data_vec = acc_vec ^ (acc_vec >> v47); + + /* xacc[i] ^= xsecret[i]; */ + xxh_u64x2 const key_vec = XXH_vec_loadu(xsecret + i); + xxh_u64x2 const data_key = data_vec ^ key_vec; + + /* xacc[i] *= XXH_PRIME32_1 */ + /* prod_lo = ((xxh_u64x2)data_key & 0xFFFFFFFF) * ((xxh_u64x2)prime & 0xFFFFFFFF); */ + xxh_u64x2 const prod_even = XXH_vec_mule((xxh_u32x4)data_key, prime); + /* prod_hi = ((xxh_u64x2)data_key >> 32) * ((xxh_u64x2)prime >> 32); */ + xxh_u64x2 const prod_odd = XXH_vec_mulo((xxh_u32x4)data_key, prime); + xacc[i] = prod_odd + (prod_even << v32); + } } +} + +#endif + +/* scalar variants - universal */ + +XXH_FORCE_INLINE void +XXH3_accumulate_512_scalar(void* XXH_RESTRICT acc, + const void* XXH_RESTRICT input, + const void* XXH_RESTRICT secret) +{ + XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64* const xacc = (xxh_u64*) acc; /* presumed aligned */ + const xxh_u8* const xinput = (const xxh_u8*) input; /* no alignment restriction */ + const xxh_u8* const xsecret = (const xxh_u8*) secret; /* no alignment restriction */ + size_t i; + XXH_ASSERT(((size_t)acc & (XXH_ACC_ALIGN-1)) == 0); + for (i=0; i < XXH_ACC_NB; i++) { + xxh_u64 const data_val = XXH_readLE64(xinput + 8*i); + xxh_u64 const data_key = data_val ^ XXH_readLE64(xsecret + i*8); + xacc[i ^ 1] += data_val; /* swap adjacent lanes */ + xacc[i] += XXH_mult32to64(data_key & 0xFFFFFFFF, data_key >> 32); + } +} + +XXH_FORCE_INLINE void +XXH3_scrambleAcc_scalar(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) +{ + XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64* const xacc = (xxh_u64*) acc; /* presumed aligned */ + const xxh_u8* const xsecret = (const xxh_u8*) secret; /* no alignment restriction */ + size_t i; + XXH_ASSERT((((size_t)acc) & (XXH_ACC_ALIGN-1)) == 0); + for (i=0; i < XXH_ACC_NB; i++) { + xxh_u64 const key64 = XXH_readLE64(xsecret + 8*i); + xxh_u64 acc64 = xacc[i]; + acc64 = XXH_xorshift64(acc64, 47); + acc64 ^= key64; + acc64 *= XXH_PRIME32_1; + xacc[i] = acc64; + } +} + +XXH_FORCE_INLINE void +XXH3_initCustomSecret_scalar(void* XXH_RESTRICT customSecret, xxh_u64 seed64) +{ + /* + * We need a separate pointer for the hack below, + * which requires a non-const pointer. + * Any decent compiler will optimize this out otherwise. + */ + const xxh_u8* kSecretPtr = XXH3_kSecret; + XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE & 15) == 0); + +#if defined(__clang__) && defined(__aarch64__) + /* + * UGLY HACK: + * Clang generates a bunch of MOV/MOVK pairs for aarch64, and they are + * placed sequentially, in order, at the top of the unrolled loop. + * + * While MOVK is great for generating constants (2 cycles for a 64-bit + * constant compared to 4 cycles for LDR), long MOVK chains stall the + * integer pipelines: + * I L S + * MOVK + * MOVK + * MOVK + * MOVK + * ADD + * SUB STR + * STR + * By forcing loads from memory (as the asm line causes Clang to assume + * that XXH3_kSecretPtr has been changed), the pipelines are used more + * efficiently: + * I L S + * LDR + * ADD LDR + * SUB STR + * STR + * XXH3_64bits_withSeed, len == 256, Snapdragon 835 + * without hack: 2654.4 MB/s + * with hack: 3202.9 MB/s + */ + __asm__("" : "+r" (kSecretPtr)); +#endif + /* + * Note: in debug mode, this overrides the asm optimization + * and Clang will emit MOVK chains again. + */ + XXH_ASSERT(kSecretPtr == XXH3_kSecret); + + { int const nbRounds = XXH_SECRET_DEFAULT_SIZE / 16; + int i; + for (i=0; i < nbRounds; i++) { + /* + * The asm hack causes Clang to assume that kSecretPtr aliases with + * customSecret, and on aarch64, this prevented LDP from merging two + * loads together for free. Putting the loads together before the stores + * properly generates LDP. + */ + xxh_u64 lo = XXH_readLE64(kSecretPtr + 16*i) + seed64; + xxh_u64 hi = XXH_readLE64(kSecretPtr + 16*i + 8) - seed64; + XXH_writeLE64((xxh_u8*)customSecret + 16*i, lo); + XXH_writeLE64((xxh_u8*)customSecret + 16*i + 8, hi); + } } +} + + +typedef void (*XXH3_f_accumulate_512)(void* XXH_RESTRICT, const void*, const void*); +typedef void (*XXH3_f_scrambleAcc)(void* XXH_RESTRICT, const void*); +typedef void (*XXH3_f_initCustomSecret)(void* XXH_RESTRICT, xxh_u64); + + +#if (XXH_VECTOR == XXH_AVX512) + +#define XXH3_accumulate_512 XXH3_accumulate_512_avx512 +#define XXH3_scrambleAcc XXH3_scrambleAcc_avx512 +#define XXH3_initCustomSecret XXH3_initCustomSecret_avx512 + +#elif (XXH_VECTOR == XXH_AVX2) + +#define XXH3_accumulate_512 XXH3_accumulate_512_avx2 +#define XXH3_scrambleAcc XXH3_scrambleAcc_avx2 +#define XXH3_initCustomSecret XXH3_initCustomSecret_avx2 + +#elif (XXH_VECTOR == XXH_SSE2) + +#define XXH3_accumulate_512 XXH3_accumulate_512_sse2 +#define XXH3_scrambleAcc XXH3_scrambleAcc_sse2 +#define XXH3_initCustomSecret XXH3_initCustomSecret_sse2 + +#elif (XXH_VECTOR == XXH_NEON) + +#define XXH3_accumulate_512 XXH3_accumulate_512_neon +#define XXH3_scrambleAcc XXH3_scrambleAcc_neon +#define XXH3_initCustomSecret XXH3_initCustomSecret_scalar + +#elif (XXH_VECTOR == XXH_VSX) + +#define XXH3_accumulate_512 XXH3_accumulate_512_vsx +#define XXH3_scrambleAcc XXH3_scrambleAcc_vsx +#define XXH3_initCustomSecret XXH3_initCustomSecret_scalar + +#else /* scalar */ + +#define XXH3_accumulate_512 XXH3_accumulate_512_scalar +#define XXH3_scrambleAcc XXH3_scrambleAcc_scalar +#define XXH3_initCustomSecret XXH3_initCustomSecret_scalar + +#endif + + + +#ifndef XXH_PREFETCH_DIST +# ifdef __clang__ +# define XXH_PREFETCH_DIST 320 +# else +# if (XXH_VECTOR == XXH_AVX512) +# define XXH_PREFETCH_DIST 512 +# else +# define XXH_PREFETCH_DIST 384 +# endif +# endif /* __clang__ */ +#endif /* XXH_PREFETCH_DIST */ + +/* + * XXH3_accumulate() + * Loops over XXH3_accumulate_512(). + * Assumption: nbStripes will not overflow the secret size + */ +XXH_FORCE_INLINE void +XXH3_accumulate( xxh_u64* XXH_RESTRICT acc, + const xxh_u8* XXH_RESTRICT input, + const xxh_u8* XXH_RESTRICT secret, + size_t nbStripes, + XXH3_f_accumulate_512 f_acc512) +{ + size_t n; + for (n = 0; n < nbStripes; n++ ) { + const xxh_u8* const in = input + n*XXH_STRIPE_LEN; + XXH_PREFETCH(in + XXH_PREFETCH_DIST); + f_acc512(acc, + in, + secret + n*XXH_SECRET_CONSUME_RATE); + } +} + +XXH_FORCE_INLINE void +XXH3_hashLong_internal_loop(xxh_u64* XXH_RESTRICT acc, + const xxh_u8* XXH_RESTRICT input, size_t len, + const xxh_u8* XXH_RESTRICT secret, size_t secretSize, + XXH3_f_accumulate_512 f_acc512, + XXH3_f_scrambleAcc f_scramble) +{ + size_t const nbStripesPerBlock = (secretSize - XXH_STRIPE_LEN) / XXH_SECRET_CONSUME_RATE; + size_t const block_len = XXH_STRIPE_LEN * nbStripesPerBlock; + size_t const nb_blocks = (len - 1) / block_len; + + size_t n; + + XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); + + for (n = 0; n < nb_blocks; n++) { + XXH3_accumulate(acc, input + n*block_len, secret, nbStripesPerBlock, f_acc512); + f_scramble(acc, secret + secretSize - XXH_STRIPE_LEN); + } + + /* last partial block */ + XXH_ASSERT(len > XXH_STRIPE_LEN); + { size_t const nbStripes = ((len - 1) - (block_len * nb_blocks)) / XXH_STRIPE_LEN; + XXH_ASSERT(nbStripes <= (secretSize / XXH_SECRET_CONSUME_RATE)); + XXH3_accumulate(acc, input + nb_blocks*block_len, secret, nbStripes, f_acc512); + + /* last stripe */ + { const xxh_u8* const p = input + len - XXH_STRIPE_LEN; +#define XXH_SECRET_LASTACC_START 7 /* not aligned on 8, last secret is different from acc & scrambler */ + f_acc512(acc, p, secret + secretSize - XXH_STRIPE_LEN - XXH_SECRET_LASTACC_START); + } } +} + +XXH_FORCE_INLINE xxh_u64 +XXH3_mix2Accs(const xxh_u64* XXH_RESTRICT acc, const xxh_u8* XXH_RESTRICT secret) +{ + return XXH3_mul128_fold64( + acc[0] ^ XXH_readLE64(secret), + acc[1] ^ XXH_readLE64(secret+8) ); +} + +static XXH64_hash_t +XXH3_mergeAccs(const xxh_u64* XXH_RESTRICT acc, const xxh_u8* XXH_RESTRICT secret, xxh_u64 start) +{ + xxh_u64 result64 = start; + size_t i = 0; + + for (i = 0; i < 4; i++) { + result64 += XXH3_mix2Accs(acc+2*i, secret + 16*i); +#if defined(__clang__) /* Clang */ \ + && (defined(__arm__) || defined(__thumb__)) /* ARMv7 */ \ + && (defined(__ARM_NEON) || defined(__ARM_NEON__)) /* NEON */ \ + && !defined(XXH_ENABLE_AUTOVECTORIZE) /* Define to disable */ + /* + * UGLY HACK: + * Prevent autovectorization on Clang ARMv7-a. Exact same problem as + * the one in XXH3_len_129to240_64b. Speeds up shorter keys > 240b. + * XXH3_64bits, len == 256, Snapdragon 835: + * without hack: 2063.7 MB/s + * with hack: 2560.7 MB/s + */ + __asm__("" : "+r" (result64)); +#endif + } + + return XXH3_avalanche(result64); +} + +#define XXH3_INIT_ACC { XXH_PRIME32_3, XXH_PRIME64_1, XXH_PRIME64_2, XXH_PRIME64_3, \ + XXH_PRIME64_4, XXH_PRIME32_2, XXH_PRIME64_5, XXH_PRIME32_1 } + +XXH_FORCE_INLINE XXH64_hash_t +XXH3_hashLong_64b_internal(const void* XXH_RESTRICT input, size_t len, + const void* XXH_RESTRICT secret, size_t secretSize, + XXH3_f_accumulate_512 f_acc512, + XXH3_f_scrambleAcc f_scramble) +{ + XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64 acc[XXH_ACC_NB] = XXH3_INIT_ACC; + + XXH3_hashLong_internal_loop(acc, (const xxh_u8*)input, len, (const xxh_u8*)secret, secretSize, f_acc512, f_scramble); + + /* converge into final hash */ + XXH_STATIC_ASSERT(sizeof(acc) == 64); + /* do not align on 8, so that the secret is different from the accumulator */ +#define XXH_SECRET_MERGEACCS_START 11 + XXH_ASSERT(secretSize >= sizeof(acc) + XXH_SECRET_MERGEACCS_START); + return XXH3_mergeAccs(acc, (const xxh_u8*)secret + XXH_SECRET_MERGEACCS_START, (xxh_u64)len * XXH_PRIME64_1); +} + +/* + * It's important for performance that XXH3_hashLong is not inlined. + */ +XXH_NO_INLINE XXH64_hash_t +XXH3_hashLong_64b_withSecret(const void* XXH_RESTRICT input, size_t len, + XXH64_hash_t seed64, const xxh_u8* XXH_RESTRICT secret, size_t secretLen) +{ + (void)seed64; + return XXH3_hashLong_64b_internal(input, len, secret, secretLen, XXH3_accumulate_512, XXH3_scrambleAcc); +} + +/* + * It's important for performance that XXH3_hashLong is not inlined. + * Since the function is not inlined, the compiler may not be able to understand that, + * in some scenarios, its `secret` argument is actually a compile time constant. + * This variant enforces that the compiler can detect that, + * and uses this opportunity to streamline the generated code for better performance. + */ +XXH_NO_INLINE XXH64_hash_t +XXH3_hashLong_64b_default(const void* XXH_RESTRICT input, size_t len, + XXH64_hash_t seed64, const xxh_u8* XXH_RESTRICT secret, size_t secretLen) +{ + (void)seed64; (void)secret; (void)secretLen; + return XXH3_hashLong_64b_internal(input, len, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_accumulate_512, XXH3_scrambleAcc); +} + +/* + * XXH3_hashLong_64b_withSeed(): + * Generate a custom key based on alteration of default XXH3_kSecret with the seed, + * and then use this key for long mode hashing. + * + * This operation is decently fast but nonetheless costs a little bit of time. + * Try to avoid it whenever possible (typically when seed==0). + * + * It's important for performance that XXH3_hashLong is not inlined. Not sure + * why (uop cache maybe?), but the difference is large and easily measurable. + */ +XXH_FORCE_INLINE XXH64_hash_t +XXH3_hashLong_64b_withSeed_internal(const void* input, size_t len, + XXH64_hash_t seed, + XXH3_f_accumulate_512 f_acc512, + XXH3_f_scrambleAcc f_scramble, + XXH3_f_initCustomSecret f_initSec) +{ + if (seed == 0) + return XXH3_hashLong_64b_internal(input, len, + XXH3_kSecret, sizeof(XXH3_kSecret), + f_acc512, f_scramble); + { XXH_ALIGN(XXH_SEC_ALIGN) xxh_u8 secret[XXH_SECRET_DEFAULT_SIZE]; + f_initSec(secret, seed); + return XXH3_hashLong_64b_internal(input, len, secret, sizeof(secret), + f_acc512, f_scramble); + } +} + +/* + * It's important for performance that XXH3_hashLong is not inlined. + */ +XXH_NO_INLINE XXH64_hash_t +XXH3_hashLong_64b_withSeed(const void* input, size_t len, + XXH64_hash_t seed, const xxh_u8* secret, size_t secretLen) +{ + (void)secret; (void)secretLen; + return XXH3_hashLong_64b_withSeed_internal(input, len, seed, + XXH3_accumulate_512, XXH3_scrambleAcc, XXH3_initCustomSecret); +} + + +typedef XXH64_hash_t (*XXH3_hashLong64_f)(const void* XXH_RESTRICT, size_t, + XXH64_hash_t, const xxh_u8* XXH_RESTRICT, size_t); + +XXH_FORCE_INLINE XXH64_hash_t +XXH3_64bits_internal(const void* XXH_RESTRICT input, size_t len, + XXH64_hash_t seed64, const void* XXH_RESTRICT secret, size_t secretLen, + XXH3_hashLong64_f f_hashLong) +{ + XXH_ASSERT(secretLen >= XXH3_SECRET_SIZE_MIN); + /* + * If an action is to be taken if `secretLen` condition is not respected, + * it should be done here. + * For now, it's a contract pre-condition. + * Adding a check and a branch here would cost performance at every hash. + * Also, note that function signature doesn't offer room to return an error. + */ + if (len <= 16) + return XXH3_len_0to16_64b((const xxh_u8*)input, len, (const xxh_u8*)secret, seed64); + if (len <= 128) + return XXH3_len_17to128_64b((const xxh_u8*)input, len, (const xxh_u8*)secret, secretLen, seed64); + if (len <= XXH3_MIDSIZE_MAX) + return XXH3_len_129to240_64b((const xxh_u8*)input, len, (const xxh_u8*)secret, secretLen, seed64); + return f_hashLong(input, len, seed64, (const xxh_u8*)secret, secretLen); +} + + +/* === Public entry point === */ + +XXH_PUBLIC_API XXH64_hash_t XXH3_64bits(const void* input, size_t len) +{ + return XXH3_64bits_internal(input, len, 0, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_64b_default); +} + +XXH_PUBLIC_API XXH64_hash_t +XXH3_64bits_withSecret(const void* input, size_t len, const void* secret, size_t secretSize) +{ + return XXH3_64bits_internal(input, len, 0, secret, secretSize, XXH3_hashLong_64b_withSecret); +} + +XXH_PUBLIC_API XXH64_hash_t +XXH3_64bits_withSeed(const void* input, size_t len, XXH64_hash_t seed) +{ + return XXH3_64bits_internal(input, len, seed, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_64b_withSeed); +} + + +/* === XXH3 streaming === */ + +/* + * Malloc's a pointer that is always aligned to align. + * + * This must be freed with `XXH_alignedFree()`. + * + * malloc typically guarantees 16 byte alignment on 64-bit systems and 8 byte + * alignment on 32-bit. This isn't enough for the 32 byte aligned loads in AVX2 + * or on 32-bit, the 16 byte aligned loads in SSE2 and NEON. + * + * This underalignment previously caused a rather obvious crash which went + * completely unnoticed due to XXH3_createState() not actually being tested. + * Credit to RedSpah for noticing this bug. + * + * The alignment is done manually: Functions like posix_memalign or _mm_malloc + * are avoided: To maintain portability, we would have to write a fallback + * like this anyways, and besides, testing for the existence of library + * functions without relying on external build tools is impossible. + * + * The method is simple: Overallocate, manually align, and store the offset + * to the original behind the returned pointer. + * + * Align must be a power of 2 and 8 <= align <= 128. + */ +static void* XXH_alignedMalloc(size_t s, size_t align) +{ + XXH_ASSERT(align <= 128 && align >= 8); /* range check */ + XXH_ASSERT((align & (align-1)) == 0); /* power of 2 */ + XXH_ASSERT(s != 0 && s < (s + align)); /* empty/overflow */ + { /* Overallocate to make room for manual realignment and an offset byte */ + xxh_u8* base = (xxh_u8*)XXH_malloc(s + align); + if (base != NULL) { + /* + * Get the offset needed to align this pointer. + * + * Even if the returned pointer is aligned, there will always be + * at least one byte to store the offset to the original pointer. + */ + size_t offset = align - ((size_t)base & (align - 1)); /* base % align */ + /* Add the offset for the now-aligned pointer */ + xxh_u8* ptr = base + offset; + + XXH_ASSERT((size_t)ptr % align == 0); + + /* Store the offset immediately before the returned pointer. */ + ptr[-1] = (xxh_u8)offset; + return ptr; + } + return NULL; + } +} +/* + * Frees an aligned pointer allocated by XXH_alignedMalloc(). Don't pass + * normal malloc'd pointers, XXH_alignedMalloc has a specific data layout. + */ +static void XXH_alignedFree(void* p) +{ + if (p != NULL) { + xxh_u8* ptr = (xxh_u8*)p; + /* Get the offset byte we added in XXH_malloc. */ + xxh_u8 offset = ptr[-1]; + /* Free the original malloc'd pointer */ + xxh_u8* base = ptr - offset; + XXH_free(base); + } +} +XXH_PUBLIC_API XXH3_state_t* XXH3_createState(void) +{ + XXH3_state_t* const state = (XXH3_state_t*)XXH_alignedMalloc(sizeof(XXH3_state_t), 64); + if (state==NULL) return NULL; + XXH3_INITSTATE(state); + return state; +} + +XXH_PUBLIC_API XXH_errorcode XXH3_freeState(XXH3_state_t* statePtr) +{ + XXH_alignedFree(statePtr); + return XXH_OK; +} + +XXH_PUBLIC_API void +XXH3_copyState(XXH3_state_t* dst_state, const XXH3_state_t* src_state) +{ + memcpy(dst_state, src_state, sizeof(*dst_state)); +} + +static void +XXH3_64bits_reset_internal(XXH3_state_t* statePtr, + XXH64_hash_t seed, + const void* secret, size_t secretSize) +{ + size_t const initStart = offsetof(XXH3_state_t, bufferedSize); + size_t const initLength = offsetof(XXH3_state_t, nbStripesPerBlock) - initStart; + XXH_ASSERT(offsetof(XXH3_state_t, nbStripesPerBlock) > initStart); + XXH_ASSERT(statePtr != NULL); + /* set members from bufferedSize to nbStripesPerBlock (excluded) to 0 */ + memset((char*)statePtr + initStart, 0, initLength); + statePtr->acc[0] = XXH_PRIME32_3; + statePtr->acc[1] = XXH_PRIME64_1; + statePtr->acc[2] = XXH_PRIME64_2; + statePtr->acc[3] = XXH_PRIME64_3; + statePtr->acc[4] = XXH_PRIME64_4; + statePtr->acc[5] = XXH_PRIME32_2; + statePtr->acc[6] = XXH_PRIME64_5; + statePtr->acc[7] = XXH_PRIME32_1; + statePtr->seed = seed; + statePtr->extSecret = (const unsigned char*)secret; + XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); + statePtr->secretLimit = secretSize - XXH_STRIPE_LEN; + statePtr->nbStripesPerBlock = statePtr->secretLimit / XXH_SECRET_CONSUME_RATE; +} + +XXH_PUBLIC_API XXH_errorcode +XXH3_64bits_reset(XXH3_state_t* statePtr) +{ + if (statePtr == NULL) return XXH_ERROR; + XXH3_64bits_reset_internal(statePtr, 0, XXH3_kSecret, XXH_SECRET_DEFAULT_SIZE); + return XXH_OK; +} + +XXH_PUBLIC_API XXH_errorcode +XXH3_64bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t secretSize) +{ + if (statePtr == NULL) return XXH_ERROR; + XXH3_64bits_reset_internal(statePtr, 0, secret, secretSize); + if (secret == NULL) return XXH_ERROR; + if (secretSize < XXH3_SECRET_SIZE_MIN) return XXH_ERROR; + return XXH_OK; +} + +XXH_PUBLIC_API XXH_errorcode +XXH3_64bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed) +{ + if (statePtr == NULL) return XXH_ERROR; + if (seed==0) return XXH3_64bits_reset(statePtr); + if (seed != statePtr->seed) XXH3_initCustomSecret(statePtr->customSecret, seed); + XXH3_64bits_reset_internal(statePtr, seed, NULL, XXH_SECRET_DEFAULT_SIZE); + return XXH_OK; +} + +/* Note : when XXH3_consumeStripes() is invoked, + * there must be a guarantee that at least one more byte must be consumed from input + * so that the function can blindly consume all stripes using the "normal" secret segment */ +XXH_FORCE_INLINE void +XXH3_consumeStripes(xxh_u64* XXH_RESTRICT acc, + size_t* XXH_RESTRICT nbStripesSoFarPtr, size_t nbStripesPerBlock, + const xxh_u8* XXH_RESTRICT input, size_t nbStripes, + const xxh_u8* XXH_RESTRICT secret, size_t secretLimit, + XXH3_f_accumulate_512 f_acc512, + XXH3_f_scrambleAcc f_scramble) +{ + XXH_ASSERT(nbStripes <= nbStripesPerBlock); /* can handle max 1 scramble per invocation */ + XXH_ASSERT(*nbStripesSoFarPtr < nbStripesPerBlock); + if (nbStripesPerBlock - *nbStripesSoFarPtr <= nbStripes) { + /* need a scrambling operation */ + size_t const nbStripesToEndofBlock = nbStripesPerBlock - *nbStripesSoFarPtr; + size_t const nbStripesAfterBlock = nbStripes - nbStripesToEndofBlock; + XXH3_accumulate(acc, input, secret + nbStripesSoFarPtr[0] * XXH_SECRET_CONSUME_RATE, nbStripesToEndofBlock, f_acc512); + f_scramble(acc, secret + secretLimit); + XXH3_accumulate(acc, input + nbStripesToEndofBlock * XXH_STRIPE_LEN, secret, nbStripesAfterBlock, f_acc512); + *nbStripesSoFarPtr = nbStripesAfterBlock; + } else { + XXH3_accumulate(acc, input, secret + nbStripesSoFarPtr[0] * XXH_SECRET_CONSUME_RATE, nbStripes, f_acc512); + *nbStripesSoFarPtr += nbStripes; + } +} + +/* + * Both XXH3_64bits_update and XXH3_128bits_update use this routine. + */ +XXH_FORCE_INLINE XXH_errorcode +XXH3_update(XXH3_state_t* state, + const xxh_u8* input, size_t len, + XXH3_f_accumulate_512 f_acc512, + XXH3_f_scrambleAcc f_scramble) +{ + if (input==NULL) +#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) && (XXH_ACCEPT_NULL_INPUT_POINTER>=1) + return XXH_OK; +#else + return XXH_ERROR; +#endif + + { const xxh_u8* const bEnd = input + len; + const unsigned char* const secret = (state->extSecret == NULL) ? state->customSecret : state->extSecret; + + state->totalLen += len; + + if (state->bufferedSize + len <= XXH3_INTERNALBUFFER_SIZE) { /* fill in tmp buffer */ + XXH_memcpy(state->buffer + state->bufferedSize, input, len); + state->bufferedSize += (XXH32_hash_t)len; + return XXH_OK; + } + /* total input is now > XXH3_INTERNALBUFFER_SIZE */ + + #define XXH3_INTERNALBUFFER_STRIPES (XXH3_INTERNALBUFFER_SIZE / XXH_STRIPE_LEN) + XXH_STATIC_ASSERT(XXH3_INTERNALBUFFER_SIZE % XXH_STRIPE_LEN == 0); /* clean multiple */ + + /* + * Internal buffer is partially filled (always, except at beginning) + * Complete it, then consume it. + */ + if (state->bufferedSize) { + size_t const loadSize = XXH3_INTERNALBUFFER_SIZE - state->bufferedSize; + XXH_memcpy(state->buffer + state->bufferedSize, input, loadSize); + input += loadSize; + XXH3_consumeStripes(state->acc, + &state->nbStripesSoFar, state->nbStripesPerBlock, + state->buffer, XXH3_INTERNALBUFFER_STRIPES, + secret, state->secretLimit, + f_acc512, f_scramble); + state->bufferedSize = 0; + } + XXH_ASSERT(input < bEnd); + + /* Consume input by a multiple of internal buffer size */ + if (input+XXH3_INTERNALBUFFER_SIZE < bEnd) { + const xxh_u8* const limit = bEnd - XXH3_INTERNALBUFFER_SIZE; + do { + XXH3_consumeStripes(state->acc, + &state->nbStripesSoFar, state->nbStripesPerBlock, + input, XXH3_INTERNALBUFFER_STRIPES, + secret, state->secretLimit, + f_acc512, f_scramble); + input += XXH3_INTERNALBUFFER_SIZE; + } while (input<limit); + /* for last partial stripe */ + memcpy(state->buffer + sizeof(state->buffer) - XXH_STRIPE_LEN, input - XXH_STRIPE_LEN, XXH_STRIPE_LEN); + } + XXH_ASSERT(input < bEnd); + + /* Some remaining input (always) : buffer it */ + XXH_memcpy(state->buffer, input, (size_t)(bEnd-input)); + state->bufferedSize = (XXH32_hash_t)(bEnd-input); + } + + return XXH_OK; +} + +XXH_PUBLIC_API XXH_errorcode +XXH3_64bits_update(XXH3_state_t* state, const void* input, size_t len) +{ + return XXH3_update(state, (const xxh_u8*)input, len, + XXH3_accumulate_512, XXH3_scrambleAcc); +} + + +XXH_FORCE_INLINE void +XXH3_digest_long (XXH64_hash_t* acc, + const XXH3_state_t* state, + const unsigned char* secret) +{ + /* + * Digest on a local copy. This way, the state remains unaltered, and it can + * continue ingesting more input afterwards. + */ + memcpy(acc, state->acc, sizeof(state->acc)); + if (state->bufferedSize >= XXH_STRIPE_LEN) { + size_t const nbStripes = (state->bufferedSize - 1) / XXH_STRIPE_LEN; + size_t nbStripesSoFar = state->nbStripesSoFar; + XXH3_consumeStripes(acc, + &nbStripesSoFar, state->nbStripesPerBlock, + state->buffer, nbStripes, + secret, state->secretLimit, + XXH3_accumulate_512, XXH3_scrambleAcc); + /* last stripe */ + XXH3_accumulate_512(acc, + state->buffer + state->bufferedSize - XXH_STRIPE_LEN, + secret + state->secretLimit - XXH_SECRET_LASTACC_START); + } else { /* bufferedSize < XXH_STRIPE_LEN */ + xxh_u8 lastStripe[XXH_STRIPE_LEN]; + size_t const catchupSize = XXH_STRIPE_LEN - state->bufferedSize; + XXH_ASSERT(state->bufferedSize > 0); /* there is always some input buffered */ + memcpy(lastStripe, state->buffer + sizeof(state->buffer) - catchupSize, catchupSize); + memcpy(lastStripe + catchupSize, state->buffer, state->bufferedSize); + XXH3_accumulate_512(acc, + lastStripe, + secret + state->secretLimit - XXH_SECRET_LASTACC_START); + } +} + +XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_digest (const XXH3_state_t* state) +{ + const unsigned char* const secret = (state->extSecret == NULL) ? state->customSecret : state->extSecret; + if (state->totalLen > XXH3_MIDSIZE_MAX) { + XXH_ALIGN(XXH_ACC_ALIGN) XXH64_hash_t acc[XXH_ACC_NB]; + XXH3_digest_long(acc, state, secret); + return XXH3_mergeAccs(acc, + secret + XXH_SECRET_MERGEACCS_START, + (xxh_u64)state->totalLen * XXH_PRIME64_1); + } + /* totalLen <= XXH3_MIDSIZE_MAX: digesting a short input */ + if (state->seed) + return XXH3_64bits_withSeed(state->buffer, (size_t)state->totalLen, state->seed); + return XXH3_64bits_withSecret(state->buffer, (size_t)(state->totalLen), + secret, state->secretLimit + XXH_STRIPE_LEN); +} + + +#define XXH_MIN(x, y) (((x) > (y)) ? (y) : (x)) + +XXH_PUBLIC_API void +XXH3_generateSecret(void* secretBuffer, const void* customSeed, size_t customSeedSize) +{ + XXH_ASSERT(secretBuffer != NULL); + if (customSeedSize == 0) { + memcpy(secretBuffer, XXH3_kSecret, XXH_SECRET_DEFAULT_SIZE); + return; + } + XXH_ASSERT(customSeed != NULL); + + { size_t const segmentSize = sizeof(XXH128_hash_t); + size_t const nbSegments = XXH_SECRET_DEFAULT_SIZE / segmentSize; + XXH128_canonical_t scrambler; + XXH64_hash_t seeds[12]; + size_t segnb; + XXH_ASSERT(nbSegments == 12); + XXH_ASSERT(segmentSize * nbSegments == XXH_SECRET_DEFAULT_SIZE); /* exact multiple */ + XXH128_canonicalFromHash(&scrambler, XXH128(customSeed, customSeedSize, 0)); + + /* + * Copy customSeed to seeds[], truncating or repeating as necessary. + */ + { size_t toFill = XXH_MIN(customSeedSize, sizeof(seeds)); + size_t filled = toFill; + memcpy(seeds, customSeed, toFill); + while (filled < sizeof(seeds)) { + toFill = XXH_MIN(filled, sizeof(seeds) - filled); + memcpy((char*)seeds + filled, seeds, toFill); + filled += toFill; + } } + + /* generate secret */ + memcpy(secretBuffer, &scrambler, sizeof(scrambler)); + for (segnb=1; segnb < nbSegments; segnb++) { + size_t const segmentStart = segnb * segmentSize; + XXH128_canonical_t segment; + XXH128_canonicalFromHash(&segment, + XXH128(&scrambler, sizeof(scrambler), XXH_readLE64(seeds + segnb) + segnb) ); + memcpy((char*)secretBuffer + segmentStart, &segment, sizeof(segment)); + } } +} + + +/* ========================================== + * XXH3 128 bits (a.k.a XXH128) + * ========================================== + * XXH3's 128-bit variant has better mixing and strength than the 64-bit variant, + * even without counting the significantly larger output size. + * + * For example, extra steps are taken to avoid the seed-dependent collisions + * in 17-240 byte inputs (See XXH3_mix16B and XXH128_mix32B). + * + * This strength naturally comes at the cost of some speed, especially on short + * lengths. Note that longer hashes are about as fast as the 64-bit version + * due to it using only a slight modification of the 64-bit loop. + * + * XXH128 is also more oriented towards 64-bit machines. It is still extremely + * fast for a _128-bit_ hash on 32-bit (it usually clears XXH64). + */ + +XXH_FORCE_INLINE XXH128_hash_t +XXH3_len_1to3_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) +{ + /* A doubled version of 1to3_64b with different constants. */ + XXH_ASSERT(input != NULL); + XXH_ASSERT(1 <= len && len <= 3); + XXH_ASSERT(secret != NULL); + /* + * len = 1: combinedl = { input[0], 0x01, input[0], input[0] } + * len = 2: combinedl = { input[1], 0x02, input[0], input[1] } + * len = 3: combinedl = { input[2], 0x03, input[0], input[1] } + */ + { xxh_u8 const c1 = input[0]; + xxh_u8 const c2 = input[len >> 1]; + xxh_u8 const c3 = input[len - 1]; + xxh_u32 const combinedl = ((xxh_u32)c1 <<16) | ((xxh_u32)c2 << 24) + | ((xxh_u32)c3 << 0) | ((xxh_u32)len << 8); + xxh_u32 const combinedh = XXH_rotl32(XXH_swap32(combinedl), 13); + xxh_u64 const bitflipl = (XXH_readLE32(secret) ^ XXH_readLE32(secret+4)) + seed; + xxh_u64 const bitfliph = (XXH_readLE32(secret+8) ^ XXH_readLE32(secret+12)) - seed; + xxh_u64 const keyed_lo = (xxh_u64)combinedl ^ bitflipl; + xxh_u64 const keyed_hi = (xxh_u64)combinedh ^ bitfliph; + XXH128_hash_t h128; + h128.low64 = XXH64_avalanche(keyed_lo); + h128.high64 = XXH64_avalanche(keyed_hi); + return h128; + } +} + +XXH_FORCE_INLINE XXH128_hash_t +XXH3_len_4to8_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) +{ + XXH_ASSERT(input != NULL); + XXH_ASSERT(secret != NULL); + XXH_ASSERT(4 <= len && len <= 8); + seed ^= (xxh_u64)XXH_swap32((xxh_u32)seed) << 32; + { xxh_u32 const input_lo = XXH_readLE32(input); + xxh_u32 const input_hi = XXH_readLE32(input + len - 4); + xxh_u64 const input_64 = input_lo + ((xxh_u64)input_hi << 32); + xxh_u64 const bitflip = (XXH_readLE64(secret+16) ^ XXH_readLE64(secret+24)) + seed; + xxh_u64 const keyed = input_64 ^ bitflip; + + /* Shift len to the left to ensure it is even, this avoids even multiplies. */ + XXH128_hash_t m128 = XXH_mult64to128(keyed, XXH_PRIME64_1 + (len << 2)); + + m128.high64 += (m128.low64 << 1); + m128.low64 ^= (m128.high64 >> 3); + + m128.low64 = XXH_xorshift64(m128.low64, 35); + m128.low64 *= 0x9FB21C651E98DF25ULL; + m128.low64 = XXH_xorshift64(m128.low64, 28); + m128.high64 = XXH3_avalanche(m128.high64); + return m128; + } +} + +XXH_FORCE_INLINE XXH128_hash_t +XXH3_len_9to16_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) +{ + XXH_ASSERT(input != NULL); + XXH_ASSERT(secret != NULL); + XXH_ASSERT(9 <= len && len <= 16); + { xxh_u64 const bitflipl = (XXH_readLE64(secret+32) ^ XXH_readLE64(secret+40)) - seed; + xxh_u64 const bitfliph = (XXH_readLE64(secret+48) ^ XXH_readLE64(secret+56)) + seed; + xxh_u64 const input_lo = XXH_readLE64(input); + xxh_u64 input_hi = XXH_readLE64(input + len - 8); + XXH128_hash_t m128 = XXH_mult64to128(input_lo ^ input_hi ^ bitflipl, XXH_PRIME64_1); + /* + * Put len in the middle of m128 to ensure that the length gets mixed to + * both the low and high bits in the 128x64 multiply below. + */ + m128.low64 += (xxh_u64)(len - 1) << 54; + input_hi ^= bitfliph; + /* + * Add the high 32 bits of input_hi to the high 32 bits of m128, then + * add the long product of the low 32 bits of input_hi and XXH_PRIME32_2 to + * the high 64 bits of m128. + * + * The best approach to this operation is different on 32-bit and 64-bit. + */ + if (sizeof(void *) < sizeof(xxh_u64)) { /* 32-bit */ + /* + * 32-bit optimized version, which is more readable. + * + * On 32-bit, it removes an ADC and delays a dependency between the two + * halves of m128.high64, but it generates an extra mask on 64-bit. + */ + m128.high64 += (input_hi & 0xFFFFFFFF00000000ULL) + XXH_mult32to64((xxh_u32)input_hi, XXH_PRIME32_2); + } else { + /* + * 64-bit optimized (albeit more confusing) version. + * + * Uses some properties of addition and multiplication to remove the mask: + * + * Let: + * a = input_hi.lo = (input_hi & 0x00000000FFFFFFFF) + * b = input_hi.hi = (input_hi & 0xFFFFFFFF00000000) + * c = XXH_PRIME32_2 + * + * a + (b * c) + * Inverse Property: x + y - x == y + * a + (b * (1 + c - 1)) + * Distributive Property: x * (y + z) == (x * y) + (x * z) + * a + (b * 1) + (b * (c - 1)) + * Identity Property: x * 1 == x + * a + b + (b * (c - 1)) + * + * Substitute a, b, and c: + * input_hi.hi + input_hi.lo + ((xxh_u64)input_hi.lo * (XXH_PRIME32_2 - 1)) + * + * Since input_hi.hi + input_hi.lo == input_hi, we get this: + * input_hi + ((xxh_u64)input_hi.lo * (XXH_PRIME32_2 - 1)) + */ + m128.high64 += input_hi + XXH_mult32to64((xxh_u32)input_hi, XXH_PRIME32_2 - 1); + } + /* m128 ^= XXH_swap64(m128 >> 64); */ + m128.low64 ^= XXH_swap64(m128.high64); + + { /* 128x64 multiply: h128 = m128 * XXH_PRIME64_2; */ + XXH128_hash_t h128 = XXH_mult64to128(m128.low64, XXH_PRIME64_2); + h128.high64 += m128.high64 * XXH_PRIME64_2; + + h128.low64 = XXH3_avalanche(h128.low64); + h128.high64 = XXH3_avalanche(h128.high64); + return h128; + } } +} + +/* + * Assumption: `secret` size is >= XXH3_SECRET_SIZE_MIN + */ +XXH_FORCE_INLINE XXH128_hash_t +XXH3_len_0to16_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) +{ + XXH_ASSERT(len <= 16); + { if (len > 8) return XXH3_len_9to16_128b(input, len, secret, seed); + if (len >= 4) return XXH3_len_4to8_128b(input, len, secret, seed); + if (len) return XXH3_len_1to3_128b(input, len, secret, seed); + { XXH128_hash_t h128; + xxh_u64 const bitflipl = XXH_readLE64(secret+64) ^ XXH_readLE64(secret+72); + xxh_u64 const bitfliph = XXH_readLE64(secret+80) ^ XXH_readLE64(secret+88); + h128.low64 = XXH64_avalanche(seed ^ bitflipl); + h128.high64 = XXH64_avalanche( seed ^ bitfliph); + return h128; + } } +} + +/* + * A bit slower than XXH3_mix16B, but handles multiply by zero better. + */ +XXH_FORCE_INLINE XXH128_hash_t +XXH128_mix32B(XXH128_hash_t acc, const xxh_u8* input_1, const xxh_u8* input_2, + const xxh_u8* secret, XXH64_hash_t seed) +{ + acc.low64 += XXH3_mix16B (input_1, secret+0, seed); + acc.low64 ^= XXH_readLE64(input_2) + XXH_readLE64(input_2 + 8); + acc.high64 += XXH3_mix16B (input_2, secret+16, seed); + acc.high64 ^= XXH_readLE64(input_1) + XXH_readLE64(input_1 + 8); + return acc; +} + + +XXH_FORCE_INLINE XXH128_hash_t +XXH3_len_17to128_128b(const xxh_u8* XXH_RESTRICT input, size_t len, + const xxh_u8* XXH_RESTRICT secret, size_t secretSize, + XXH64_hash_t seed) +{ + XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); (void)secretSize; + XXH_ASSERT(16 < len && len <= 128); + + { XXH128_hash_t acc; + acc.low64 = len * XXH_PRIME64_1; + acc.high64 = 0; + if (len > 32) { + if (len > 64) { + if (len > 96) { + acc = XXH128_mix32B(acc, input+48, input+len-64, secret+96, seed); + } + acc = XXH128_mix32B(acc, input+32, input+len-48, secret+64, seed); + } + acc = XXH128_mix32B(acc, input+16, input+len-32, secret+32, seed); + } + acc = XXH128_mix32B(acc, input, input+len-16, secret, seed); + { XXH128_hash_t h128; + h128.low64 = acc.low64 + acc.high64; + h128.high64 = (acc.low64 * XXH_PRIME64_1) + + (acc.high64 * XXH_PRIME64_4) + + ((len - seed) * XXH_PRIME64_2); + h128.low64 = XXH3_avalanche(h128.low64); + h128.high64 = (XXH64_hash_t)0 - XXH3_avalanche(h128.high64); + return h128; + } + } +} + +XXH_NO_INLINE XXH128_hash_t +XXH3_len_129to240_128b(const xxh_u8* XXH_RESTRICT input, size_t len, + const xxh_u8* XXH_RESTRICT secret, size_t secretSize, + XXH64_hash_t seed) +{ + XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); (void)secretSize; + XXH_ASSERT(128 < len && len <= XXH3_MIDSIZE_MAX); + + { XXH128_hash_t acc; + int const nbRounds = (int)len / 32; + int i; + acc.low64 = len * XXH_PRIME64_1; + acc.high64 = 0; + for (i=0; i<4; i++) { + acc = XXH128_mix32B(acc, + input + (32 * i), + input + (32 * i) + 16, + secret + (32 * i), + seed); + } + acc.low64 = XXH3_avalanche(acc.low64); + acc.high64 = XXH3_avalanche(acc.high64); + XXH_ASSERT(nbRounds >= 4); + for (i=4 ; i < nbRounds; i++) { + acc = XXH128_mix32B(acc, + input + (32 * i), + input + (32 * i) + 16, + secret + XXH3_MIDSIZE_STARTOFFSET + (32 * (i - 4)), + seed); + } + /* last bytes */ + acc = XXH128_mix32B(acc, + input + len - 16, + input + len - 32, + secret + XXH3_SECRET_SIZE_MIN - XXH3_MIDSIZE_LASTOFFSET - 16, + 0ULL - seed); + + { XXH128_hash_t h128; + h128.low64 = acc.low64 + acc.high64; + h128.high64 = (acc.low64 * XXH_PRIME64_1) + + (acc.high64 * XXH_PRIME64_4) + + ((len - seed) * XXH_PRIME64_2); + h128.low64 = XXH3_avalanche(h128.low64); + h128.high64 = (XXH64_hash_t)0 - XXH3_avalanche(h128.high64); + return h128; + } + } +} + +XXH_FORCE_INLINE XXH128_hash_t +XXH3_hashLong_128b_internal(const void* XXH_RESTRICT input, size_t len, + const xxh_u8* XXH_RESTRICT secret, size_t secretSize, + XXH3_f_accumulate_512 f_acc512, + XXH3_f_scrambleAcc f_scramble) +{ + XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64 acc[XXH_ACC_NB] = XXH3_INIT_ACC; + + XXH3_hashLong_internal_loop(acc, (const xxh_u8*)input, len, secret, secretSize, f_acc512, f_scramble); + + /* converge into final hash */ + XXH_STATIC_ASSERT(sizeof(acc) == 64); + XXH_ASSERT(secretSize >= sizeof(acc) + XXH_SECRET_MERGEACCS_START); + { XXH128_hash_t h128; + h128.low64 = XXH3_mergeAccs(acc, + secret + XXH_SECRET_MERGEACCS_START, + (xxh_u64)len * XXH_PRIME64_1); + h128.high64 = XXH3_mergeAccs(acc, + secret + secretSize + - sizeof(acc) - XXH_SECRET_MERGEACCS_START, + ~((xxh_u64)len * XXH_PRIME64_2)); + return h128; + } +} + +/* + * It's important for performance that XXH3_hashLong is not inlined. + */ +XXH_NO_INLINE XXH128_hash_t +XXH3_hashLong_128b_default(const void* XXH_RESTRICT input, size_t len, + XXH64_hash_t seed64, + const void* XXH_RESTRICT secret, size_t secretLen) +{ + (void)seed64; (void)secret; (void)secretLen; + return XXH3_hashLong_128b_internal(input, len, XXH3_kSecret, sizeof(XXH3_kSecret), + XXH3_accumulate_512, XXH3_scrambleAcc); +} + +/* + * It's important for performance that XXH3_hashLong is not inlined. + */ +XXH_NO_INLINE XXH128_hash_t +XXH3_hashLong_128b_withSecret(const void* XXH_RESTRICT input, size_t len, + XXH64_hash_t seed64, + const void* XXH_RESTRICT secret, size_t secretLen) +{ + (void)seed64; + return XXH3_hashLong_128b_internal(input, len, (const xxh_u8*)secret, secretLen, + XXH3_accumulate_512, XXH3_scrambleAcc); +} + +XXH_FORCE_INLINE XXH128_hash_t +XXH3_hashLong_128b_withSeed_internal(const void* XXH_RESTRICT input, size_t len, + XXH64_hash_t seed64, + XXH3_f_accumulate_512 f_acc512, + XXH3_f_scrambleAcc f_scramble, + XXH3_f_initCustomSecret f_initSec) +{ + if (seed64 == 0) + return XXH3_hashLong_128b_internal(input, len, + XXH3_kSecret, sizeof(XXH3_kSecret), + f_acc512, f_scramble); + { XXH_ALIGN(XXH_SEC_ALIGN) xxh_u8 secret[XXH_SECRET_DEFAULT_SIZE]; + f_initSec(secret, seed64); + return XXH3_hashLong_128b_internal(input, len, (const xxh_u8*)secret, sizeof(secret), + f_acc512, f_scramble); + } +} + +/* + * It's important for performance that XXH3_hashLong is not inlined. + */ +XXH_NO_INLINE XXH128_hash_t +XXH3_hashLong_128b_withSeed(const void* input, size_t len, + XXH64_hash_t seed64, const void* XXH_RESTRICT secret, size_t secretLen) +{ + (void)secret; (void)secretLen; + return XXH3_hashLong_128b_withSeed_internal(input, len, seed64, + XXH3_accumulate_512, XXH3_scrambleAcc, XXH3_initCustomSecret); +} + +typedef XXH128_hash_t (*XXH3_hashLong128_f)(const void* XXH_RESTRICT, size_t, + XXH64_hash_t, const void* XXH_RESTRICT, size_t); + +XXH_FORCE_INLINE XXH128_hash_t +XXH3_128bits_internal(const void* input, size_t len, + XXH64_hash_t seed64, const void* XXH_RESTRICT secret, size_t secretLen, + XXH3_hashLong128_f f_hl128) +{ + XXH_ASSERT(secretLen >= XXH3_SECRET_SIZE_MIN); + /* + * If an action is to be taken if `secret` conditions are not respected, + * it should be done here. + * For now, it's a contract pre-condition. + * Adding a check and a branch here would cost performance at every hash. + */ + if (len <= 16) + return XXH3_len_0to16_128b((const xxh_u8*)input, len, (const xxh_u8*)secret, seed64); + if (len <= 128) + return XXH3_len_17to128_128b((const xxh_u8*)input, len, (const xxh_u8*)secret, secretLen, seed64); + if (len <= XXH3_MIDSIZE_MAX) + return XXH3_len_129to240_128b((const xxh_u8*)input, len, (const xxh_u8*)secret, secretLen, seed64); + return f_hl128(input, len, seed64, secret, secretLen); +} + + +/* === Public XXH128 API === */ + +XXH_PUBLIC_API XXH128_hash_t XXH3_128bits(const void* input, size_t len) +{ + return XXH3_128bits_internal(input, len, 0, + XXH3_kSecret, sizeof(XXH3_kSecret), + XXH3_hashLong_128b_default); +} + +XXH_PUBLIC_API XXH128_hash_t +XXH3_128bits_withSecret(const void* input, size_t len, const void* secret, size_t secretSize) +{ + return XXH3_128bits_internal(input, len, 0, + (const xxh_u8*)secret, secretSize, + XXH3_hashLong_128b_withSecret); +} + +XXH_PUBLIC_API XXH128_hash_t +XXH3_128bits_withSeed(const void* input, size_t len, XXH64_hash_t seed) +{ + return XXH3_128bits_internal(input, len, seed, + XXH3_kSecret, sizeof(XXH3_kSecret), + XXH3_hashLong_128b_withSeed); +} + +XXH_PUBLIC_API XXH128_hash_t +XXH128(const void* input, size_t len, XXH64_hash_t seed) +{ + return XXH3_128bits_withSeed(input, len, seed); +} + + +/* === XXH3 128-bit streaming === */ + +/* + * All the functions are actually the same as for 64-bit streaming variant. + * The only difference is the finalizatiom routine. + */ + +static void +XXH3_128bits_reset_internal(XXH3_state_t* statePtr, + XXH64_hash_t seed, + const void* secret, size_t secretSize) +{ + XXH3_64bits_reset_internal(statePtr, seed, secret, secretSize); +} + +XXH_PUBLIC_API XXH_errorcode +XXH3_128bits_reset(XXH3_state_t* statePtr) +{ + if (statePtr == NULL) return XXH_ERROR; + XXH3_128bits_reset_internal(statePtr, 0, XXH3_kSecret, XXH_SECRET_DEFAULT_SIZE); + return XXH_OK; +} + +XXH_PUBLIC_API XXH_errorcode +XXH3_128bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t secretSize) +{ + if (statePtr == NULL) return XXH_ERROR; + XXH3_128bits_reset_internal(statePtr, 0, secret, secretSize); + if (secret == NULL) return XXH_ERROR; + if (secretSize < XXH3_SECRET_SIZE_MIN) return XXH_ERROR; + return XXH_OK; +} + +XXH_PUBLIC_API XXH_errorcode +XXH3_128bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed) +{ + if (statePtr == NULL) return XXH_ERROR; + if (seed==0) return XXH3_128bits_reset(statePtr); + if (seed != statePtr->seed) XXH3_initCustomSecret(statePtr->customSecret, seed); + XXH3_128bits_reset_internal(statePtr, seed, NULL, XXH_SECRET_DEFAULT_SIZE); + return XXH_OK; +} + +XXH_PUBLIC_API XXH_errorcode +XXH3_128bits_update(XXH3_state_t* state, const void* input, size_t len) +{ + return XXH3_update(state, (const xxh_u8*)input, len, + XXH3_accumulate_512, XXH3_scrambleAcc); +} + +XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_digest (const XXH3_state_t* state) +{ + const unsigned char* const secret = (state->extSecret == NULL) ? state->customSecret : state->extSecret; + if (state->totalLen > XXH3_MIDSIZE_MAX) { + XXH_ALIGN(XXH_ACC_ALIGN) XXH64_hash_t acc[XXH_ACC_NB]; + XXH3_digest_long(acc, state, secret); + XXH_ASSERT(state->secretLimit + XXH_STRIPE_LEN >= sizeof(acc) + XXH_SECRET_MERGEACCS_START); + { XXH128_hash_t h128; + h128.low64 = XXH3_mergeAccs(acc, + secret + XXH_SECRET_MERGEACCS_START, + (xxh_u64)state->totalLen * XXH_PRIME64_1); + h128.high64 = XXH3_mergeAccs(acc, + secret + state->secretLimit + XXH_STRIPE_LEN + - sizeof(acc) - XXH_SECRET_MERGEACCS_START, + ~((xxh_u64)state->totalLen * XXH_PRIME64_2)); + return h128; + } + } + /* len <= XXH3_MIDSIZE_MAX : short code */ + if (state->seed) + return XXH3_128bits_withSeed(state->buffer, (size_t)state->totalLen, state->seed); + return XXH3_128bits_withSecret(state->buffer, (size_t)(state->totalLen), + secret, state->secretLimit + XXH_STRIPE_LEN); +} + +/* 128-bit utility functions */ + +#include <string.h> /* memcmp, memcpy */ + +/* return : 1 is equal, 0 if different */ +XXH_PUBLIC_API int XXH128_isEqual(XXH128_hash_t h1, XXH128_hash_t h2) +{ + /* note : XXH128_hash_t is compact, it has no padding byte */ + return !(memcmp(&h1, &h2, sizeof(h1))); +} + +/* This prototype is compatible with stdlib's qsort(). + * return : >0 if *h128_1 > *h128_2 + * <0 if *h128_1 < *h128_2 + * =0 if *h128_1 == *h128_2 */ +XXH_PUBLIC_API int XXH128_cmp(const void* h128_1, const void* h128_2) +{ + XXH128_hash_t const h1 = *(const XXH128_hash_t*)h128_1; + XXH128_hash_t const h2 = *(const XXH128_hash_t*)h128_2; + int const hcmp = (h1.high64 > h2.high64) - (h2.high64 > h1.high64); + /* note : bets that, in most cases, hash values are different */ + if (hcmp) return hcmp; + return (h1.low64 > h2.low64) - (h2.low64 > h1.low64); +} + + +/*====== Canonical representation ======*/ +XXH_PUBLIC_API void +XXH128_canonicalFromHash(XXH128_canonical_t* dst, XXH128_hash_t hash) +{ + XXH_STATIC_ASSERT(sizeof(XXH128_canonical_t) == sizeof(XXH128_hash_t)); + if (XXH_CPU_LITTLE_ENDIAN) { + hash.high64 = XXH_swap64(hash.high64); + hash.low64 = XXH_swap64(hash.low64); + } + memcpy(dst, &hash.high64, sizeof(hash.high64)); + memcpy((char*)dst + sizeof(hash.high64), &hash.low64, sizeof(hash.low64)); +} + +XXH_PUBLIC_API XXH128_hash_t +XXH128_hashFromCanonical(const XXH128_canonical_t* src) +{ + XXH128_hash_t h; + h.high64 = XXH_readBE64(src); + h.low64 = XXH_readBE64(src->digest + 8); + return h; +} + +/* Pop our optimization override from above */ +#if XXH_VECTOR == XXH_AVX2 /* AVX2 */ \ + && defined(__GNUC__) && !defined(__clang__) /* GCC, not Clang */ \ + && defined(__OPTIMIZE__) && !defined(__OPTIMIZE_SIZE__) /* respect -O0 and -Os */ +# pragma GCC pop_options +#endif + +#endif /* XXH_NO_LONG_LONG */ + + +#endif /* XXH_IMPLEMENTATION */ + + +#if defined (__cplusplus) +} +#endif diff --git a/tools/msys/mingw32/lib/cmake/xxHash/xxHashConfig.cmake b/tools/msys/mingw32/lib/cmake/xxHash/xxHashConfig.cmake new file mode 100644 index 0000000000000000000000000000000000000000..10d8f61ff712674e0babfc3c78f9cd7800a5fd90 --- /dev/null +++ b/tools/msys/mingw32/lib/cmake/xxHash/xxHashConfig.cmake @@ -0,0 +1,28 @@ + +####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() ####### +####### Any changes to this file will be overwritten by the next CMake run #### +####### The input file was xxHashConfig.cmake.in ######## + +get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE) + +macro(set_and_check _var _file) + set(${_var} "${_file}") + if(NOT EXISTS "${_file}") + message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") + endif() +endmacro() + +macro(check_required_components _NAME) + foreach(comp ${${_NAME}_FIND_COMPONENTS}) + if(NOT ${_NAME}_${comp}_FOUND) + if(${_NAME}_FIND_REQUIRED_${comp}) + set(${_NAME}_FOUND FALSE) + endif() + endif() + endforeach() +endmacro() + +#################################################################################### + +include(${CMAKE_CURRENT_LIST_DIR}/xxHashTargets.cmake) + diff --git a/tools/msys/mingw32/lib/cmake/xxHash/xxHashConfigVersion.cmake b/tools/msys/mingw32/lib/cmake/xxHash/xxHashConfigVersion.cmake new file mode 100644 index 0000000000000000000000000000000000000000..e1b2267114fae793d5d72392070ce4d218283da8 --- /dev/null +++ b/tools/msys/mingw32/lib/cmake/xxHash/xxHashConfigVersion.cmake @@ -0,0 +1,37 @@ +# This is a basic version file for the Config-mode of find_package(). +# It is used by write_basic_package_version_file() as input file for configure_file() +# to create a version-file which can be installed along a config.cmake file. +# +# The created file sets PACKAGE_VERSION_EXACT if the current version string and +# the requested version string are exactly the same and it sets +# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version. +# The variable CVF_VERSION must be set before calling configure_file(). + +set(PACKAGE_VERSION "0.8.0") + +if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() + + +# if the installed project requested no architecture check, don't perform the check +if("FALSE") + return() +endif() + +# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: +if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "4" STREQUAL "") + return() +endif() + +# check that the installed version has the same 32/64bit-ness as the one which is currently searching: +if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "4") + math(EXPR installedBits "4 * 8") + set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") + set(PACKAGE_VERSION_UNSUITABLE TRUE) +endif() diff --git a/tools/msys/mingw32/lib/cmake/xxHash/xxHashTargets-release.cmake b/tools/msys/mingw32/lib/cmake/xxHash/xxHashTargets-release.cmake new file mode 100644 index 0000000000000000000000000000000000000000..89f548fa633eee73d40525a1360bc2543eed55ef --- /dev/null +++ b/tools/msys/mingw32/lib/cmake/xxHash/xxHashTargets-release.cmake @@ -0,0 +1,28 @@ +#---------------------------------------------------------------- +# Generated CMake target import file for configuration "Release". +#---------------------------------------------------------------- + +# Commands may need to know the format version. +set(CMAKE_IMPORT_FILE_VERSION 1) + +# Import target "xxHash::xxhash" for configuration "Release" +set_property(TARGET xxHash::xxhash APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +set_target_properties(xxHash::xxhash PROPERTIES + IMPORTED_IMPLIB_RELEASE "${_IMPORT_PREFIX}/lib/libxxhash.dll.a" + IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/libxxhash.dll" + ) + +list(APPEND _IMPORT_CHECK_TARGETS xxHash::xxhash ) +list(APPEND _IMPORT_CHECK_FILES_FOR_xxHash::xxhash "${_IMPORT_PREFIX}/lib/libxxhash.dll.a" "${_IMPORT_PREFIX}/bin/libxxhash.dll" ) + +# Import target "xxHash::xxhsum" for configuration "Release" +set_property(TARGET xxHash::xxhsum APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +set_target_properties(xxHash::xxhsum PROPERTIES + IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/xxhsum.exe" + ) + +list(APPEND _IMPORT_CHECK_TARGETS xxHash::xxhsum ) +list(APPEND _IMPORT_CHECK_FILES_FOR_xxHash::xxhsum "${_IMPORT_PREFIX}/bin/xxhsum.exe" ) + +# Commands beyond this point should not need to know the version. +set(CMAKE_IMPORT_FILE_VERSION) diff --git a/tools/msys/mingw32/lib/cmake/xxHash/xxHashTargets.cmake b/tools/msys/mingw32/lib/cmake/xxHash/xxHashTargets.cmake new file mode 100644 index 0000000000000000000000000000000000000000..b164fbacc2c57d3085c9295c55054d75fde48928 --- /dev/null +++ b/tools/msys/mingw32/lib/cmake/xxHash/xxHashTargets.cmake @@ -0,0 +1,98 @@ +# Generated by CMake + +if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5) + message(FATAL_ERROR "CMake >= 2.6.0 required") +endif() +cmake_policy(PUSH) +cmake_policy(VERSION 2.6...3.17) +#---------------------------------------------------------------- +# Generated CMake target import file. +#---------------------------------------------------------------- + +# Commands may need to know the format version. +set(CMAKE_IMPORT_FILE_VERSION 1) + +# Protect against multiple inclusion, which would fail when already imported targets are added once more. +set(_targetsDefined) +set(_targetsNotDefined) +set(_expectedTargets) +foreach(_expectedTarget xxHash::xxhash xxHash::xxhsum) + list(APPEND _expectedTargets ${_expectedTarget}) + if(NOT TARGET ${_expectedTarget}) + list(APPEND _targetsNotDefined ${_expectedTarget}) + endif() + if(TARGET ${_expectedTarget}) + list(APPEND _targetsDefined ${_expectedTarget}) + endif() +endforeach() +if("${_targetsDefined}" STREQUAL "${_expectedTargets}") + unset(_targetsDefined) + unset(_targetsNotDefined) + unset(_expectedTargets) + set(CMAKE_IMPORT_FILE_VERSION) + cmake_policy(POP) + return() +endif() +if(NOT "${_targetsDefined}" STREQUAL "") + message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n") +endif() +unset(_targetsDefined) +unset(_targetsNotDefined) +unset(_expectedTargets) + + +# Compute the installation prefix relative to this file. +get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +if(_IMPORT_PREFIX STREQUAL "/") + set(_IMPORT_PREFIX "") +endif() + +# Create imported target xxHash::xxhash +add_library(xxHash::xxhash SHARED IMPORTED) + +set_target_properties(xxHash::xxhash PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "XXH_EXPORT" + INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include/" +) + +# Create imported target xxHash::xxhsum +add_executable(xxHash::xxhsum IMPORTED) + +# Load information for each installed configuration. +get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +file(GLOB CONFIG_FILES "${_DIR}/xxHashTargets-*.cmake") +foreach(f ${CONFIG_FILES}) + include(${f}) +endforeach() + +# Cleanup temporary variables. +set(_IMPORT_PREFIX) + +# Loop over all imported files and verify that they actually exist +foreach(target ${_IMPORT_CHECK_TARGETS} ) + foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} ) + if(NOT EXISTS "${file}" ) + message(FATAL_ERROR "The imported target \"${target}\" references the file + \"${file}\" +but this file does not exist. Possible reasons include: +* The file was deleted, renamed, or moved to another location. +* An install or uninstall procedure did not complete successfully. +* The installation package was faulty and contained + \"${CMAKE_CURRENT_LIST_FILE}\" +but not all the files it references. +") + endif() + endforeach() + unset(_IMPORT_CHECK_FILES_FOR_${target}) +endforeach() +unset(_IMPORT_CHECK_TARGETS) + +# This file does not depend on other imported targets which have +# been exported from the same project but in a separate export set. + +# Commands beyond this point should not need to know the version. +set(CMAKE_IMPORT_FILE_VERSION) +cmake_policy(POP) diff --git a/tools/msys/mingw32/lib/libxxhash.dll.a b/tools/msys/mingw32/lib/libxxhash.dll.a new file mode 100644 index 0000000000000000000000000000000000000000..002a05ecb1defc6832964d74cb7a3812fc1d7145 Binary files /dev/null and b/tools/msys/mingw32/lib/libxxhash.dll.a differ diff --git a/tools/msys/mingw32/share/gdb/python/gdb/FrameDecorator.py b/tools/msys/mingw32/share/gdb/python/gdb/FrameDecorator.py new file mode 100644 index 0000000000000000000000000000000000000000..8d75d96cc8d842b6a12d03bb410b74e3b8abfce3 --- /dev/null +++ b/tools/msys/mingw32/share/gdb/python/gdb/FrameDecorator.py @@ -0,0 +1,302 @@ +# Copyright (C) 2013-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import gdb + +# This small code snippet deals with problem of strings in Python 2.x +# and Python 3.x. Python 2.x has str and unicode classes which are +# sub-classes of basestring. In Python 3.x all strings are encoded +# and basestring has been removed. +try: + basestring +except NameError: + basestring = str + +class FrameDecorator(object): + """Basic implementation of a Frame Decorator""" + + """ This base frame decorator decorates a frame or another frame + decorator, and provides convenience methods. If this object is + wrapping a frame decorator, defer to that wrapped object's method + if it has one. This allows for frame decorators that have + sub-classed FrameDecorator object, but also wrap other frame + decorators on the same frame to correctly execute. + + E.g + + If the result of frame filters running means we have one gdb.Frame + wrapped by multiple frame decorators, all sub-classed from + FrameDecorator, the resulting hierarchy will be: + + Decorator1 + -- (wraps) Decorator2 + -- (wraps) FrameDecorator + -- (wraps) gdb.Frame + + In this case we have two frame decorators, both of which are + sub-classed from FrameDecorator. If Decorator1 just overrides the + 'function' method, then all of the other methods are carried out + by the super-class FrameDecorator. But Decorator2 may have + overriden other methods, so FrameDecorator will look at the + 'base' parameter and defer to that class's methods. And so on, + down the chain.""" + + # 'base' can refer to a gdb.Frame or another frame decorator. In + # the latter case, the child class will have called the super + # method and _base will be an object conforming to the Frame Filter + # class. + def __init__(self, base): + self._base = base + + @staticmethod + def _is_limited_frame(frame): + """Internal utility to determine if the frame is special or + limited.""" + sal = frame.find_sal() + + if (not sal.symtab or not sal.symtab.filename + or frame.type() == gdb.DUMMY_FRAME + or frame.type() == gdb.SIGTRAMP_FRAME): + + return True + + return False + + def elided(self): + """Return any elided frames that this class might be + wrapping, or None.""" + if hasattr(self._base, "elided"): + return self._base.elided() + + return None + + def function(self): + """ Return the name of the frame's function or an address of + the function of the frame. First determine if this is a + special frame. If not, try to determine filename from GDB's + frame internal function API. Finally, if a name cannot be + determined return the address. If this function returns an + address, GDB will attempt to determine the function name from + its internal minimal symbols store (for example, for inferiors + without debug-info).""" + + # Both gdb.Frame, and FrameDecorator have a method called + # "function", so determine which object this is. + if not isinstance(self._base, gdb.Frame): + if hasattr(self._base, "function"): + # If it is not a gdb.Frame, and there is already a + # "function" method, use that. + return self._base.function() + + frame = self.inferior_frame() + + if frame.type() == gdb.DUMMY_FRAME: + return "<function called from gdb>" + elif frame.type() == gdb.SIGTRAMP_FRAME: + return "<signal handler called>" + + func = frame.function() + + # If we cannot determine the function name, return the + # address. If GDB detects an integer value from this function + # it will attempt to find the function name from minimal + # symbols via its own internal functions. + if func == None: + pc = frame.pc() + return pc + + return str(func) + + def address(self): + """ Return the address of the frame's pc""" + + if hasattr(self._base, "address"): + return self._base.address() + + frame = self.inferior_frame() + return frame.pc() + + def filename(self): + """ Return the filename associated with this frame, detecting + and returning the appropriate library name is this is a shared + library.""" + + if hasattr(self._base, "filename"): + return self._base.filename() + + frame = self.inferior_frame() + sal = frame.find_sal() + if not sal.symtab or not sal.symtab.filename: + pc = frame.pc() + return gdb.solib_name(pc) + else: + return sal.symtab.filename + + def frame_args(self): + """ Return an iterable of frame arguments for this frame, if + any. The iterable object contains objects conforming with the + Symbol/Value interface. If there are no frame arguments, or + if this frame is deemed to be a special case, return None.""" + + if hasattr(self._base, "frame_args"): + return self._base.frame_args() + + frame = self.inferior_frame() + if self._is_limited_frame(frame): + return None + + args = FrameVars(frame) + return args.fetch_frame_args() + + def frame_locals(self): + """ Return an iterable of local variables for this frame, if + any. The iterable object contains objects conforming with the + Symbol/Value interface. If there are no frame locals, or if + this frame is deemed to be a special case, return None.""" + + if hasattr(self._base, "frame_locals"): + return self._base.frame_locals() + + frame = self.inferior_frame() + if self._is_limited_frame(frame): + return None + + args = FrameVars(frame) + return args.fetch_frame_locals() + + def line(self): + """ Return line number information associated with the frame's + pc. If symbol table/line information does not exist, or if + this frame is deemed to be a special case, return None""" + + if hasattr(self._base, "line"): + return self._base.line() + + frame = self.inferior_frame() + if self._is_limited_frame(frame): + return None + + sal = frame.find_sal() + if (sal): + return sal.line + else: + return None + + def inferior_frame(self): + """ Return the gdb.Frame underpinning this frame decorator.""" + + # If 'base' is a frame decorator, we want to call its inferior + # frame method. If '_base' is a gdb.Frame, just return that. + if hasattr(self._base, "inferior_frame"): + return self._base.inferior_frame() + return self._base + +class SymValueWrapper(object): + """A container class conforming to the Symbol/Value interface + which holds frame locals or frame arguments.""" + def __init__(self, symbol, value): + self.sym = symbol + self.val = value + + def value(self): + """ Return the value associated with this symbol, or None""" + return self.val + + def symbol(self): + """ Return the symbol, or Python text, associated with this + symbol, or None""" + return self.sym + +class FrameVars(object): + + """Utility class to fetch and store frame local variables, or + frame arguments.""" + + def __init__(self, frame): + self.frame = frame + self.symbol_class = { + gdb.SYMBOL_LOC_STATIC: True, + gdb.SYMBOL_LOC_REGISTER: True, + gdb.SYMBOL_LOC_ARG: True, + gdb.SYMBOL_LOC_REF_ARG: True, + gdb.SYMBOL_LOC_LOCAL: True, + gdb.SYMBOL_LOC_REGPARM_ADDR: True, + gdb.SYMBOL_LOC_COMPUTED: True + } + + def fetch_b(self, sym): + """ Local utility method to determine if according to Symbol + type whether it should be included in the iterator. Not all + symbols are fetched, and only symbols that return + True from this method should be fetched.""" + + # SYM may be a string instead of a symbol in the case of + # synthetic local arguments or locals. If that is the case, + # always fetch. + if isinstance(sym, basestring): + return True + + sym_type = sym.addr_class + + return self.symbol_class.get(sym_type, False) + + def fetch_frame_locals(self): + """Public utility method to fetch frame local variables for + the stored frame. Frame arguments are not fetched. If there + are no frame local variables, return an empty list.""" + lvars = [] + + try: + block = self.frame.block() + except RuntimeError: + block = None + + while block != None: + if block.is_global or block.is_static: + break + for sym in block: + if sym.is_argument: + continue; + if self.fetch_b(sym): + lvars.append(SymValueWrapper(sym, None)) + + block = block.superblock + + return lvars + + def fetch_frame_args(self): + """Public utility method to fetch frame arguments for the + stored frame. Frame arguments are the only type fetched. If + there are no frame argument variables, return an empty list.""" + + args = [] + + try: + block = self.frame.block() + except RuntimeError: + block = None + + while block != None: + if block.function != None: + break + block = block.superblock + + if block != None: + for sym in block: + if not sym.is_argument: + continue; + args.append(SymValueWrapper(sym, None)) + + return args diff --git a/tools/msys/mingw32/share/gdb/python/gdb/FrameIterator.py b/tools/msys/mingw32/share/gdb/python/gdb/FrameIterator.py new file mode 100644 index 0000000000000000000000000000000000000000..9ff21c829931a57e33e9cb9c9b55a84e6abc6fcc --- /dev/null +++ b/tools/msys/mingw32/share/gdb/python/gdb/FrameIterator.py @@ -0,0 +1,51 @@ +# Copyright (C) 2013-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import gdb +import itertools + +class FrameIterator(object): + """A gdb.Frame iterator. Iterates over gdb.Frames or objects that + conform to that interface.""" + + def __init__(self, frame_obj): + """Initialize a FrameIterator. + + Arguments: + frame_obj the starting frame.""" + + super(FrameIterator, self).__init__() + self.frame = frame_obj + + def __iter__(self): + return self + + def next(self): + """next implementation. + + Returns: + The next oldest frame.""" + + result = self.frame + if result is None: + raise StopIteration + self.frame = result.older() + return result + + # Python 3.x requires __next__(self) while Python 2.x requires + # next(self). Define next(self), and for Python 3.x create this + # wrapper. + def __next__(self): + return self.next() diff --git a/tools/msys/mingw32/share/gdb/python/gdb/__init__.py b/tools/msys/mingw32/share/gdb/python/gdb/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..09d43b2a8aba1e9d0d49408036ab426a65d9e162 --- /dev/null +++ b/tools/msys/mingw32/share/gdb/python/gdb/__init__.py @@ -0,0 +1,212 @@ +# Copyright (C) 2010-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import traceback +import os +import sys +import _gdb + +if sys.version_info[0] > 2: + # Python 3 moved "reload" + from imp import reload + +from _gdb import * + +class _GdbFile (object): + # These two are needed in Python 3 + encoding = "UTF-8" + errors = "strict" + + def close(self): + # Do nothing. + return None + + def isatty(self): + return False + + def writelines(self, iterable): + for line in iterable: + self.write(line) + + def flush(self): + flush() + +class _GdbOutputFile (_GdbFile): + def write(self, s): + write(s, stream=STDOUT) + +sys.stdout = _GdbOutputFile() + +class _GdbOutputErrorFile (_GdbFile): + def write(self, s): + write(s, stream=STDERR) + +sys.stderr = _GdbOutputErrorFile() + +# Default prompt hook does nothing. +prompt_hook = None + +# Ensure that sys.argv is set to something. +# We do not use PySys_SetArgvEx because it did not appear until 2.6.6. +sys.argv = [''] + +# Initial pretty printers. +pretty_printers = [] + +# Initial type printers. +type_printers = [] +# Initial xmethod matchers. +xmethods = [] +# Initial frame filters. +frame_filters = {} +# Initial frame unwinders. +frame_unwinders = [] + +def _execute_unwinders(pending_frame): + """Internal function called from GDB to execute all unwinders. + + Runs each currently enabled unwinder until it finds the one that + can unwind given frame. + + Arguments: + pending_frame: gdb.PendingFrame instance. + Returns: + gdb.UnwindInfo instance or None. + """ + for objfile in objfiles(): + for unwinder in objfile.frame_unwinders: + if unwinder.enabled: + unwind_info = unwinder(pending_frame) + if unwind_info is not None: + return unwind_info + + for unwinder in current_progspace().frame_unwinders: + if unwinder.enabled: + unwind_info = unwinder(pending_frame) + if unwind_info is not None: + return unwind_info + + for unwinder in frame_unwinders: + if unwinder.enabled: + unwind_info = unwinder(pending_frame) + if unwind_info is not None: + return unwind_info + + return None + +def _execute_file(filepath): + """This function is used to replace Python 2's PyRun_SimpleFile. + + Loads and executes the given file. + + We could use the runpy module, but its documentation says: + "Furthermore, any functions and classes defined by the executed code are + not guaranteed to work correctly after a runpy function has returned." + """ + globals = sys.modules['__main__'].__dict__ + set_file = False + # Set file (if not set) so that the imported file can use it (e.g. to + # access file-relative paths). This matches what PyRun_SimpleFile does. + if not hasattr(globals, '__file__'): + globals['__file__'] = filepath + set_file = True + try: + with open(filepath, 'rb') as file: + # We pass globals also as locals to match what Python does + # in PyRun_SimpleFile. + compiled = compile(file.read(), filepath, 'exec') + exec(compiled, globals, globals) + finally: + if set_file: + del globals['__file__'] + + +# Convenience variable to GDB's python directory +PYTHONDIR = os.path.dirname(os.path.dirname(__file__)) + +# Auto-load all functions/commands. + +# Packages to auto-load. + +packages = [ + 'function', + 'command', + 'printer' +] + +# pkgutil.iter_modules is not available prior to Python 2.6. Instead, +# manually iterate the list, collating the Python files in each module +# path. Construct the module name, and import. + +def _auto_load_packages(): + for package in packages: + location = os.path.join(os.path.dirname(__file__), package) + if os.path.exists(location): + py_files = filter(lambda x: x.endswith('.py') + and x != '__init__.py', + os.listdir(location)) + + for py_file in py_files: + # Construct from foo.py, gdb.module.foo + modname = "%s.%s.%s" % ( __name__, package, py_file[:-3] ) + try: + if modname in sys.modules: + # reload modules with duplicate names + reload(__import__(modname)) + else: + __import__(modname) + except: + sys.stderr.write (traceback.format_exc() + "\n") + +_auto_load_packages() + +def GdbSetPythonDirectory(dir): + """Update sys.path, reload gdb and auto-load packages.""" + global PYTHONDIR + + try: + sys.path.remove(PYTHONDIR) + except ValueError: + pass + sys.path.insert(0, dir) + + PYTHONDIR = dir + + # note that reload overwrites the gdb module without deleting existing + # attributes + reload(__import__(__name__)) + _auto_load_packages() + +def current_progspace(): + "Return the current Progspace." + return selected_inferior().progspace + +def objfiles(): + "Return a sequence of the current program space's objfiles." + return current_progspace().objfiles() + +def solib_name (addr): + """solib_name (Long) -> String.\n\ +Return the name of the shared library holding a given address, or None.""" + return current_progspace().solib_name(addr) + +def block_for_pc(pc): + "Return the block containing the given pc value, or None." + return current_progspace().block_for_pc(pc) + +def find_pc_line(pc): + """find_pc_line (pc) -> Symtab_and_line. +Return the gdb.Symtab_and_line object corresponding to the pc value.""" + return current_progspace().find_pc_line(pc) diff --git a/tools/msys/mingw32/share/gdb/python/gdb/command/__init__.py b/tools/msys/mingw32/share/gdb/python/gdb/command/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..03488303439cb22f9c613d321365fadd51ec24e7 --- /dev/null +++ b/tools/msys/mingw32/share/gdb/python/gdb/command/__init__.py @@ -0,0 +1,16 @@ +# Copyright (C) 2010-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + diff --git a/tools/msys/mingw32/share/gdb/python/gdb/command/explore.py b/tools/msys/mingw32/share/gdb/python/gdb/command/explore.py new file mode 100644 index 0000000000000000000000000000000000000000..c3fd6d287314598d6b38facc3d09d87b7dca957a --- /dev/null +++ b/tools/msys/mingw32/share/gdb/python/gdb/command/explore.py @@ -0,0 +1,750 @@ +# GDB 'explore' command. +# Copyright (C) 2012-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""Implementation of the GDB 'explore' command using the GDB Python API.""" + +import gdb +import sys + +if sys.version_info[0] > 2: + # Python 3 renamed raw_input to input + raw_input = input + +class Explorer(object): + """Internal class which invokes other explorers.""" + + # This map is filled by the Explorer.init_env() function + type_code_to_explorer_map = { } + + _SCALAR_TYPE_LIST = ( + gdb.TYPE_CODE_CHAR, + gdb.TYPE_CODE_INT, + gdb.TYPE_CODE_BOOL, + gdb.TYPE_CODE_FLT, + gdb.TYPE_CODE_VOID, + gdb.TYPE_CODE_ENUM, + ) + + @staticmethod + def guard_expr(expr): + length = len(expr) + guard = False + + if expr[0] == '(' and expr[length-1] == ')': + pass + else: + i = 0 + while i < length: + c = expr[i] + if (c == '_' or ('a' <= c and c <= 'z') or + ('A' <= c and c <= 'Z') or ('0' <= c and c <= '9')): + pass + else: + guard = True + break + i += 1 + + if guard: + return "(" + expr + ")" + else: + return expr + + @staticmethod + def explore_expr(expr, value, is_child): + """Main function to explore an expression value. + + Arguments: + expr: The expression string that is being explored. + value: The gdb.Value value of the expression. + is_child: Boolean value to indicate if the expression is a child. + An expression is a child if it is derived from the main + expression entered by the user. For example, if the user + entered an expression which evaluates to a struct, then + when exploring the fields of the struct, is_child is set + to True internally. + + Returns: + No return value. + """ + type_code = value.type.code + if type_code in Explorer.type_code_to_explorer_map: + explorer_class = Explorer.type_code_to_explorer_map[type_code] + while explorer_class.explore_expr(expr, value, is_child): + pass + else: + print ("Explorer for type '%s' not yet available.\n" % + str(value.type)) + + @staticmethod + def explore_type(name, datatype, is_child): + """Main function to explore a data type. + + Arguments: + name: The string representing the path to the data type being + explored. + datatype: The gdb.Type value of the data type being explored. + is_child: Boolean value to indicate if the name is a child. + A name is a child if it is derived from the main name + entered by the user. For example, if the user entered + the name of struct type, then when exploring the fields + of the struct, is_child is set to True internally. + + Returns: + No return value. + """ + type_code = datatype.code + if type_code in Explorer.type_code_to_explorer_map: + explorer_class = Explorer.type_code_to_explorer_map[type_code] + while explorer_class.explore_type(name, datatype, is_child): + pass + else: + print ("Explorer for type '%s' not yet available.\n" % + str(datatype)) + + @staticmethod + def init_env(): + """Initializes the Explorer environment. + This function should be invoked before starting any exploration. If + invoked before an exploration, it need not be invoked for subsequent + explorations. + """ + Explorer.type_code_to_explorer_map = { + gdb.TYPE_CODE_CHAR : ScalarExplorer, + gdb.TYPE_CODE_INT : ScalarExplorer, + gdb.TYPE_CODE_BOOL : ScalarExplorer, + gdb.TYPE_CODE_FLT : ScalarExplorer, + gdb.TYPE_CODE_VOID : ScalarExplorer, + gdb.TYPE_CODE_ENUM : ScalarExplorer, + gdb.TYPE_CODE_STRUCT : CompoundExplorer, + gdb.TYPE_CODE_UNION : CompoundExplorer, + gdb.TYPE_CODE_PTR : PointerExplorer, + gdb.TYPE_CODE_REF : ReferenceExplorer, + gdb.TYPE_CODE_RVALUE_REF : ReferenceExplorer, + gdb.TYPE_CODE_TYPEDEF : TypedefExplorer, + gdb.TYPE_CODE_ARRAY : ArrayExplorer + } + + @staticmethod + def is_scalar_type(type): + """Checks whether a type is a scalar type. + A type is a scalar type of its type is + gdb.TYPE_CODE_CHAR or + gdb.TYPE_CODE_INT or + gdb.TYPE_CODE_BOOL or + gdb.TYPE_CODE_FLT or + gdb.TYPE_CODE_VOID or + gdb.TYPE_CODE_ENUM. + + Arguments: + type: The type to be checked. + + Returns: + 'True' if 'type' is a scalar type. 'False' otherwise. + """ + return type.code in Explorer._SCALAR_TYPE_LIST + + @staticmethod + def return_to_parent_value(): + """A utility function which prints that the current exploration session + is returning to the parent value. Useful when exploring values. + """ + print ("\nReturning to parent value...\n") + + @staticmethod + def return_to_parent_value_prompt(): + """A utility function which prompts the user to press the 'enter' key + so that the exploration session can shift back to the parent value. + Useful when exploring values. + """ + raw_input("\nPress enter to return to parent value: ") + + @staticmethod + def return_to_enclosing_type(): + """A utility function which prints that the current exploration session + is returning to the enclosing type. Useful when exploring types. + """ + print ("\nReturning to enclosing type...\n") + + @staticmethod + def return_to_enclosing_type_prompt(): + """A utility function which prompts the user to press the 'enter' key + so that the exploration session can shift back to the enclosing type. + Useful when exploring types. + """ + raw_input("\nPress enter to return to enclosing type: ") + + +class ScalarExplorer(object): + """Internal class used to explore scalar values.""" + + @staticmethod + def explore_expr(expr, value, is_child): + """Function to explore scalar values. + See Explorer.explore_expr and Explorer.is_scalar_type for more + information. + """ + print ("'%s' is a scalar value of type '%s'." % + (expr, value.type)) + print ("%s = %s" % (expr, str(value))) + + if is_child: + Explorer.return_to_parent_value_prompt() + Explorer.return_to_parent_value() + + return False + + @staticmethod + def explore_type(name, datatype, is_child): + """Function to explore scalar types. + See Explorer.explore_type and Explorer.is_scalar_type for more + information. + """ + if datatype.code == gdb.TYPE_CODE_ENUM: + if is_child: + print ("%s is of an enumerated type '%s'." % + (name, str(datatype))) + else: + print ("'%s' is an enumerated type." % name) + else: + if is_child: + print ("%s is of a scalar type '%s'." % + (name, str(datatype))) + else: + print ("'%s' is a scalar type." % name) + + if is_child: + Explorer.return_to_enclosing_type_prompt() + Explorer.return_to_enclosing_type() + + return False + + +class PointerExplorer(object): + """Internal class used to explore pointer values.""" + + @staticmethod + def explore_expr(expr, value, is_child): + """Function to explore pointer values. + See Explorer.explore_expr for more information. + """ + print ("'%s' is a pointer to a value of type '%s'" % + (expr, str(value.type.target()))) + option = raw_input("Continue exploring it as a pointer to a single " + "value [y/n]: ") + if option == "y": + deref_value = None + try: + deref_value = value.dereference() + str(deref_value) + except gdb.MemoryError: + print ("'%s' a pointer pointing to an invalid memory " + "location." % expr) + if is_child: + Explorer.return_to_parent_value_prompt() + return False + Explorer.explore_expr("*%s" % Explorer.guard_expr(expr), + deref_value, is_child) + return False + + option = raw_input("Continue exploring it as a pointer to an " + "array [y/n]: ") + if option == "y": + while True: + index = 0 + try: + index = int(raw_input("Enter the index of the element you " + "want to explore in '%s': " % expr)) + except ValueError: + break + element_expr = "%s[%d]" % (Explorer.guard_expr(expr), index) + element = value[index] + try: + str(element) + except gdb.MemoryError: + print ("Cannot read value at index %d." % index) + continue + Explorer.explore_expr(element_expr, element, True) + return False + + if is_child: + Explorer.return_to_parent_value() + return False + + @staticmethod + def explore_type(name, datatype, is_child): + """Function to explore pointer types. + See Explorer.explore_type for more information. + """ + target_type = datatype.target() + print ("\n%s is a pointer to a value of type '%s'." % + (name, str(target_type))) + + Explorer.explore_type("the pointee type of %s" % name, + target_type, + is_child) + return False + + +class ReferenceExplorer(object): + """Internal class used to explore reference (TYPE_CODE_REF) values.""" + + @staticmethod + def explore_expr(expr, value, is_child): + """Function to explore array values. + See Explorer.explore_expr for more information. + """ + referenced_value = value.referenced_value() + Explorer.explore_expr(expr, referenced_value, is_child) + return False + + @staticmethod + def explore_type(name, datatype, is_child): + """Function to explore pointer types. + See Explorer.explore_type for more information. + """ + target_type = datatype.target() + Explorer.explore_type(name, target_type, is_child) + return False + +class ArrayExplorer(object): + """Internal class used to explore arrays.""" + + @staticmethod + def explore_expr(expr, value, is_child): + """Function to explore array values. + See Explorer.explore_expr for more information. + """ + target_type = value.type.target() + print ("'%s' is an array of '%s'." % (expr, str(target_type))) + index = 0 + try: + index = int(raw_input("Enter the index of the element you want to " + "explore in '%s': " % expr)) + except ValueError: + if is_child: + Explorer.return_to_parent_value() + return False + + element = None + try: + element = value[index] + str(element) + except gdb.MemoryError: + print ("Cannot read value at index %d." % index) + raw_input("Press enter to continue... ") + return True + + Explorer.explore_expr("%s[%d]" % (Explorer.guard_expr(expr), index), + element, True) + return True + + @staticmethod + def explore_type(name, datatype, is_child): + """Function to explore array types. + See Explorer.explore_type for more information. + """ + target_type = datatype.target() + print ("%s is an array of '%s'." % (name, str(target_type))) + + Explorer.explore_type("the array element of %s" % name, target_type, + is_child) + return False + + +class CompoundExplorer(object): + """Internal class used to explore struct, classes and unions.""" + + @staticmethod + def _print_fields(print_list): + """Internal function which prints the fields of a struct/class/union. + """ + max_field_name_length = 0 + for pair in print_list: + if max_field_name_length < len(pair[0]): + max_field_name_length = len(pair[0]) + + for pair in print_list: + print (" %*s = %s" % (max_field_name_length, pair[0], pair[1])) + + @staticmethod + def _get_real_field_count(fields): + real_field_count = 0; + for field in fields: + if not field.artificial: + real_field_count = real_field_count + 1 + + return real_field_count + + @staticmethod + def explore_expr(expr, value, is_child): + """Function to explore structs/classes and union values. + See Explorer.explore_expr for more information. + """ + datatype = value.type + type_code = datatype.code + fields = datatype.fields() + + if type_code == gdb.TYPE_CODE_STRUCT: + type_desc = "struct/class" + else: + type_desc = "union" + + if CompoundExplorer._get_real_field_count(fields) == 0: + print ("The value of '%s' is a %s of type '%s' with no fields." % + (expr, type_desc, str(value.type))) + if is_child: + Explorer.return_to_parent_value_prompt() + return False + + print ("The value of '%s' is a %s of type '%s' with the following " + "fields:\n" % (expr, type_desc, str(value.type))) + + has_explorable_fields = False + choice_to_compound_field_map = { } + current_choice = 0 + print_list = [ ] + for field in fields: + if field.artificial: + continue + field_full_name = Explorer.guard_expr(expr) + "." + field.name + if field.is_base_class: + field_value = value.cast(field.type) + else: + field_value = value[field.name] + literal_value = "" + if type_code == gdb.TYPE_CODE_UNION: + literal_value = ("<Enter %d to explore this field of type " + "'%s'>" % (current_choice, str(field.type))) + has_explorable_fields = True + else: + if Explorer.is_scalar_type(field.type): + literal_value = ("%s .. (Value of type '%s')" % + (str(field_value), str(field.type))) + else: + if field.is_base_class: + field_desc = "base class" + else: + field_desc = "field" + literal_value = ("<Enter %d to explore this %s of type " + "'%s'>" % + (current_choice, field_desc, + str(field.type))) + has_explorable_fields = True + + choice_to_compound_field_map[str(current_choice)] = ( + field_full_name, field_value) + current_choice = current_choice + 1 + + print_list.append((field.name, literal_value)) + + CompoundExplorer._print_fields(print_list) + print ("") + + if has_explorable_fields: + choice = raw_input("Enter the field number of choice: ") + if choice in choice_to_compound_field_map: + Explorer.explore_expr(choice_to_compound_field_map[choice][0], + choice_to_compound_field_map[choice][1], + True) + return True + else: + if is_child: + Explorer.return_to_parent_value() + else: + if is_child: + Explorer.return_to_parent_value_prompt() + + return False + + @staticmethod + def explore_type(name, datatype, is_child): + """Function to explore struct/class and union types. + See Explorer.explore_type for more information. + """ + type_code = datatype.code + type_desc = "" + if type_code == gdb.TYPE_CODE_STRUCT: + type_desc = "struct/class" + else: + type_desc = "union" + + fields = datatype.fields() + if CompoundExplorer._get_real_field_count(fields) == 0: + if is_child: + print ("%s is a %s of type '%s' with no fields." % + (name, type_desc, str(datatype))) + Explorer.return_to_enclosing_type_prompt() + else: + print ("'%s' is a %s with no fields." % (name, type_desc)) + return False + + if is_child: + print ("%s is a %s of type '%s' " + "with the following fields:\n" % + (name, type_desc, str(datatype))) + else: + print ("'%s' is a %s with the following " + "fields:\n" % + (name, type_desc)) + + has_explorable_fields = False + current_choice = 0 + choice_to_compound_field_map = { } + print_list = [ ] + for field in fields: + if field.artificial: + continue + if field.is_base_class: + field_desc = "base class" + else: + field_desc = "field" + rhs = ("<Enter %d to explore this %s of type '%s'>" % + (current_choice, field_desc, str(field.type))) + print_list.append((field.name, rhs)) + choice_to_compound_field_map[str(current_choice)] = ( + field.name, field.type, field_desc) + current_choice = current_choice + 1 + + CompoundExplorer._print_fields(print_list) + print ("") + + if len(choice_to_compound_field_map) > 0: + choice = raw_input("Enter the field number of choice: ") + if choice in choice_to_compound_field_map: + if is_child: + new_name = ("%s '%s' of %s" % + (choice_to_compound_field_map[choice][2], + choice_to_compound_field_map[choice][0], + name)) + else: + new_name = ("%s '%s' of '%s'" % + (choice_to_compound_field_map[choice][2], + choice_to_compound_field_map[choice][0], + name)) + Explorer.explore_type(new_name, + choice_to_compound_field_map[choice][1], True) + return True + else: + if is_child: + Explorer.return_to_enclosing_type() + else: + if is_child: + Explorer.return_to_enclosing_type_prompt() + + return False + + +class TypedefExplorer(object): + """Internal class used to explore values whose type is a typedef.""" + + @staticmethod + def explore_expr(expr, value, is_child): + """Function to explore typedef values. + See Explorer.explore_expr for more information. + """ + actual_type = value.type.strip_typedefs() + print ("The value of '%s' is of type '%s' " + "which is a typedef of type '%s'" % + (expr, str(value.type), str(actual_type))) + + Explorer.explore_expr(expr, value.cast(actual_type), is_child) + return False + + @staticmethod + def explore_type(name, datatype, is_child): + """Function to explore typedef types. + See Explorer.explore_type for more information. + """ + actual_type = datatype.strip_typedefs() + if is_child: + print ("The type of %s is a typedef of type '%s'." % + (name, str(actual_type))) + else: + print ("The type '%s' is a typedef of type '%s'." % + (name, str(actual_type))) + + Explorer.explore_type(name, actual_type, is_child) + return False + + +class ExploreUtils(object): + """Internal class which provides utilities for the main command classes.""" + + @staticmethod + def check_args(name, arg_str): + """Utility to check if adequate number of arguments are passed to an + explore command. + + Arguments: + name: The name of the explore command. + arg_str: The argument string passed to the explore command. + + Returns: + True if adequate arguments are passed, false otherwise. + + Raises: + gdb.GdbError if adequate arguments are not passed. + """ + if len(arg_str) < 1: + raise gdb.GdbError("ERROR: '%s' requires an argument." + % name) + return False + else: + return True + + @staticmethod + def get_type_from_str(type_str): + """A utility function to deduce the gdb.Type value from a string + representing the type. + + Arguments: + type_str: The type string from which the gdb.Type value should be + deduced. + + Returns: + The deduced gdb.Type value if possible, None otherwise. + """ + try: + # Assume the current language to be C/C++ and make a try. + return gdb.parse_and_eval("(%s *)0" % type_str).type.target() + except RuntimeError: + # If assumption of current language to be C/C++ was wrong, then + # lookup the type using the API. + try: + return gdb.lookup_type(type_str) + except RuntimeError: + return None + + @staticmethod + def get_value_from_str(value_str): + """A utility function to deduce the gdb.Value value from a string + representing the value. + + Arguments: + value_str: The value string from which the gdb.Value value should + be deduced. + + Returns: + The deduced gdb.Value value if possible, None otherwise. + """ + try: + return gdb.parse_and_eval(value_str) + except RuntimeError: + return None + + +class ExploreCommand(gdb.Command): + """Explore a value or a type valid in the current context. + +Usage: explore ARG + +- ARG is either a valid expression or a type name. +- At any stage of exploration, hit the return key (instead of a +choice, if any) to return to the enclosing type or value.""" + + def __init__(self): + super(ExploreCommand, self).__init__(name = "explore", + command_class = gdb.COMMAND_DATA, + prefix = True) + + def invoke(self, arg_str, from_tty): + if ExploreUtils.check_args("explore", arg_str) == False: + return + + # Check if it is a value + value = ExploreUtils.get_value_from_str(arg_str) + if value is not None: + Explorer.explore_expr(arg_str, value, False) + return + + # If it is not a value, check if it is a type + datatype = ExploreUtils.get_type_from_str(arg_str) + if datatype is not None: + Explorer.explore_type(arg_str, datatype, False) + return + + # If it is neither a value nor a type, raise an error. + raise gdb.GdbError( + ("'%s' neither evaluates to a value nor is a type " + "in the current context." % + arg_str)) + + +class ExploreValueCommand(gdb.Command): + """Explore value of an expression valid in the current context. + +Usage: explore value ARG + +- ARG is a valid expression. +- At any stage of exploration, hit the return key (instead of a +choice, if any) to return to the enclosing value.""" + + def __init__(self): + super(ExploreValueCommand, self).__init__( + name = "explore value", command_class = gdb.COMMAND_DATA) + + def invoke(self, arg_str, from_tty): + if ExploreUtils.check_args("explore value", arg_str) == False: + return + + value = ExploreUtils.get_value_from_str(arg_str) + if value is None: + raise gdb.GdbError( + (" '%s' does not evaluate to a value in the current " + "context." % + arg_str)) + return + + Explorer.explore_expr(arg_str, value, False) + + +class ExploreTypeCommand(gdb.Command): + """Explore a type or the type of an expression. + +Usage: explore type ARG + +- ARG is a valid expression or a type name. +- At any stage of exploration, hit the return key (instead of a +choice, if any) to return to the enclosing type.""" + + def __init__(self): + super(ExploreTypeCommand, self).__init__( + name = "explore type", command_class = gdb.COMMAND_DATA) + + def invoke(self, arg_str, from_tty): + if ExploreUtils.check_args("explore type", arg_str) == False: + return + + datatype = ExploreUtils.get_type_from_str(arg_str) + if datatype is not None: + Explorer.explore_type(arg_str, datatype, False) + return + + value = ExploreUtils.get_value_from_str(arg_str) + if value is not None: + print ("'%s' is of type '%s'." % (arg_str, str(value.type))) + Explorer.explore_type(str(value.type), value.type, False) + return + + raise gdb.GdbError(("'%s' is not a type or value in the current " + "context." % arg_str)) + + +Explorer.init_env() + +ExploreCommand() +ExploreValueCommand() +ExploreTypeCommand() diff --git a/tools/msys/mingw32/share/gdb/python/gdb/command/frame_filters.py b/tools/msys/mingw32/share/gdb/python/gdb/command/frame_filters.py new file mode 100644 index 0000000000000000000000000000000000000000..fd7498fd144731c099fc14fc38755f8fb21e2f32 --- /dev/null +++ b/tools/msys/mingw32/share/gdb/python/gdb/command/frame_filters.py @@ -0,0 +1,456 @@ +# Frame-filter commands. +# Copyright (C) 2013-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""GDB commands for working with frame-filters.""" + +import sys +import gdb +import copy +from gdb.FrameIterator import FrameIterator +from gdb.FrameDecorator import FrameDecorator +import gdb.frames +import itertools + +# GDB Commands. +class SetFilterPrefixCmd(gdb.Command): + """Prefix command for 'set' frame-filter related operations.""" + + def __init__(self): + super(SetFilterPrefixCmd, self).__init__("set frame-filter", + gdb.COMMAND_OBSCURE, + gdb.COMPLETE_NONE, True) + +class ShowFilterPrefixCmd(gdb.Command): + """Prefix command for 'show' frame-filter related operations.""" + def __init__(self): + super(ShowFilterPrefixCmd, self).__init__("show frame-filter", + gdb.COMMAND_OBSCURE, + gdb.COMPLETE_NONE, True) +class InfoFrameFilter(gdb.Command): + """List all registered Python frame-filters. + +Usage: info frame-filters""" + + def __init__(self): + super(InfoFrameFilter, self).__init__("info frame-filter", + gdb.COMMAND_DATA) + @staticmethod + def enabled_string(state): + """Return "Yes" if filter is enabled, otherwise "No".""" + if state: + return "Yes" + else: + return "No" + + def print_list(self, title, frame_filters, blank_line): + sorted_frame_filters = sorted(frame_filters.items(), + key=lambda i: gdb.frames.get_priority(i[1]), + reverse=True) + + if len(sorted_frame_filters) == 0: + return 0 + + print(title) + print(" Priority Enabled Name") + for frame_filter in sorted_frame_filters: + name = frame_filter[0] + try: + priority = '{:<8}'.format( + str(gdb.frames.get_priority(frame_filter[1]))) + enabled = '{:<7}'.format( + self.enabled_string(gdb.frames.get_enabled(frame_filter[1]))) + print(" %s %s %s" % (priority, enabled, name)) + except Exception: + e = sys.exc_info()[1] + print(" Error printing filter '"+name+"': "+str(e)) + if blank_line: + print("") + return 1 + + def invoke(self, arg, from_tty): + any_printed = self.print_list("global frame-filters:", gdb.frame_filters, True) + + cp = gdb.current_progspace() + any_printed += self.print_list("progspace %s frame-filters:" % cp.filename, + cp.frame_filters, True) + + for objfile in gdb.objfiles(): + any_printed += self.print_list("objfile %s frame-filters:" % objfile.filename, + objfile.frame_filters, False) + + if any_printed == 0: + print ("No frame filters.") + +# Internal enable/disable functions. + +def _enable_parse_arg(cmd_name, arg): + """ Internal worker function to take an argument from + enable/disable and return a tuple of arguments. + + Arguments: + cmd_name: Name of the command invoking this function. + args: The argument as a string. + + Returns: + A tuple containing the dictionary, and the argument, or just + the dictionary in the case of "all". + """ + + argv = gdb.string_to_argv(arg); + argc = len(argv) + if argc == 0: + raise gdb.GdbError(cmd_name + " requires an argument") + if argv[0] == "all": + if argc > 1: + raise gdb.GdbError(cmd_name + ": with 'all' " \ + "you may not specify a filter.") + elif argc != 2: + raise gdb.GdbError(cmd_name + " takes exactly two arguments.") + + return argv + +def _do_enable_frame_filter(command_tuple, flag): + """Worker for enabling/disabling frame_filters. + + Arguments: + command_type: A tuple with the first element being the + frame filter dictionary, and the second being + the frame filter name. + flag: True for Enable, False for Disable. + """ + + list_op = command_tuple[0] + op_list = gdb.frames.return_list(list_op) + + if list_op == "all": + for item in op_list: + gdb.frames.set_enabled(item, flag) + else: + frame_filter = command_tuple[1] + try: + ff = op_list[frame_filter] + except KeyError: + msg = "frame-filter '" + str(frame_filter) + "' not found." + raise gdb.GdbError(msg) + + gdb.frames.set_enabled(ff, flag) + +def _complete_frame_filter_list(text, word, all_flag): + """Worker for frame filter dictionary name completion. + + Arguments: + text: The full text of the command line. + word: The most recent word of the command line. + all_flag: Whether to include the word "all" in completion. + + Returns: + A list of suggested frame filter dictionary name completions + from text/word analysis. This list can be empty when there + are no suggestions for completion. + """ + if all_flag == True: + filter_locations = ["all", "global", "progspace"] + else: + filter_locations = ["global", "progspace"] + for objfile in gdb.objfiles(): + filter_locations.append(objfile.filename) + + # If the user just asked for completions with no completion + # hints, just return all the frame filter dictionaries we know + # about. + if (text == ""): + return filter_locations + + # Otherwise filter on what we know. + flist = filter(lambda x,y=text:x.startswith(y), filter_locations) + + # If we only have one completion, complete it and return it. + if len(flist) == 1: + flist[0] = flist[0][len(text)-len(word):] + + # Otherwise, return an empty list, or a list of frame filter + # dictionaries that the previous filter operation returned. + return flist + +def _complete_frame_filter_name(word, printer_dict): + """Worker for frame filter name completion. + + Arguments: + + word: The most recent word of the command line. + + printer_dict: The frame filter dictionary to search for frame + filter name completions. + + Returns: A list of suggested frame filter name completions + from word analysis of the frame filter dictionary. This list + can be empty when there are no suggestions for completion. + """ + + printer_keys = printer_dict.keys() + if (word == ""): + return printer_keys + + flist = filter(lambda x,y=word:x.startswith(y), printer_keys) + return flist + +class EnableFrameFilter(gdb.Command): + """GDB command to enable the specified frame-filter. + +Usage: enable frame-filter DICTIONARY [NAME] + +DICTIONARY is the name of the frame filter dictionary on which to +operate. If dictionary is set to "all", perform operations on all +dictionaries. Named dictionaries are: "global" for the global +frame filter dictionary, "progspace" for the program space's frame +filter dictionary. If either all, or the two named dictionaries +are not specified, the dictionary name is assumed to be the name +of an "objfile" -- a shared library or an executable. + +NAME matches the name of the frame-filter to operate on.""" + def __init__(self): + super(EnableFrameFilter, self).__init__("enable frame-filter", + gdb.COMMAND_DATA) + def complete(self, text, word): + """Completion function for both frame filter dictionary, and + frame filter name.""" + if text.count(" ") == 0: + return _complete_frame_filter_list(text, word, True) + else: + printer_list = gdb.frames.return_list(text.split()[0].rstrip()) + return _complete_frame_filter_name(word, printer_list) + + def invoke(self, arg, from_tty): + command_tuple = _enable_parse_arg("enable frame-filter", arg) + _do_enable_frame_filter(command_tuple, True) + + +class DisableFrameFilter(gdb.Command): + """GDB command to disable the specified frame-filter. + +Usage: disable frame-filter DICTIONARY [NAME] + +DICTIONARY is the name of the frame filter dictionary on which to +operate. If dictionary is set to "all", perform operations on all +dictionaries. Named dictionaries are: "global" for the global +frame filter dictionary, "progspace" for the program space's frame +filter dictionary. If either all, or the two named dictionaries +are not specified, the dictionary name is assumed to be the name +of an "objfile" -- a shared library or an executable. + +NAME matches the name of the frame-filter to operate on.""" + def __init__(self): + super(DisableFrameFilter, self).__init__("disable frame-filter", + gdb.COMMAND_DATA) + + def complete(self, text, word): + """Completion function for both frame filter dictionary, and + frame filter name.""" + if text.count(" ") == 0: + return _complete_frame_filter_list(text, word, True) + else: + printer_list = gdb.frames.return_list(text.split()[0].rstrip()) + return _complete_frame_filter_name(word, printer_list) + + def invoke(self, arg, from_tty): + command_tuple = _enable_parse_arg("disable frame-filter", arg) + _do_enable_frame_filter(command_tuple, False) + +class SetFrameFilterPriority(gdb.Command): + """GDB command to set the priority of the specified frame-filter. + +Usage: set frame-filter priority DICTIONARY NAME PRIORITY + +DICTIONARY is the name of the frame filter dictionary on which to +operate. Named dictionaries are: "global" for the global frame +filter dictionary, "progspace" for the program space's framefilter +dictionary. If either of these two are not specified, the +dictionary name is assumed to be the name of an "objfile" -- a +shared library or an executable. + +NAME matches the name of the frame filter to operate on. + +PRIORITY is the an integer to assign the new priority to the frame +filter.""" + + def __init__(self): + super(SetFrameFilterPriority, self).__init__("set frame-filter " \ + "priority", + gdb.COMMAND_DATA) + + def _parse_pri_arg(self, arg): + """Internal worker to parse a priority from a tuple. + + Arguments: + arg: Tuple which contains the arguments from the command. + + Returns: + A tuple containing the dictionary, name and priority from + the arguments. + + Raises: + gdb.GdbError: An error parsing the arguments. + """ + + argv = gdb.string_to_argv(arg); + argc = len(argv) + if argc != 3: + print("set frame-filter priority " \ + "takes exactly three arguments.") + return None + + return argv + + def _set_filter_priority(self, command_tuple): + """Internal worker for setting priority of frame-filters, by + parsing a tuple and calling _set_priority with the parsed + tuple. + + Arguments: + command_tuple: Tuple which contains the arguments from the + command. + """ + + list_op = command_tuple[0] + frame_filter = command_tuple[1] + + # GDB returns arguments as a string, so convert priority to + # a number. + priority = int(command_tuple[2]) + + op_list = gdb.frames.return_list(list_op) + + try: + ff = op_list[frame_filter] + except KeyError: + msg = "frame-filter '" + str(frame_filter) + "' not found." + raise gdb.GdbError(msg) + + gdb.frames.set_priority(ff, priority) + + def complete(self, text, word): + """Completion function for both frame filter dictionary, and + frame filter name.""" + if text.count(" ") == 0: + return _complete_frame_filter_list(text, word, False) + else: + printer_list = gdb.frames.return_list(text.split()[0].rstrip()) + return _complete_frame_filter_name(word, printer_list) + + def invoke(self, arg, from_tty): + command_tuple = self._parse_pri_arg(arg) + if command_tuple != None: + self._set_filter_priority(command_tuple) + +class ShowFrameFilterPriority(gdb.Command): + """GDB command to show the priority of the specified frame-filter. + +Usage: show frame-filter priority DICTIONARY NAME + +DICTIONARY is the name of the frame filter dictionary on which to +operate. Named dictionaries are: "global" for the global frame +filter dictionary, "progspace" for the program space's framefilter +dictionary. If either of these two are not specified, the +dictionary name is assumed to be the name of an "objfile" -- a +shared library or an executable. + +NAME matches the name of the frame-filter to operate on.""" + + def __init__(self): + super(ShowFrameFilterPriority, self).__init__("show frame-filter " \ + "priority", + gdb.COMMAND_DATA) + + def _parse_pri_arg(self, arg): + """Internal worker to parse a dictionary and name from a + tuple. + + Arguments: + arg: Tuple which contains the arguments from the command. + + Returns: + A tuple containing the dictionary, and frame filter name. + + Raises: + gdb.GdbError: An error parsing the arguments. + """ + + argv = gdb.string_to_argv(arg); + argc = len(argv) + if argc != 2: + print("show frame-filter priority " \ + "takes exactly two arguments.") + return None + + return argv + + def get_filter_priority(self, frame_filters, name): + """Worker for retrieving the priority of frame_filters. + + Arguments: + frame_filters: Name of frame filter dictionary. + name: object to select printers. + + Returns: + The priority of the frame filter. + + Raises: + gdb.GdbError: A frame filter cannot be found. + """ + + op_list = gdb.frames.return_list(frame_filters) + + try: + ff = op_list[name] + except KeyError: + msg = "frame-filter '" + str(name) + "' not found." + raise gdb.GdbError(msg) + + return gdb.frames.get_priority(ff) + + def complete(self, text, word): + """Completion function for both frame filter dictionary, and + frame filter name.""" + + if text.count(" ") == 0: + return _complete_frame_filter_list(text, word, False) + else: + printer_list = frame._return_list(text.split()[0].rstrip()) + return _complete_frame_filter_name(word, printer_list) + + def invoke(self, arg, from_tty): + command_tuple = self._parse_pri_arg(arg) + if command_tuple == None: + return + filter_name = command_tuple[1] + list_name = command_tuple[0] + try: + priority = self.get_filter_priority(list_name, filter_name); + except Exception: + e = sys.exc_info()[1] + print("Error printing filter priority for '"+name+"':"+str(e)) + else: + print("Priority of filter '" + filter_name + "' in list '" \ + + list_name + "' is: " + str(priority)) + +# Register commands +SetFilterPrefixCmd() +ShowFilterPrefixCmd() +InfoFrameFilter() +EnableFrameFilter() +DisableFrameFilter() +SetFrameFilterPriority() +ShowFrameFilterPriority() diff --git a/tools/msys/mingw32/share/gdb/python/gdb/command/pretty_printers.py b/tools/msys/mingw32/share/gdb/python/gdb/command/pretty_printers.py new file mode 100644 index 0000000000000000000000000000000000000000..f25807d076538a879583cac07b91596b1ca0f1a1 --- /dev/null +++ b/tools/msys/mingw32/share/gdb/python/gdb/command/pretty_printers.py @@ -0,0 +1,365 @@ +# Pretty-printer commands. +# Copyright (C) 2010-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""GDB commands for working with pretty-printers.""" + +import copy +import gdb +import re + + +def parse_printer_regexps(arg): + """Internal utility to parse a pretty-printer command argv. + + Arguments: + arg: The arguments to the command. The format is: + [object-regexp [name-regexp]]. + Individual printers in a collection are named as + printer-name;subprinter-name. + + Returns: + The result is a 3-tuple of compiled regular expressions, except that + the resulting compiled subprinter regexp is None if not provided. + + Raises: + SyntaxError: an error processing ARG + """ + + argv = gdb.string_to_argv(arg); + argc = len(argv) + object_regexp = "" # match everything + name_regexp = "" # match everything + subname_regexp = None + if argc > 3: + raise SyntaxError("too many arguments") + if argc >= 1: + object_regexp = argv[0] + if argc >= 2: + name_subname = argv[1].split(";", 1) + name_regexp = name_subname[0] + if len(name_subname) == 2: + subname_regexp = name_subname[1] + # That re.compile raises SyntaxError was determined empirically. + # We catch it and reraise it to provide a slightly more useful + # error message for the user. + try: + object_re = re.compile(object_regexp) + except SyntaxError: + raise SyntaxError("invalid object regexp: %s" % object_regexp) + try: + name_re = re.compile (name_regexp) + except SyntaxError: + raise SyntaxError("invalid name regexp: %s" % name_regexp) + if subname_regexp is not None: + try: + subname_re = re.compile(subname_regexp) + except SyntaxError: + raise SyntaxError("invalid subname regexp: %s" % subname_regexp) + else: + subname_re = None + return(object_re, name_re, subname_re) + + +def printer_enabled_p(printer): + """Internal utility to see if printer (or subprinter) is enabled.""" + if hasattr(printer, "enabled"): + return printer.enabled + else: + return True + + +class InfoPrettyPrinter(gdb.Command): + """GDB command to list all registered pretty-printers. + +Usage: info pretty-printer [OBJECT-REGEXP [NAME-REGEXP]] + +OBJECT-REGEXP is a regular expression matching the objects to list. +Objects are "global", the program space's file, and the objfiles within +that program space. + +NAME-REGEXP matches the name of the pretty-printer. +Individual printers in a collection are named as +printer-name;subprinter-name.""" + + def __init__ (self): + super(InfoPrettyPrinter, self).__init__("info pretty-printer", + gdb.COMMAND_DATA) + + @staticmethod + def enabled_string(printer): + """Return "" if PRINTER is enabled, otherwise " [disabled]".""" + if printer_enabled_p(printer): + return "" + else: + return " [disabled]" + + @staticmethod + def printer_name(printer): + """Return the printer's name.""" + if hasattr(printer, "name"): + return printer.name + if hasattr(printer, "__name__"): + return printer.__name__ + # This "shouldn't happen", but the public API allows for + # direct additions to the pretty-printer list, and we shouldn't + # crash because someone added a bogus printer. + # Plus we want to give the user a way to list unknown printers. + return "unknown" + + def list_pretty_printers(self, pretty_printers, name_re, subname_re): + """Print a list of pretty-printers.""" + # A potential enhancement is to provide an option to list printers in + # "lookup order" (i.e. unsorted). + sorted_pretty_printers = sorted (copy.copy(pretty_printers), + key = self.printer_name) + for printer in sorted_pretty_printers: + name = self.printer_name(printer) + enabled = self.enabled_string(printer) + if name_re.match(name): + print (" %s%s" % (name, enabled)) + if (hasattr(printer, "subprinters") and + printer.subprinters is not None): + sorted_subprinters = sorted (copy.copy(printer.subprinters), + key = self.printer_name) + for subprinter in sorted_subprinters: + if (not subname_re or + subname_re.match(subprinter.name)): + print (" %s%s" % + (subprinter.name, + self.enabled_string(subprinter))) + + def invoke1(self, title, printer_list, + obj_name_to_match, object_re, name_re, subname_re): + """Subroutine of invoke to simplify it.""" + if printer_list and object_re.match(obj_name_to_match): + print (title) + self.list_pretty_printers(printer_list, name_re, subname_re) + + def invoke(self, arg, from_tty): + """GDB calls this to perform the command.""" + (object_re, name_re, subname_re) = parse_printer_regexps(arg) + self.invoke1("global pretty-printers:", gdb.pretty_printers, + "global", object_re, name_re, subname_re) + cp = gdb.current_progspace() + self.invoke1("progspace %s pretty-printers:" % cp.filename, + cp.pretty_printers, "progspace", + object_re, name_re, subname_re) + for objfile in gdb.objfiles(): + self.invoke1("objfile %s pretty-printers:" % objfile.filename, + objfile.pretty_printers, objfile.filename, + object_re, name_re, subname_re) + + +def count_enabled_printers(pretty_printers): + """Return a 2-tuple of number of enabled and total printers.""" + enabled = 0 + total = 0 + for printer in pretty_printers: + if (hasattr(printer, "subprinters") + and printer.subprinters is not None): + if printer_enabled_p(printer): + for subprinter in printer.subprinters: + if printer_enabled_p(subprinter): + enabled += 1 + total += len(printer.subprinters) + else: + if printer_enabled_p(printer): + enabled += 1 + total += 1 + return (enabled, total) + + +def count_all_enabled_printers(): + """Return a 2-tuble of the enabled state and total number of all printers. + This includes subprinters. + """ + enabled_count = 0 + total_count = 0 + (t_enabled, t_total) = count_enabled_printers(gdb.pretty_printers) + enabled_count += t_enabled + total_count += t_total + (t_enabled, t_total) = count_enabled_printers(gdb.current_progspace().pretty_printers) + enabled_count += t_enabled + total_count += t_total + for objfile in gdb.objfiles(): + (t_enabled, t_total) = count_enabled_printers(objfile.pretty_printers) + enabled_count += t_enabled + total_count += t_total + return (enabled_count, total_count) + + +def pluralize(text, n, suffix="s"): + """Return TEXT pluralized if N != 1.""" + if n != 1: + return "%s%s" % (text, suffix) + else: + return text + + +def show_pretty_printer_enabled_summary(): + """Print the number of printers enabled/disabled. + We count subprinters individually. + """ + (enabled_count, total_count) = count_all_enabled_printers() + print ("%d of %d printers enabled" % (enabled_count, total_count)) + + +def do_enable_pretty_printer_1 (pretty_printers, name_re, subname_re, flag): + """Worker for enabling/disabling pretty-printers. + + Arguments: + pretty_printers: list of pretty-printers + name_re: regular-expression object to select printers + subname_re: regular expression object to select subprinters or None + if all are affected + flag: True for Enable, False for Disable + + Returns: + The number of printers affected. + This is just for informational purposes for the user. + """ + total = 0 + for printer in pretty_printers: + if (hasattr(printer, "name") and name_re.match(printer.name) or + hasattr(printer, "__name__") and name_re.match(printer.__name__)): + if (hasattr(printer, "subprinters") and + printer.subprinters is not None): + if not subname_re: + # Only record printers that change state. + if printer_enabled_p(printer) != flag: + for subprinter in printer.subprinters: + if printer_enabled_p(subprinter): + total += 1 + # NOTE: We preserve individual subprinter settings. + printer.enabled = flag + else: + # NOTE: Whether this actually disables the subprinter + # depends on whether the printer's lookup function supports + # the "enable" API. We can only assume it does. + for subprinter in printer.subprinters: + if subname_re.match(subprinter.name): + # Only record printers that change state. + if (printer_enabled_p(printer) and + printer_enabled_p(subprinter) != flag): + total += 1 + subprinter.enabled = flag + else: + # This printer has no subprinters. + # If the user does "disable pretty-printer .* .* foo" + # should we disable printers that don't have subprinters? + # How do we apply "foo" in this context? Since there is no + # "foo" subprinter it feels like we should skip this printer. + # There's still the issue of how to handle + # "disable pretty-printer .* .* .*", and every other variation + # that can match everything. For now punt and only support + # "disable pretty-printer .* .*" (i.e. subname is elided) + # to disable everything. + if not subname_re: + # Only record printers that change state. + if printer_enabled_p(printer) != flag: + total += 1 + printer.enabled = flag + return total + + +def do_enable_pretty_printer (arg, flag): + """Internal worker for enabling/disabling pretty-printers.""" + (object_re, name_re, subname_re) = parse_printer_regexps(arg) + + total = 0 + if object_re.match("global"): + total += do_enable_pretty_printer_1(gdb.pretty_printers, + name_re, subname_re, flag) + cp = gdb.current_progspace() + if object_re.match("progspace"): + total += do_enable_pretty_printer_1(cp.pretty_printers, + name_re, subname_re, flag) + for objfile in gdb.objfiles(): + if object_re.match(objfile.filename): + total += do_enable_pretty_printer_1(objfile.pretty_printers, + name_re, subname_re, flag) + + if flag: + state = "enabled" + else: + state = "disabled" + print ("%d %s %s" % (total, pluralize("printer", total), state)) + + # Print the total list of printers currently enabled/disabled. + # This is to further assist the user in determining whether the result + # is expected. Since we use regexps to select it's useful. + show_pretty_printer_enabled_summary() + + +# Enable/Disable one or more pretty-printers. +# +# This is intended for use when a broken pretty-printer is shipped/installed +# and the user wants to disable that printer without disabling all the other +# printers. +# +# A useful addition would be -v (verbose) to show each printer affected. + +class EnablePrettyPrinter (gdb.Command): + """GDB command to enable the specified pretty-printer. + +Usage: enable pretty-printer [OBJECT-REGEXP [NAME-REGEXP]] + +OBJECT-REGEXP is a regular expression matching the objects to examine. +Objects are "global", the program space's file, and the objfiles within +that program space. + +NAME-REGEXP matches the name of the pretty-printer. +Individual printers in a collection are named as +printer-name;subprinter-name.""" + + def __init__(self): + super(EnablePrettyPrinter, self).__init__("enable pretty-printer", + gdb.COMMAND_DATA) + + def invoke(self, arg, from_tty): + """GDB calls this to perform the command.""" + do_enable_pretty_printer(arg, True) + + +class DisablePrettyPrinter (gdb.Command): + """GDB command to disable the specified pretty-printer. + +Usage: disable pretty-printer [OBJECT-REGEXP [NAME-REGEXP]] + +OBJECT-REGEXP is a regular expression matching the objects to examine. +Objects are "global", the program space's file, and the objfiles within +that program space. + +NAME-REGEXP matches the name of the pretty-printer. +Individual printers in a collection are named as +printer-name;subprinter-name.""" + + def __init__(self): + super(DisablePrettyPrinter, self).__init__("disable pretty-printer", + gdb.COMMAND_DATA) + + def invoke(self, arg, from_tty): + """GDB calls this to perform the command.""" + do_enable_pretty_printer(arg, False) + + +def register_pretty_printer_commands(): + """Call from a top level script to install the pretty-printer commands.""" + InfoPrettyPrinter() + EnablePrettyPrinter() + DisablePrettyPrinter() + +register_pretty_printer_commands() diff --git a/tools/msys/mingw32/share/gdb/python/gdb/command/prompt.py b/tools/msys/mingw32/share/gdb/python/gdb/command/prompt.py new file mode 100644 index 0000000000000000000000000000000000000000..69ab57ba9d299ab99f51425613233ad645379309 --- /dev/null +++ b/tools/msys/mingw32/share/gdb/python/gdb/command/prompt.py @@ -0,0 +1,65 @@ +# Extended prompt. +# Copyright (C) 2011-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""GDB command for working with extended prompts.""" + +import gdb +import gdb.prompt + +class _ExtendedPrompt(gdb.Parameter): + + """Set the extended prompt. + +Usage: set extended-prompt VALUE + +Substitutions are applied to VALUE to compute the real prompt. + +The currently defined substitutions are: + +""" + # Add the prompt library's dynamically generated help to the + # __doc__ string. + __doc__ = __doc__ + gdb.prompt.prompt_help() + + set_doc = "Set the extended prompt." + show_doc = "Show the extended prompt." + + def __init__(self): + super(_ExtendedPrompt, self).__init__("extended-prompt", + gdb.COMMAND_SUPPORT, + gdb.PARAM_STRING_NOESCAPE) + self.value = '' + self.hook_set = False + + def get_show_string (self, pvalue): + if self.value: + return "The extended prompt is: " + self.value + else: + return "The extended prompt is not set." + + def get_set_string (self): + if self.hook_set == False: + gdb.prompt_hook = self.before_prompt_hook + self.hook_set = True + return "" + + def before_prompt_hook(self, current): + if self.value: + return gdb.prompt.substitute_prompt(self.value) + else: + return None + +_ExtendedPrompt() diff --git a/tools/msys/mingw32/share/gdb/python/gdb/command/type_printers.py b/tools/msys/mingw32/share/gdb/python/gdb/command/type_printers.py new file mode 100644 index 0000000000000000000000000000000000000000..af26abdf5780a1962b8f5f610315883a55c9507a --- /dev/null +++ b/tools/msys/mingw32/share/gdb/python/gdb/command/type_printers.py @@ -0,0 +1,122 @@ +# Type printer commands. +# Copyright (C) 2010-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import copy +import gdb + +"""GDB commands for working with type-printers.""" + +class InfoTypePrinter(gdb.Command): + """GDB command to list all registered type-printers. + +Usage: info type-printers""" + + def __init__ (self): + super(InfoTypePrinter, self).__init__("info type-printers", + gdb.COMMAND_DATA) + + def list_type_printers(self, type_printers): + """Print a list of type printers.""" + # A potential enhancement is to provide an option to list printers in + # "lookup order" (i.e. unsorted). + sorted_type_printers = sorted (copy.copy(type_printers), + key = lambda x: x.name) + for printer in sorted_type_printers: + if printer.enabled: + enabled = '' + else: + enabled = " [disabled]" + print (" %s%s" % (printer.name, enabled)) + + def invoke(self, arg, from_tty): + """GDB calls this to perform the command.""" + sep = '' + for objfile in gdb.objfiles(): + if objfile.type_printers: + print ("%sType printers for %s:" % (sep, objfile.filename)) + self.list_type_printers(objfile.type_printers) + sep = '\n' + if gdb.current_progspace().type_printers: + print ("%sType printers for program space:" % sep) + self.list_type_printers(gdb.current_progspace().type_printers) + sep = '\n' + if gdb.type_printers: + print ("%sGlobal type printers:" % sep) + self.list_type_printers(gdb.type_printers) + +class _EnableOrDisableCommand(gdb.Command): + def __init__(self, setting, name): + super(_EnableOrDisableCommand, self).__init__(name, gdb.COMMAND_DATA) + self.setting = setting + + def set_some(self, name, printers): + result = False + for p in printers: + if name == p.name: + p.enabled = self.setting + result = True + return result + + def invoke(self, arg, from_tty): + """GDB calls this to perform the command.""" + for name in arg.split(): + ok = False + for objfile in gdb.objfiles(): + if self.set_some(name, objfile.type_printers): + ok = True + if self.set_some(name, gdb.current_progspace().type_printers): + ok = True + if self.set_some(name, gdb.type_printers): + ok = True + if not ok: + print ("No type printer named '%s'" % name) + + def add_some(self, result, word, printers): + for p in printers: + if p.name.startswith(word): + result.append(p.name) + + def complete(self, text, word): + result = [] + for objfile in gdb.objfiles(): + self.add_some(result, word, objfile.type_printers) + self.add_some(result, word, gdb.current_progspace().type_printers) + self.add_some(result, word, gdb.type_printers) + return result + +class EnableTypePrinter(_EnableOrDisableCommand): + """GDB command to enable the specified type printer. + +Usage: enable type-printer NAME + +NAME is the name of the type-printer.""" + + def __init__(self): + super(EnableTypePrinter, self).__init__(True, "enable type-printer") + +class DisableTypePrinter(_EnableOrDisableCommand): + """GDB command to disable the specified type-printer. + +Usage: disable type-printer NAME + +NAME is the name of the type-printer.""" + + def __init__(self): + super(DisableTypePrinter, self).__init__(False, "disable type-printer") + +InfoTypePrinter() +EnableTypePrinter() +DisableTypePrinter() diff --git a/tools/msys/mingw32/share/gdb/python/gdb/command/unwinders.py b/tools/msys/mingw32/share/gdb/python/gdb/command/unwinders.py new file mode 100644 index 0000000000000000000000000000000000000000..b1edd96ab89e9a3be67eb09e2600a70d8e5839ef --- /dev/null +++ b/tools/msys/mingw32/share/gdb/python/gdb/command/unwinders.py @@ -0,0 +1,195 @@ +# Unwinder commands. +# Copyright 2015-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import gdb +import re + + +def validate_regexp(exp, idstring): + try: + return re.compile(exp) + except SyntaxError: + raise SyntaxError("Invalid %s regexp: %s." % (idstring, exp)) + + +def parse_unwinder_command_args(arg): + """Internal utility to parse unwinder command argv. + + Arguments: + arg: The arguments to the command. The format is: + [locus-regexp [name-regexp]] + + Returns: + A 2-tuple of compiled regular expressions. + + Raises: + SyntaxError: an error processing ARG + """ + + argv = gdb.string_to_argv(arg) + argc = len(argv) + if argc > 2: + raise SyntaxError("Too many arguments.") + locus_regexp = "" + name_regexp = "" + if argc >= 1: + locus_regexp = argv[0] + if argc >= 2: + name_regexp = argv[1] + return (validate_regexp(locus_regexp, "locus"), + validate_regexp(name_regexp, "unwinder")) + + +class InfoUnwinder(gdb.Command): + """GDB command to list unwinders. + +Usage: info unwinder [LOCUS-REGEXP [NAME-REGEXP]] + +LOCUS-REGEXP is a regular expression matching the location of the +unwinder. If it is omitted, all registered unwinders from all +loci are listed. A locus can be 'global', 'progspace' to list +the unwinders from the current progspace, or a regular expression +matching filenames of objfiles. + +NAME-REGEXP is a regular expression to filter unwinder names. If +this omitted for a specified locus, then all registered unwinders +in the locus are listed.""" + + def __init__(self): + super(InfoUnwinder, self).__init__("info unwinder", + gdb.COMMAND_STACK) + + def list_unwinders(self, title, unwinders, name_re): + """Lists the unwinders whose name matches regexp. + + Arguments: + title: The line to print before the list. + unwinders: The list of the unwinders. + name_re: unwinder name filter. + """ + if not unwinders: + return + print(title) + for unwinder in unwinders: + if name_re.match(unwinder.name): + print(" %s%s" % (unwinder.name, + "" if unwinder.enabled else " [disabled]")) + + def invoke(self, arg, from_tty): + locus_re, name_re = parse_unwinder_command_args(arg) + if locus_re.match("global"): + self.list_unwinders("Global:", gdb.frame_unwinders, + name_re) + if locus_re.match("progspace"): + cp = gdb.current_progspace() + self.list_unwinders("Progspace %s:" % cp.filename, + cp.frame_unwinders, name_re) + for objfile in gdb.objfiles(): + if locus_re.match(objfile.filename): + self.list_unwinders("Objfile %s:" % objfile.filename, + objfile.frame_unwinders, name_re) + + +def do_enable_unwinder1(unwinders, name_re, flag): + """Enable/disable unwinders whose names match given regex. + + Arguments: + unwinders: The list of unwinders. + name_re: Unwinder name filter. + flag: Enable/disable. + + Returns: + The number of unwinders affected. + """ + total = 0 + for unwinder in unwinders: + if name_re.match(unwinder.name): + unwinder.enabled = flag + total += 1 + return total + + +def do_enable_unwinder(arg, flag): + """Enable/disable unwinder(s).""" + (locus_re, name_re) = parse_unwinder_command_args(arg) + total = 0 + if locus_re.match("global"): + total += do_enable_unwinder1(gdb.frame_unwinders, name_re, flag) + if locus_re.match("progspace"): + total += do_enable_unwinder1(gdb.current_progspace().frame_unwinders, + name_re, flag) + for objfile in gdb.objfiles(): + if locus_re.match(objfile.filename): + total += do_enable_unwinder1(objfile.frame_unwinders, name_re, + flag) + if total > 0: + gdb.invalidate_cached_frames() + print("%d unwinder%s %s" % (total, "" if total == 1 else "s", + "enabled" if flag else "disabled")) + + +class EnableUnwinder(gdb.Command): + """GDB command to enable unwinders. + +Usage: enable unwinder [LOCUS-REGEXP [NAME-REGEXP]] + +LOCUS-REGEXP is a regular expression specifying the unwinders to +enable. It can 'global', 'progspace', or the name of an objfile +within that progspace. + +NAME_REGEXP is a regular expression to filter unwinder names. If +this omitted for a specified locus, then all registered unwinders +in the locus are affected.""" + + def __init__(self): + super(EnableUnwinder, self).__init__("enable unwinder", + gdb.COMMAND_STACK) + + def invoke(self, arg, from_tty): + """GDB calls this to perform the command.""" + do_enable_unwinder(arg, True) + + +class DisableUnwinder(gdb.Command): + """GDB command to disable the specified unwinder. + +Usage: disable unwinder [LOCUS-REGEXP [NAME-REGEXP]] + +LOCUS-REGEXP is a regular expression specifying the unwinders to +disable. It can 'global', 'progspace', or the name of an objfile +within that progspace. + +NAME_REGEXP is a regular expression to filter unwinder names. If +this omitted for a specified locus, then all registered unwinders +in the locus are affected.""" + + def __init__(self): + super(DisableUnwinder, self).__init__("disable unwinder", + gdb.COMMAND_STACK) + + def invoke(self, arg, from_tty): + """GDB calls this to perform the command.""" + do_enable_unwinder(arg, False) + + +def register_unwinder_commands(): + """Installs the unwinder commands.""" + InfoUnwinder() + EnableUnwinder() + DisableUnwinder() + + +register_unwinder_commands() diff --git a/tools/msys/mingw32/share/gdb/python/gdb/command/xmethods.py b/tools/msys/mingw32/share/gdb/python/gdb/command/xmethods.py new file mode 100644 index 0000000000000000000000000000000000000000..41fd8ed49082aa687d5e3599c05854187172628c --- /dev/null +++ b/tools/msys/mingw32/share/gdb/python/gdb/command/xmethods.py @@ -0,0 +1,271 @@ +# Xmethod commands. +# Copyright 2013-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import gdb +import re + +"""GDB commands for working with xmethods.""" + + +def validate_xm_regexp(part_name, regexp): + try: + return re.compile(regexp) + except SyntaxError: + raise SyntaxError("Invalid %s regexp: %s", part_name, regexp) + + +def parse_xm_command_args(arg): + """Parses the arguments passed to a xmethod command. + + Arguments: + arg: The argument string passed to a xmethod command. + + Returns: + A 3-tuple: (<locus matching regular expression>, + <matcher matching regular expression>, + <name matching regular experession>) + """ + argv = gdb.string_to_argv(arg) + argc = len(argv) + if argc > 2: + raise SyntaxError("Too many arguments to command.") + locus_regexp = "" + matcher_name_regexp = "" + xm_name_regexp = None + if argc >= 1: + locus_regexp = argv[0] + if argc == 2: + parts = argv[1].split(";", 1) + matcher_name_regexp = parts[0] + if len(parts) > 1: + xm_name_regexp = parts[1] + if xm_name_regexp: + name_re = validate_xm_regexp("xmethod name", xm_name_regexp) + else: + name_re = None + return (validate_xm_regexp("locus", locus_regexp), + validate_xm_regexp("matcher name", matcher_name_regexp), + name_re) + + +def get_global_method_matchers(locus_re, matcher_re): + """Returns a dict of matching globally registered xmethods. + + Arguments: + locus_re: Even though only globally registered xmethods are + looked up, they will be looked up only if 'global' matches + LOCUS_RE. + matcher_re: The regular expression matching the names of xmethods. + + Returns: + A dict of matching globally registered xmethod matchers. The only + key in the dict will be 'global'. + """ + locus_str = "global" + xm_dict = { locus_str: [] } + if locus_re.match("global"): + xm_dict[locus_str].extend( + [m for m in gdb.xmethods if matcher_re.match(m.name)]) + return xm_dict + + +def get_method_matchers_in_loci(loci, locus_re, matcher_re): + """Returns a dict of matching registered xmethods in the LOCI. + + Arguments: + loci: The list of loci to lookup matching xmethods in. + locus_re: If a locus is an objfile, then xmethod matchers will be + looked up in it only if its filename matches the regular + expression LOCUS_RE. If a locus is the current progspace, + then xmethod matchers will be looked up in it only if the + string "progspace" matches LOCUS_RE. + matcher_re: The regular expression to match the xmethod matcher + names. + + Returns: + A dict of matching xmethod matchers. The keys of the dict are the + filenames of the loci the xmethod matchers belong to. + """ + xm_dict = {} + for locus in loci: + if isinstance(locus, gdb.Progspace): + if not locus_re.match('progspace'): + continue + locus_type = "progspace" + else: + if not locus_re.match(locus.filename): + continue + locus_type = "objfile" + locus_str = "%s %s" % (locus_type, locus.filename) + xm_dict[locus_str] = [ + m for m in locus.xmethods if matcher_re.match(m.name)] + return xm_dict + + +def print_xm_info(xm_dict, name_re): + """Print a dictionary of xmethods.""" + def get_status_string(m): + if not m.enabled: + return " [disabled]" + else: + return "" + + if not xm_dict: + return + for locus_str in xm_dict: + if not xm_dict[locus_str]: + continue + print ("Xmethods in %s:" % locus_str) + for matcher in xm_dict[locus_str]: + print (" %s%s" % (matcher.name, get_status_string(matcher))) + if not matcher.methods: + continue + for m in matcher.methods: + if name_re is None or name_re.match(m.name): + print (" %s%s" % (m.name, get_status_string(m))) + + +def set_xm_status1(xm_dict, name_re, status): + """Set the status (enabled/disabled) of a dictionary of xmethods.""" + for locus_str, matchers in xm_dict.items(): + for matcher in matchers: + if not name_re: + # If the name regex is missing, then set the status of the + # matcher and move on. + matcher.enabled = status + continue + if not matcher.methods: + # The methods attribute could be None. Move on. + continue + for m in matcher.methods: + if name_re.match(m.name): + m.enabled = status + + +def set_xm_status(arg, status): + """Set the status (enabled/disabled) of xmethods matching ARG. + This is a helper function for enable/disable commands. ARG is the + argument string passed to the commands. + """ + locus_re, matcher_re, name_re = parse_xm_command_args(arg) + set_xm_status1(get_global_method_matchers(locus_re, matcher_re), name_re, + status) + set_xm_status1( + get_method_matchers_in_loci( + [gdb.current_progspace()], locus_re, matcher_re), + name_re, + status) + set_xm_status1( + get_method_matchers_in_loci(gdb.objfiles(), locus_re, matcher_re), + name_re, + status) + + +class InfoXMethod(gdb.Command): + """GDB command to list registered xmethod matchers. + +Usage: info xmethod [LOCUS-REGEXP [NAME-REGEXP]] + +LOCUS-REGEXP is a regular expression matching the location of the +xmethod matchers. If it is omitted, all registered xmethod matchers +from all loci are listed. A locus could be 'global', a regular expression +matching the current program space's filename, or a regular expression +matching filenames of objfiles. Locus could be 'progspace' to specify that +only xmethods from the current progspace should be listed. + +NAME-REGEXP is a regular expression matching the names of xmethod +matchers. If this omitted for a specified locus, then all registered +xmethods in the locus are listed. To list only a certain xmethods +managed by a single matcher, the name regexp can be specified as +matcher-name-regexp;xmethod-name-regexp.""" + + def __init__(self): + super(InfoXMethod, self).__init__("info xmethod", + gdb.COMMAND_DATA) + + def invoke(self, arg, from_tty): + locus_re, matcher_re, name_re = parse_xm_command_args(arg) + print_xm_info(get_global_method_matchers(locus_re, matcher_re), + name_re) + print_xm_info( + get_method_matchers_in_loci( + [gdb.current_progspace()], locus_re, matcher_re), + name_re) + print_xm_info( + get_method_matchers_in_loci(gdb.objfiles(), locus_re, matcher_re), + name_re) + + +class EnableXMethod(gdb.Command): + """GDB command to enable a specified (group of) xmethod(s). + +Usage: enable xmethod [LOCUS-REGEXP [NAME-REGEXP]] + +LOCUS-REGEXP is a regular expression matching the location of the +xmethod matchers. If it is omitted, all registered xmethods matchers +from all loci are enabled. A locus could be 'global', a regular expression +matching the current program space's filename, or a regular expression +matching filenames of objfiles. Locus could be 'progspace' to specify that +only xmethods from the current progspace should be enabled. + +NAME-REGEXP is a regular expression matching the names of xmethods +within a given locus. If this omitted for a specified locus, then all +registered xmethod matchers in the locus are enabled. To enable only +a certain xmethods managed by a single matcher, the name regexp can be +specified as matcher-name-regexp;xmethod-name-regexp.""" + + def __init__(self): + super(EnableXMethod, self).__init__("enable xmethod", + gdb.COMMAND_DATA) + + def invoke(self, arg, from_tty): + set_xm_status(arg, True) + + +class DisableXMethod(gdb.Command): + """GDB command to disable a specified (group of) xmethod(s). + +Usage: disable xmethod [LOCUS-REGEXP [NAME-REGEXP]] + +LOCUS-REGEXP is a regular expression matching the location of the +xmethod matchers. If it is omitted, all registered xmethod matchers +from all loci are disabled. A locus could be 'global', a regular +expression matching the current program space's filename, or a regular +expression filenames of objfiles. Locus could be 'progspace' to specify +that only xmethods from the current progspace should be disabled. + +NAME-REGEXP is a regular expression matching the names of xmethods +within a given locus. If this omitted for a specified locus, then all +registered xmethod matchers in the locus are disabled. To disable +only a certain xmethods managed by a single matcher, the name regexp +can be specified as matcher-name-regexp;xmethod-name-regexp.""" + + def __init__(self): + super(DisableXMethod, self).__init__("disable xmethod", + gdb.COMMAND_DATA) + + def invoke(self, arg, from_tty): + set_xm_status(arg, False) + + +def register_xmethod_commands(): + """Installs the xmethod commands.""" + InfoXMethod() + EnableXMethod() + DisableXMethod() + + +register_xmethod_commands() diff --git a/tools/msys/mingw32/share/gdb/python/gdb/frames.py b/tools/msys/mingw32/share/gdb/python/gdb/frames.py new file mode 100644 index 0000000000000000000000000000000000000000..79bea39daa9d428f73485fb441d7d486883d7b3d --- /dev/null +++ b/tools/msys/mingw32/share/gdb/python/gdb/frames.py @@ -0,0 +1,228 @@ +# Frame-filter commands. +# Copyright (C) 2013-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""Internal functions for working with frame-filters.""" + +import gdb +from gdb.FrameIterator import FrameIterator +from gdb.FrameDecorator import FrameDecorator +import itertools +import collections + +def get_priority(filter_item): + """ Internal worker function to return the frame-filter's priority + from a frame filter object. This is a fail free function as it is + used in sorting and filtering. If a badly implemented frame + filter does not implement the priority attribute, return zero + (otherwise sorting/filtering will fail and prevent other frame + filters from executing). + + Arguments: + filter_item: An object conforming to the frame filter + interface. + + Returns: + The priority of the frame filter from the "priority" + attribute, or zero. + """ + # Do not fail here, as the sort will fail. If a filter has not + # (incorrectly) set a priority, set it to zero. + return getattr(filter_item, "priority", 0) + +def set_priority(filter_item, priority): + """ Internal worker function to set the frame-filter's priority. + + Arguments: + filter_item: An object conforming to the frame filter + interface. + priority: The priority to assign as an integer. + """ + + filter_item.priority = priority + +def get_enabled(filter_item): + """ Internal worker function to return a filter's enabled state + from a frame filter object. This is a fail free function as it is + used in sorting and filtering. If a badly implemented frame + filter does not implement the enabled attribute, return False + (otherwise sorting/filtering will fail and prevent other frame + filters from executing). + + Arguments: + filter_item: An object conforming to the frame filter + interface. + + Returns: + The enabled state of the frame filter from the "enabled" + attribute, or False. + """ + + # If the filter class is badly implemented when called from the + # Python filter command, do not cease filter operations, just set + # enabled to False. + return getattr(filter_item, "enabled", False) + +def set_enabled(filter_item, state): + """ Internal Worker function to set the frame-filter's enabled + state. + + Arguments: + filter_item: An object conforming to the frame filter + interface. + state: True or False, depending on desired state. + """ + + filter_item.enabled = state + +def return_list(name): + """ Internal Worker function to return the frame filter + dictionary, depending on the name supplied as an argument. If the + name is not "all", "global" or "progspace", it is assumed to name + an object-file. + + Arguments: + name: The name of the list, as specified by GDB user commands. + + Returns: + A dictionary object for a single specified dictionary, or a + list containing all the items for "all" + + Raises: + gdb.GdbError: A dictionary of that name cannot be found. + """ + + # If all dictionaries are wanted in the case of "all" we + # cannot return a combined dictionary as keys() may clash in + # between different dictionaries. As we just want all the frame + # filters to enable/disable them all, just return the combined + # items() as a chained iterator of dictionary values. + if name == "all": + glob = gdb.frame_filters.values() + prog = gdb.current_progspace().frame_filters.values() + return_iter = itertools.chain(glob, prog) + for objfile in gdb.objfiles(): + return_iter = itertools.chain(return_iter, objfile.frame_filters.values()) + + return return_iter + + if name == "global": + return gdb.frame_filters + else: + if name == "progspace": + cp = gdb.current_progspace() + return cp.frame_filters + else: + for objfile in gdb.objfiles(): + if name == objfile.filename: + return objfile.frame_filters + + msg = "Cannot find frame-filter dictionary for '" + name + "'" + raise gdb.GdbError(msg) + +def _sort_list(): + """ Internal Worker function to merge all known frame-filter + lists, prune any filters with the state set to "disabled", and + sort the list on the frame-filter's "priority" attribute. + + Returns: + sorted_list: A sorted, pruned list of frame filters to + execute. + """ + + all_filters = return_list("all") + sorted_frame_filters = sorted(all_filters, key = get_priority, + reverse = True) + + sorted_frame_filters = filter(get_enabled, + sorted_frame_filters) + + return sorted_frame_filters + +def execute_frame_filters(frame, frame_low, frame_high): + """ Internal function called from GDB that will execute the chain + of frame filters. Each filter is executed in priority order. + After the execution completes, slice the iterator to frame_low - + frame_high range. + + Arguments: + frame: The initial frame. + + frame_low: The low range of the slice. If this is a negative + integer then it indicates a backward slice (ie bt -4) which + counts backward from the last frame in the backtrace. + + frame_high: The high range of the slice. If this is -1 then + it indicates all frames until the end of the stack from + frame_low. + + Returns: + frame_iterator: The sliced iterator after all frame + filters have had a change to execute, or None if no frame + filters are registered. + """ + + # Get a sorted list of frame filters. + sorted_list = list(_sort_list()) + + # Check to see if there are any frame-filters. If not, just + # return None and let default backtrace printing occur. + if len(sorted_list) == 0: + return None + + frame_iterator = FrameIterator(frame) + + # Apply a basic frame decorator to all gdb.Frames. This unifies + # the interface. Python 3.x moved the itertools.imap + # functionality to map(), so check if it is available. + if hasattr(itertools,"imap"): + frame_iterator = itertools.imap(FrameDecorator, frame_iterator) + else: + frame_iterator = map(FrameDecorator, frame_iterator) + + for ff in sorted_list: + frame_iterator = ff.filter(frame_iterator) + + # Slicing + + # Is this a slice from the end of the backtrace, ie bt -2? + if frame_low < 0: + count = 0 + slice_length = abs(frame_low) + # We cannot use MAXLEN argument for deque as it is 2.6 onwards + # and some GDB versions might be < 2.6. + sliced = collections.deque() + + for frame_item in frame_iterator: + if count >= slice_length: + sliced.popleft(); + count = count + 1 + sliced.append(frame_item) + + return iter(sliced) + + # -1 for frame_high means until the end of the backtrace. Set to + # None if that is the case, to indicate to itertools.islice to + # slice to the end of the iterator. + if frame_high == -1: + frame_high = None + else: + # As frames start from 0, add one to frame_high so islice + # correctly finds the end + frame_high = frame_high + 1; + + sliced = itertools.islice(frame_iterator, frame_low, frame_high) + + return sliced diff --git a/tools/msys/mingw32/share/gdb/python/gdb/function/__init__.py b/tools/msys/mingw32/share/gdb/python/gdb/function/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..862ea83bb8df51abe3d1e80439c7241885c685a2 --- /dev/null +++ b/tools/msys/mingw32/share/gdb/python/gdb/function/__init__.py @@ -0,0 +1,14 @@ +# Copyright (C) 2012-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. diff --git a/tools/msys/mingw32/share/gdb/python/gdb/function/as_string.py b/tools/msys/mingw32/share/gdb/python/gdb/function/as_string.py new file mode 100644 index 0000000000000000000000000000000000000000..d17bee61cfcc2f629ed320da2ba953889cb68911 --- /dev/null +++ b/tools/msys/mingw32/share/gdb/python/gdb/function/as_string.py @@ -0,0 +1,37 @@ +# Copyright (C) 2016-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import gdb + + +class _AsString(gdb.Function): + """Return the string representation of a value. + +Usage: $_as_string (VALUE) + +Arguments: + + VALUE: any value + +Returns: + The string representation of the value.""" + + def __init__(self): + super(_AsString, self).__init__("_as_string") + + def invoke(self, val): + return str(val) + +_AsString() diff --git a/tools/msys/mingw32/share/gdb/python/gdb/function/caller_is.py b/tools/msys/mingw32/share/gdb/python/gdb/function/caller_is.py new file mode 100644 index 0000000000000000000000000000000000000000..56e5111ba0ebdcd06f0f03b13cb66a8ce2b5a9d2 --- /dev/null +++ b/tools/msys/mingw32/share/gdb/python/gdb/function/caller_is.py @@ -0,0 +1,152 @@ +# Caller-is functions. +# Copyright (C) 2008-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import gdb +import re + +class CallerIs(gdb.Function): + """Check the calling function's name. + +Usage: $_caller_is (NAME [, NUMBER-OF-FRAMES]) + +Arguments: + + NAME: The name of the function to search for. + + NUMBER-OF-FRAMES: How many stack frames to traverse back from the currently + selected frame to compare with. If the value is greater than the depth of + the stack from that point then the result is False. + The default is 1. + +Returns: + True if the function's name at the specified frame is equal to NAME.""" + + def __init__(self): + super(CallerIs, self).__init__("_caller_is") + + def invoke(self, name, nframes = 1): + if nframes < 0: + raise ValueError("nframes must be >= 0") + frame = gdb.selected_frame() + while nframes > 0: + frame = frame.older() + if frame is None: + return False + nframes = nframes - 1 + return frame.name() == name.string() + +class CallerMatches(gdb.Function): + """Compare the calling function's name with a regexp. + +Usage: $_caller_matches (REGEX [, NUMBER-OF-FRAMES]) + +Arguments: + + REGEX: The regular expression to compare the function's name with. + + NUMBER-OF-FRAMES: How many stack frames to traverse back from the currently + selected frame to compare with. If the value is greater than the depth of + the stack from that point then the result is False. + The default is 1. + +Returns: + True if the function's name at the specified frame matches REGEX.""" + + def __init__(self): + super(CallerMatches, self).__init__("_caller_matches") + + def invoke(self, name, nframes = 1): + if nframes < 0: + raise ValueError("nframes must be >= 0") + frame = gdb.selected_frame() + while nframes > 0: + frame = frame.older() + if frame is None: + return False + nframes = nframes - 1 + return re.match(name.string(), frame.name()) is not None + +class AnyCallerIs(gdb.Function): + """Check all calling function's names. + +Usage: $_any_caller_is (NAME [, NUMBER-OF-FRAMES]) + +Arguments: + + NAME: The name of the function to search for. + + NUMBER-OF-FRAMES: How many stack frames to traverse back from the currently + selected frame to compare with. If the value is greater than the depth of + the stack from that point then the result is False. + The default is 1. + +Returns: + True if any function's name is equal to NAME.""" + + def __init__(self): + super(AnyCallerIs, self).__init__("_any_caller_is") + + def invoke(self, name, nframes = 1): + if nframes < 0: + raise ValueError("nframes must be >= 0") + frame = gdb.selected_frame() + while nframes >= 0: + if frame.name() == name.string(): + return True + frame = frame.older() + if frame is None: + return False + nframes = nframes - 1 + return False + +class AnyCallerMatches(gdb.Function): + """Compare all calling function's names with a regexp. + +Usage: $_any_caller_matches (REGEX [, NUMBER-OF-FRAMES]) + +Arguments: + + REGEX: The regular expression to compare the function's name with. + + NUMBER-OF-FRAMES: How many stack frames to traverse back from the currently + selected frame to compare with. If the value is greater than the depth of + the stack from that point then the result is False. + The default is 1. + +Returns: + True if any function's name matches REGEX.""" + + def __init__(self): + super(AnyCallerMatches, self).__init__("_any_caller_matches") + + def invoke(self, name, nframes = 1): + if nframes < 0: + raise ValueError("nframes must be >= 0") + frame = gdb.selected_frame() + name_re = re.compile(name.string()) + while nframes >= 0: + if name_re.match(frame.name()) is not None: + return True + frame = frame.older() + if frame is None: + return False + nframes = nframes - 1 + return False + +CallerIs() +CallerMatches() +AnyCallerIs() +AnyCallerMatches() diff --git a/tools/msys/mingw32/share/gdb/python/gdb/function/strfns.py b/tools/msys/mingw32/share/gdb/python/gdb/function/strfns.py new file mode 100644 index 0000000000000000000000000000000000000000..7fc7909a381daa1c4417f3d5bd3f84d0392f8bf3 --- /dev/null +++ b/tools/msys/mingw32/share/gdb/python/gdb/function/strfns.py @@ -0,0 +1,100 @@ +# Useful gdb string convenience functions. +# Copyright (C) 2012-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""$_memeq, $_strlen, $_streq, $_regex""" + +import gdb +import re + + +class _MemEq(gdb.Function): + """$_memeq - compare bytes of memory. + +Usage: $_memeq (A, B, LEN) + +Returns: + True if LEN bytes at A and B compare equally.""" + def __init__(self): + super(_MemEq, self).__init__("_memeq") + + def invoke(self, a, b, length): + if length < 0: + raise ValueError("length must be non-negative") + if length == 0: + return True + # The argument(s) to vector are [low_bound,]high_bound. + byte_vector = gdb.lookup_type("char").vector(length - 1) + ptr_byte_vector = byte_vector.pointer() + a_ptr = a.reinterpret_cast(ptr_byte_vector) + b_ptr = b.reinterpret_cast(ptr_byte_vector) + return a_ptr.dereference() == b_ptr.dereference() + + +class _StrLen(gdb.Function): + """$_strlen - compute string length. + +Usage: $_strlen (A) + +Returns: + Length of string A, assumed to be a string in the current language.""" + def __init__(self): + super(_StrLen, self).__init__("_strlen") + + def invoke(self, a): + s = a.string() + return len(s) + + +class _StrEq(gdb.Function): + """$_streq - check string equality. + +Usage: $_streq (A, B) + +Returns: + True if A and B are identical strings in the current language. + +Example (amd64-linux): + catch syscall open + cond $bpnum $_streq((char*) $rdi, "foo")""" + def __init__(self): + super(_StrEq, self).__init__("_streq") + + def invoke(self, a, b): + return a.string() == b.string() + + +class _RegEx(gdb.Function): + """$_regex - check if a string matches a regular expression. + +Usage: $_regex (STRING, REGEX) + +Returns: + True if string STRING (in the current language) matches the + regular expression REGEX.""" + def __init__(self): + super(_RegEx, self).__init__("_regex") + + def invoke(self, string, regex): + s = string.string() + r = re.compile(regex.string()) + return bool(r.match(s)) + + +# GDB will import us automagically via gdb/__init__.py. +_MemEq() +_StrLen() +_StrEq() +_RegEx() diff --git a/tools/msys/mingw32/share/gdb/python/gdb/printer/__init__.py b/tools/msys/mingw32/share/gdb/python/gdb/printer/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..0260aee76382b49feec47e403b324ad93c48880d --- /dev/null +++ b/tools/msys/mingw32/share/gdb/python/gdb/printer/__init__.py @@ -0,0 +1,14 @@ +# Copyright (C) 2014-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. diff --git a/tools/msys/mingw32/share/gdb/python/gdb/printer/bound_registers.py b/tools/msys/mingw32/share/gdb/python/gdb/printer/bound_registers.py new file mode 100644 index 0000000000000000000000000000000000000000..1eb0e8136d32ad4d42dae6d9cc159ac2de109a7e --- /dev/null +++ b/tools/msys/mingw32/share/gdb/python/gdb/printer/bound_registers.py @@ -0,0 +1,43 @@ +# Pretty-printers for bounds registers. +# Copyright (C) 2013-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import sys + +import gdb.printing + +if sys.version_info[0] > 2: + # Python 3 removed basestring and long + basestring = str + long = int + +class MpxBound128Printer: + """Adds size field to a mpx __gdb_builtin_type_bound128 type.""" + + def __init__ (self, val): + self.val = val + + def to_string (self): + upper = self.val["ubound"] + lower = self.val["lbound"] + size = (long) ((upper) - (lower)) + if size > -1: + size = size + 1 + result = '{lbound = %s, ubound = %s} : size %s' % (lower, upper, size) + return result + +gdb.printing.add_builtin_pretty_printer ('mpx_bound128', + '^builtin_type_bound128', + MpxBound128Printer) diff --git a/tools/msys/mingw32/share/gdb/python/gdb/printing.py b/tools/msys/mingw32/share/gdb/python/gdb/printing.py new file mode 100644 index 0000000000000000000000000000000000000000..9367b439a08f6e2de92ae113077070acae5141c7 --- /dev/null +++ b/tools/msys/mingw32/share/gdb/python/gdb/printing.py @@ -0,0 +1,285 @@ +# Pretty-printer utilities. +# Copyright (C) 2010-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""Utilities for working with pretty-printers.""" + +import gdb +import gdb.types +import re +import sys + +if sys.version_info[0] > 2: + # Python 3 removed basestring and long + basestring = str + long = int + +class PrettyPrinter(object): + """A basic pretty-printer. + + Attributes: + name: A unique string among all printers for the context in which + it is defined (objfile, progspace, or global(gdb)), and should + meaningfully describe what can be pretty-printed. + E.g., "StringPiece" or "protobufs". + subprinters: An iterable object with each element having a `name' + attribute, and, potentially, "enabled" attribute. + Or this is None if there are no subprinters. + enabled: A boolean indicating if the printer is enabled. + + Subprinters are for situations where "one" pretty-printer is actually a + collection of several printers. E.g., The libstdc++ pretty-printer has + a pretty-printer for each of several different types, based on regexps. + """ + + # While one might want to push subprinters into the subclass, it's + # present here to formalize such support to simplify + # commands/pretty_printers.py. + + def __init__(self, name, subprinters=None): + self.name = name + self.subprinters = subprinters + self.enabled = True + + def __call__(self, val): + # The subclass must define this. + raise NotImplementedError("PrettyPrinter __call__") + + +class SubPrettyPrinter(object): + """Baseclass for sub-pretty-printers. + + Sub-pretty-printers needn't use this, but it formalizes what's needed. + + Attributes: + name: The name of the subprinter. + enabled: A boolean indicating if the subprinter is enabled. + """ + + def __init__(self, name): + self.name = name + self.enabled = True + + +def register_pretty_printer(obj, printer, replace=False): + """Register pretty-printer PRINTER with OBJ. + + The printer is added to the front of the search list, thus one can override + an existing printer if one needs to. Use a different name when overriding + an existing printer, otherwise an exception will be raised; multiple + printers with the same name are disallowed. + + Arguments: + obj: Either an objfile, progspace, or None (in which case the printer + is registered globally). + printer: Either a function of one argument (old way) or any object + which has attributes: name, enabled, __call__. + replace: If True replace any existing copy of the printer. + Otherwise if the printer already exists raise an exception. + + Returns: + Nothing. + + Raises: + TypeError: A problem with the type of the printer. + ValueError: The printer's name contains a semicolon ";". + RuntimeError: A printer with the same name is already registered. + + If the caller wants the printer to be listable and disableable, it must + follow the PrettyPrinter API. This applies to the old way (functions) too. + If printer is an object, __call__ is a method of two arguments: + self, and the value to be pretty-printed. See PrettyPrinter. + """ + + # Watch for both __name__ and name. + # Functions get the former for free, but we don't want to use an + # attribute named __foo__ for pretty-printers-as-objects. + # If printer has both, we use `name'. + if not hasattr(printer, "__name__") and not hasattr(printer, "name"): + raise TypeError("printer missing attribute: name") + if hasattr(printer, "name") and not hasattr(printer, "enabled"): + raise TypeError("printer missing attribute: enabled") + if not hasattr(printer, "__call__"): + raise TypeError("printer missing attribute: __call__") + + if hasattr(printer, "name"): + name = printer.name + else: + name = printer.__name__ + if obj is None or obj is gdb: + if gdb.parameter("verbose"): + gdb.write("Registering global %s pretty-printer ...\n" % name) + obj = gdb + else: + if gdb.parameter("verbose"): + gdb.write("Registering %s pretty-printer for %s ...\n" % ( + name, obj.filename)) + + # Printers implemented as functions are old-style. In order to not risk + # breaking anything we do not check __name__ here. + if hasattr(printer, "name"): + if not isinstance(printer.name, basestring): + raise TypeError("printer name is not a string") + # If printer provides a name, make sure it doesn't contain ";". + # Semicolon is used by the info/enable/disable pretty-printer commands + # to delimit subprinters. + if printer.name.find(";") >= 0: + raise ValueError("semicolon ';' in printer name") + # Also make sure the name is unique. + # Alas, we can't do the same for functions and __name__, they could + # all have a canonical name like "lookup_function". + # PERF: gdb records printers in a list, making this inefficient. + i = 0 + for p in obj.pretty_printers: + if hasattr(p, "name") and p.name == printer.name: + if replace: + del obj.pretty_printers[i] + break + else: + raise RuntimeError("pretty-printer already registered: %s" % + printer.name) + i = i + 1 + + obj.pretty_printers.insert(0, printer) + + +class RegexpCollectionPrettyPrinter(PrettyPrinter): + """Class for implementing a collection of regular-expression based pretty-printers. + + Intended usage: + + pretty_printer = RegexpCollectionPrettyPrinter("my_library") + pretty_printer.add_printer("myclass1", "^myclass1$", MyClass1Printer) + ... + pretty_printer.add_printer("myclassN", "^myclassN$", MyClassNPrinter) + register_pretty_printer(obj, pretty_printer) + """ + + class RegexpSubprinter(SubPrettyPrinter): + def __init__(self, name, regexp, gen_printer): + super(RegexpCollectionPrettyPrinter.RegexpSubprinter, self).__init__(name) + self.regexp = regexp + self.gen_printer = gen_printer + self.compiled_re = re.compile(regexp) + + def __init__(self, name): + super(RegexpCollectionPrettyPrinter, self).__init__(name, []) + + def add_printer(self, name, regexp, gen_printer): + """Add a printer to the list. + + The printer is added to the end of the list. + + Arguments: + name: The name of the subprinter. + regexp: The regular expression, as a string. + gen_printer: A function/method that given a value returns an + object to pretty-print it. + + Returns: + Nothing. + """ + + # NOTE: A previous version made the name of each printer the regexp. + # That makes it awkward to pass to the enable/disable commands (it's + # cumbersome to make a regexp of a regexp). So now the name is a + # separate parameter. + + self.subprinters.append(self.RegexpSubprinter(name, regexp, + gen_printer)) + + def __call__(self, val): + """Lookup the pretty-printer for the provided value.""" + + # Get the type name. + typename = gdb.types.get_basic_type(val.type).tag + if not typename: + typename = val.type.name + if not typename: + return None + + # Iterate over table of type regexps to determine + # if a printer is registered for that type. + # Return an instantiation of the printer if found. + for printer in self.subprinters: + if printer.enabled and printer.compiled_re.search(typename): + return printer.gen_printer(val) + + # Cannot find a pretty printer. Return None. + return None + +# A helper class for printing enum types. This class is instantiated +# with a list of enumerators to print a particular Value. +class _EnumInstance: + def __init__(self, enumerators, val): + self.enumerators = enumerators + self.val = val + + def to_string(self): + flag_list = [] + v = long(self.val) + any_found = False + for (e_name, e_value) in self.enumerators: + if v & e_value != 0: + flag_list.append(e_name) + v = v & ~e_value + any_found = True + if not any_found or v != 0: + # Leftover value. + flag_list.append('<unknown: 0x%x>' % v) + return "0x%x [%s]" % (int(self.val), " | ".join(flag_list)) + +class FlagEnumerationPrinter(PrettyPrinter): + """A pretty-printer which can be used to print a flag-style enumeration. + A flag-style enumeration is one where the enumerators are or'd + together to create values. The new printer will print these + symbolically using '|' notation. The printer must be registered + manually. This printer is most useful when an enum is flag-like, + but has some overlap. GDB's built-in printing will not handle + this case, but this printer will attempt to.""" + + def __init__(self, enum_type): + super(FlagEnumerationPrinter, self).__init__(enum_type) + self.initialized = False + + def __call__(self, val): + if not self.initialized: + self.initialized = True + flags = gdb.lookup_type(self.name) + self.enumerators = [] + for field in flags.fields(): + self.enumerators.append((field.name, field.enumval)) + # Sorting the enumerators by value usually does the right + # thing. + self.enumerators.sort(key = lambda x: x[1]) + + if self.enabled: + return _EnumInstance(self.enumerators, val) + else: + return None + + +# Builtin pretty-printers. +# The set is defined as empty, and files in printing/*.py add their printers +# to this with add_builtin_pretty_printer. + +_builtin_pretty_printers = RegexpCollectionPrettyPrinter("builtin") + +register_pretty_printer(None, _builtin_pretty_printers) + +# Add a builtin pretty-printer. + +def add_builtin_pretty_printer(name, regexp, printer): + _builtin_pretty_printers.add_printer(name, regexp, printer) diff --git a/tools/msys/mingw32/share/gdb/python/gdb/prompt.py b/tools/msys/mingw32/share/gdb/python/gdb/prompt.py new file mode 100644 index 0000000000000000000000000000000000000000..a299674d0b9b23f3a3fa944066433aa0c91f79d6 --- /dev/null +++ b/tools/msys/mingw32/share/gdb/python/gdb/prompt.py @@ -0,0 +1,148 @@ +# Extended prompt utilities. +# Copyright (C) 2011-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +""" Extended prompt library functions.""" + +import gdb +import os + +def _prompt_pwd(ignore): + "The current working directory." + return os.getcwd() + +def _prompt_object_attr(func, what, attr, nattr): + """Internal worker for fetching GDB attributes.""" + if attr is None: + attr = nattr + try: + obj = func() + except gdb.error: + return '<no %s>' % what + if hasattr(obj, attr): + result = getattr(obj, attr) + if callable(result): + result = result() + return result + else: + return '<no attribute %s on current %s>' % (attr, what) + +def _prompt_frame(attr): + "The selected frame; an argument names a frame parameter." + return _prompt_object_attr(gdb.selected_frame, 'frame', attr, 'name') + +def _prompt_thread(attr): + "The selected thread; an argument names a thread parameter." + return _prompt_object_attr(gdb.selected_thread, 'thread', attr, 'num') + +def _prompt_version(attr): + "The version of GDB." + return gdb.VERSION + +def _prompt_esc(attr): + "The ESC character." + return '\033' + +def _prompt_bs(attr): + "A backslash." + return '\\' + +def _prompt_n(attr): + "A newline." + return '\n' + +def _prompt_r(attr): + "A carriage return." + return '\r' + +def _prompt_param(attr): + "A parameter's value; the argument names the parameter." + return gdb.parameter(attr) + +def _prompt_noprint_begin(attr): + "Begins a sequence of non-printing characters." + return '\001' + +def _prompt_noprint_end(attr): + "Ends a sequence of non-printing characters." + return '\002' + +prompt_substitutions = { + 'e': _prompt_esc, + '\\': _prompt_bs, + 'n': _prompt_n, + 'r': _prompt_r, + 'v': _prompt_version, + 'w': _prompt_pwd, + 'f': _prompt_frame, + 't': _prompt_thread, + 'p': _prompt_param, + '[': _prompt_noprint_begin, + ']': _prompt_noprint_end +} + +def prompt_help(): + """Generate help dynamically from the __doc__ strings of attribute + functions.""" + + result = '' + keys = sorted (prompt_substitutions.keys()) + for key in keys: + result += ' \\%s\t%s\n' % (key, prompt_substitutions[key].__doc__) + result += """ +A substitution can be used in a simple form, like "\\f". +An argument can also be passed to it, like "\\f{name}". +The meaning of the argument depends on the particular substitution.""" + return result + +def substitute_prompt(prompt): + "Perform substitutions on PROMPT." + + result = '' + plen = len(prompt) + i = 0 + while i < plen: + if prompt[i] == '\\': + i = i + 1 + if i >= plen: + break + cmdch = prompt[i] + + if cmdch in prompt_substitutions: + cmd = prompt_substitutions[cmdch] + + if i + 1 < plen and prompt[i + 1] == '{': + j = i + 1 + while j < plen and prompt[j] != '}': + j = j + 1 + # Just ignore formatting errors. + if j >= plen or prompt[j] != '}': + arg = None + else: + arg = prompt[i + 2 : j] + i = j + else: + arg = None + result += str(cmd(arg)) + else: + # Unrecognized escapes are turned into the escaped + # character itself. + result += prompt[i] + else: + result += prompt[i] + + i = i + 1 + + return result diff --git a/tools/msys/mingw32/share/gdb/python/gdb/types.py b/tools/msys/mingw32/share/gdb/python/gdb/types.py new file mode 100644 index 0000000000000000000000000000000000000000..8d37f12070e6999efed8603dd37c56246f689a32 --- /dev/null +++ b/tools/msys/mingw32/share/gdb/python/gdb/types.py @@ -0,0 +1,178 @@ +# Type utilities. +# Copyright (C) 2010-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""Utilities for working with gdb.Types.""" + +import gdb + + +def get_basic_type(type_): + """Return the "basic" type of a type. + + Arguments: + type_: The type to reduce to its basic type. + + Returns: + type_ with const/volatile is stripped away, + and typedefs/references converted to the underlying type. + """ + + while (type_.code == gdb.TYPE_CODE_REF or + type_.code == gdb.TYPE_CODE_RVALUE_REF or + type_.code == gdb.TYPE_CODE_TYPEDEF): + if (type_.code == gdb.TYPE_CODE_REF or + type_.code == gdb.TYPE_CODE_RVALUE_REF): + type_ = type_.target() + else: + type_ = type_.strip_typedefs() + return type_.unqualified() + + +def has_field(type_, field): + """Return True if a type has the specified field. + + Arguments: + type_: The type to examine. + It must be one of gdb.TYPE_CODE_STRUCT, gdb.TYPE_CODE_UNION. + field: The name of the field to look up. + + Returns: + True if the field is present either in type_ or any baseclass. + + Raises: + TypeError: The type is not a struct or union. + """ + + type_ = get_basic_type(type_) + if (type_.code != gdb.TYPE_CODE_STRUCT and + type_.code != gdb.TYPE_CODE_UNION): + raise TypeError("not a struct or union") + for f in type_.fields(): + if f.is_base_class: + if has_field(f.type, field): + return True + else: + # NOTE: f.name could be None + if f.name == field: + return True + return False + + +def make_enum_dict(enum_type): + """Return a dictionary from a program's enum type. + + Arguments: + enum_type: The enum to compute the dictionary for. + + Returns: + The dictionary of the enum. + + Raises: + TypeError: The type is not an enum. + """ + + if enum_type.code != gdb.TYPE_CODE_ENUM: + raise TypeError("not an enum type") + enum_dict = {} + for field in enum_type.fields(): + # The enum's value is stored in "enumval". + enum_dict[field.name] = field.enumval + return enum_dict + + +def deep_items (type_): + """Return an iterator that recursively traverses anonymous fields. + + Arguments: + type_: The type to traverse. It should be one of + gdb.TYPE_CODE_STRUCT or gdb.TYPE_CODE_UNION. + + Returns: + an iterator similar to gdb.Type.iteritems(), i.e., it returns + pairs of key, value, but for any anonymous struct or union + field that field is traversed recursively, depth-first. + """ + for k, v in type_.iteritems (): + if k: + yield k, v + else: + for i in deep_items (v.type): + yield i + +class TypePrinter(object): + """The base class for type printers. + + Instances of this type can be used to substitute type names during + 'ptype'. + + A type printer must have at least 'name' and 'enabled' attributes, + and supply an 'instantiate' method. + + The 'instantiate' method must either return None, or return an + object which has a 'recognize' method. This method must accept a + gdb.Type argument and either return None, meaning that the type + was not recognized, or a string naming the type. + """ + + def __init__(self, name): + self.name = name + self.enabled = True + + def instantiate(self): + return None + +# Helper function for computing the list of type recognizers. +def _get_some_type_recognizers(result, plist): + for printer in plist: + if printer.enabled: + inst = printer.instantiate() + if inst is not None: + result.append(inst) + return None + +def get_type_recognizers(): + "Return a list of the enabled type recognizers for the current context." + result = [] + + # First try the objfiles. + for objfile in gdb.objfiles(): + _get_some_type_recognizers(result, objfile.type_printers) + # Now try the program space. + _get_some_type_recognizers(result, gdb.current_progspace().type_printers) + # Finally, globals. + _get_some_type_recognizers(result, gdb.type_printers) + + return result + +def apply_type_recognizers(recognizers, type_obj): + """Apply the given list of type recognizers to the type TYPE_OBJ. + If any recognizer in the list recognizes TYPE_OBJ, returns the name + given by the recognizer. Otherwise, this returns None.""" + for r in recognizers: + result = r.recognize(type_obj) + if result is not None: + return result + return None + +def register_type_printer(locus, printer): + """Register a type printer. + PRINTER is the type printer instance. + LOCUS is either an objfile, a program space, or None, indicating + global registration.""" + + if locus is None: + locus = gdb + locus.type_printers.insert(0, printer) diff --git a/tools/msys/mingw32/share/gdb/python/gdb/unwinder.py b/tools/msys/mingw32/share/gdb/python/gdb/unwinder.py new file mode 100644 index 0000000000000000000000000000000000000000..7eadbd646b6fe5fcbedd00f30b1608290bc53978 --- /dev/null +++ b/tools/msys/mingw32/share/gdb/python/gdb/unwinder.py @@ -0,0 +1,95 @@ +# Copyright (C) 2015-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""Unwinder class and register_unwinder function.""" + +import gdb + + +class Unwinder(object): + """Base class (or a template) for frame unwinders written in Python. + + An unwinder has a single method __call__ and the attributes + described below. + + Attributes: + name: The name of the unwinder. + enabled: A boolean indicating whether the unwinder is enabled. + """ + + def __init__(self, name): + """Constructor. + + Args: + name: An identifying name for the unwinder. + """ + self.name = name + self.enabled = True + + def __call__(self, pending_frame): + """GDB calls this method to unwind a frame. + + Arguments: + pending_frame: gdb.PendingFrame instance. + + Returns: + gdb.UnwindInfo instance. + """ + raise NotImplementedError("Unwinder __call__.") + + +def register_unwinder(locus, unwinder, replace=False): + """Register unwinder in given locus. + + The unwinder is prepended to the locus's unwinders list. Unwinder + name should be unique. + + Arguments: + locus: Either an objfile, progspace, or None (in which case + the unwinder is registered globally). + unwinder: An object of a gdb.Unwinder subclass + replace: If True, replaces existing unwinder with the same name. + Otherwise, raises exception if unwinder with the same + name already exists. + + Returns: + Nothing. + + Raises: + RuntimeError: Unwinder name is not unique + TypeError: Bad locus type + """ + if locus is None: + if gdb.parameter("verbose"): + gdb.write("Registering global %s unwinder ...\n" % unwinder.name) + locus = gdb + elif isinstance(locus, gdb.Objfile) or isinstance(locus, gdb.Progspace): + if gdb.parameter("verbose"): + gdb.write("Registering %s unwinder for %s ...\n" % + (unwinder.name, locus.filename)) + else: + raise TypeError("locus should be gdb.Objfile or gdb.Progspace or None") + + i = 0 + for needle in locus.frame_unwinders: + if needle.name == unwinder.name: + if replace: + del locus.frame_unwinders[i] + else: + raise RuntimeError("Unwinder %s already exists." % + unwinder.name) + i += 1 + locus.frame_unwinders.insert(0, unwinder) + gdb.invalidate_cached_frames() diff --git a/tools/msys/mingw32/share/gdb/python/gdb/xmethod.py b/tools/msys/mingw32/share/gdb/python/gdb/xmethod.py new file mode 100644 index 0000000000000000000000000000000000000000..afc12a07d756a4589e04a9d43fef2f46474551ce --- /dev/null +++ b/tools/msys/mingw32/share/gdb/python/gdb/xmethod.py @@ -0,0 +1,275 @@ +# Python side of the support for xmethods. +# Copyright (C) 2013-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""Utilities for defining xmethods""" + +import gdb +import re +import sys + + +if sys.version_info[0] > 2: + # Python 3 removed basestring and long + basestring = str + long = int + + +class XMethod(object): + """Base class (or a template) for an xmethod description. + + Currently, the description requires only the 'name' and 'enabled' + attributes. Description objects are managed by 'XMethodMatcher' + objects (see below). Note that this is only a template for the + interface of the XMethodMatcher.methods objects. One could use + this class or choose to use an object which supports this exact same + interface. Also, an XMethodMatcher can choose not use it 'methods' + attribute. In such cases this class (or an equivalent) is not used. + + Attributes: + name: The name of the xmethod. + enabled: A boolean indicating if the xmethod is enabled. + """ + + def __init__(self, name): + self.name = name + self.enabled = True + + +class XMethodMatcher(object): + """Abstract base class for matching an xmethod. + + When looking for xmethods, GDB invokes the `match' method of a + registered xmethod matcher to match the object type and method name. + The `match' method in concrete classes derived from this class should + return an `XMethodWorker' object, or a list of `XMethodWorker' + objects if there is a match (see below for 'XMethodWorker' class). + + Attributes: + name: The name of the matcher. + enabled: A boolean indicating if the matcher is enabled. + methods: A sequence of objects of type 'XMethod', or objects + which have at least the attributes of an 'XMethod' object. + This list is used by the 'enable'/'disable'/'info' commands to + enable/disable/list the xmethods registered with GDB. See + the 'match' method below to know how this sequence is used. + This attribute is None if the matcher chooses not have any + xmethods managed by it. + """ + + def __init__(self, name): + """ + Args: + name: An identifying name for the xmethod or the group of + xmethods returned by the `match' method. + """ + self.name = name + self.enabled = True + self.methods = None + + def match(self, class_type, method_name): + """Match class type and method name. + + In derived classes, it should return an XMethodWorker object, or a + sequence of 'XMethodWorker' objects. Only those xmethod workers + whose corresponding 'XMethod' descriptor object is enabled should be + returned. + + Args: + class_type: The class type (gdb.Type object) to match. + method_name: The name (string) of the method to match. + """ + raise NotImplementedError("XMethodMatcher match") + + +class XMethodWorker(object): + """Base class for all xmethod workers defined in Python. + + An xmethod worker is an object which matches the method arguments, and + invokes the method when GDB wants it to. Internally, GDB first invokes the + 'get_arg_types' method to perform overload resolution. If GDB selects to + invoke this Python xmethod, then it invokes it via the overridden + '__call__' method. The 'get_result_type' method is used to implement + 'ptype' on the xmethod. + + Derived classes should override the 'get_arg_types', 'get_result_type' + and '__call__' methods. + """ + + def get_arg_types(self): + """Return arguments types of an xmethod. + + A sequence of gdb.Type objects corresponding to the arguments of the + xmethod are returned. If the xmethod takes no arguments, then 'None' + or an empty sequence is returned. If the xmethod takes only a single + argument, then a gdb.Type object or a sequence with a single gdb.Type + element is returned. + """ + raise NotImplementedError("XMethodWorker get_arg_types") + + def get_result_type(self, *args): + """Return the type of the result of the xmethod. + + Args: + args: Arguments to the method. Each element of the tuple is a + gdb.Value object. The first element is the 'this' pointer + value. These are the same arguments passed to '__call__'. + + Returns: + A gdb.Type object representing the type of the result of the + xmethod. + """ + raise NotImplementedError("XMethodWorker get_result_type") + + def __call__(self, *args): + """Invoke the xmethod. + + Args: + args: Arguments to the method. Each element of the tuple is a + gdb.Value object. The first element is the 'this' pointer + value. + + Returns: + A gdb.Value corresponding to the value returned by the xmethod. + Returns 'None' if the method does not return anything. + """ + raise NotImplementedError("XMethodWorker __call__") + + +class SimpleXMethodMatcher(XMethodMatcher): + """A utility class to implement simple xmethod mathers and workers. + + See the __init__ method below for information on how instances of this + class can be used. + + For simple classes and methods, one can choose to use this class. For + complex xmethods, which need to replace/implement template methods on + possibly template classes, one should implement their own xmethod + matchers and workers. See py-xmethods.py in testsuite/gdb.python + directory of the GDB source tree for examples. + """ + + class SimpleXMethodWorker(XMethodWorker): + def __init__(self, method_function, arg_types): + self._arg_types = arg_types + self._method_function = method_function + + def get_arg_types(self): + return self._arg_types + + def __call__(self, *args): + return self._method_function(*args) + + + def __init__(self, name, class_matcher, method_matcher, method_function, + *arg_types): + """ + Args: + name: Name of the xmethod matcher. + class_matcher: A regular expression used to match the name of the + class whose method this xmethod is implementing/replacing. + method_matcher: A regular expression used to match the name of the + method this xmethod is implementing/replacing. + method_function: A Python callable which would be called via the + 'invoke' method of the worker returned by the objects of this + class. This callable should accept the object (*this) as the + first argument followed by the rest of the arguments to the + method. All arguments to this function should be gdb.Value + objects. + arg_types: The gdb.Type objects corresponding to the arguments that + this xmethod takes. It can be None, or an empty sequence, + or a single gdb.Type object, or a sequence of gdb.Type objects. + """ + XMethodMatcher.__init__(self, name) + assert callable(method_function), ( + "The 'method_function' argument to 'SimpleXMethodMatcher' " + "__init__ method should be a callable.") + self._method_function = method_function + self._class_matcher = class_matcher + self._method_matcher = method_matcher + self._arg_types = arg_types + + def match(self, class_type, method_name): + cm = re.match(self._class_matcher, str(class_type.unqualified().tag)) + mm = re.match(self._method_matcher, method_name) + if cm and mm: + return SimpleXMethodMatcher.SimpleXMethodWorker( + self._method_function, self._arg_types) + + +# A helper function for register_xmethod_matcher which returns an error +# object if MATCHER is not having the requisite attributes in the proper +# format. + +def _validate_xmethod_matcher(matcher): + if not hasattr(matcher, "match"): + return TypeError("Xmethod matcher is missing method: match") + if not hasattr(matcher, "name"): + return TypeError("Xmethod matcher is missing attribute: name") + if not hasattr(matcher, "enabled"): + return TypeError("Xmethod matcher is missing attribute: enabled") + if not isinstance(matcher.name, basestring): + return TypeError("Attribute 'name' of xmethod matcher is not a " + "string") + if matcher.name.find(";") >= 0: + return ValueError("Xmethod matcher name cannot contain ';' in it") + + +# A helper function for register_xmethod_matcher which looks up an +# xmethod matcher with NAME in LOCUS. Returns the index of the xmethod +# matcher in 'xmethods' sequence attribute of the LOCUS. If NAME is not +# found in LOCUS, then -1 is returned. + +def _lookup_xmethod_matcher(locus, name): + for i in range(0, len(locus.xmethods)): + if locus.xmethods[i].name == name: + return i + return -1 + + +def register_xmethod_matcher(locus, matcher, replace=False): + """Registers a xmethod matcher MATCHER with a LOCUS. + + Arguments: + locus: The locus in which the xmethods should be registered. + It can be 'None' to indicate that the xmethods should be + registered globally. Or, it could be a gdb.Objfile or a + gdb.Progspace object in which the xmethods should be + registered. + matcher: The xmethod matcher to register with the LOCUS. It + should be an instance of 'XMethodMatcher' class. + replace: If True, replace any existing xmethod matcher with the + same name in the locus. Otherwise, if a matcher with the same name + exists in the locus, raise an exception. + """ + err = _validate_xmethod_matcher(matcher) + if err: + raise err + if not locus: + locus = gdb + if locus == gdb: + locus_name = "global" + else: + locus_name = locus.filename + index = _lookup_xmethod_matcher(locus, matcher.name) + if index >= 0: + if replace: + del locus.xmethods[index] + else: + raise RuntimeError("Xmethod matcher already registered with " + "%s: %s" % (locus_name, matcher.name)) + if gdb.parameter("verbose"): + gdb.write("Registering xmethod matcher '%s' with %s' ...\n") + locus.xmethods.insert(0, matcher) diff --git a/tools/msys/mingw32/share/gdb/syscalls/aarch64-linux.xml b/tools/msys/mingw32/share/gdb/syscalls/aarch64-linux.xml new file mode 100644 index 0000000000000000000000000000000000000000..2c4883a042c6860fc35235f577334fb41b99a43c --- /dev/null +++ b/tools/msys/mingw32/share/gdb/syscalls/aarch64-linux.xml @@ -0,0 +1,269 @@ +<?xml version="1.0"?> +<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd"> +<!-- Copyright (C) 2015-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. This file is offered as-is, + without any warranty. --> +<syscalls_info> + <syscall name="io_setup" number="0"/> + <syscall name="io_destroy" number="1"/> + <syscall name="io_submit" number="2"/> + <syscall name="io_cancel" number="3"/> + <syscall name="io_getevents" number="4"/> + <syscall name="setxattr" number="5" groups="file"/> + <syscall name="lsetxattr" number="6" groups="file"/> + <syscall name="fsetxattr" number="7" groups="descriptor"/> + <syscall name="getxattr" number="8" groups="file"/> + <syscall name="lgetxattr" number="9" groups="file"/> + <syscall name="fgetxattr" number="10" groups="descriptor"/> + <syscall name="listxattr" number="11" groups="file"/> + <syscall name="llistxattr" number="12" groups="file"/> + <syscall name="flistxattr" number="13" groups="descriptor"/> + <syscall name="removexattr" number="14" groups="file"/> + <syscall name="lremovexattr" number="15" groups="file"/> + <syscall name="fremovexattr" number="16" groups="descriptor"/> + <syscall name="getcwd" number="17" groups="file"/> + <syscall name="lookup_dcookie" number="18"/> + <syscall name="eventfd2" number="19" groups="descriptor"/> + <syscall name="epoll_create1" number="20" groups="descriptor"/> + <syscall name="epoll_ctl" number="21" groups="descriptor"/> + <syscall name="epoll_pwait" number="22" groups="descriptor"/> + <syscall name="dup" number="23" groups="descriptor"/> + <syscall name="dup3" number="24" groups="descriptor"/> + <syscall name="fcntl" number="25" groups="descriptor"/> + <syscall name="inotify_init1" number="26" groups="descriptor"/> + <syscall name="inotify_add_watch" number="27" groups="descriptor"/> + <syscall name="inotify_rm_watch" number="28" groups="descriptor"/> + <syscall name="ioctl" number="29" groups="descriptor"/> + <syscall name="ioprio_set" number="30"/> + <syscall name="ioprio_get" number="31"/> + <syscall name="flock" number="32" groups="descriptor"/> + <syscall name="mknodat" number="33" groups="descriptor,file"/> + <syscall name="mkdirat" number="34" groups="descriptor,file"/> + <syscall name="unlinkat" number="35" groups="descriptor,file"/> + <syscall name="symlinkat" number="36" groups="descriptor,file"/> + <syscall name="linkat" number="37" groups="descriptor,file"/> + <syscall name="renameat" number="38" groups="descriptor,file"/> + <syscall name="umount2" number="39" groups="file"/> + <syscall name="mount" number="40" groups="file"/> + <syscall name="pivot_root" number="41" groups="file"/> + <syscall name="nfsservctl" number="42"/> + <syscall name="statfs" number="43" groups="file"/> + <syscall name="fstatfs" number="44" groups="descriptor"/> + <syscall name="truncate" number="45" groups="file"/> + <syscall name="ftruncate" number="46" groups="descriptor"/> + <syscall name="fallocate" number="47" groups="descriptor"/> + <syscall name="faccessat" number="48" groups="descriptor,file"/> + <syscall name="chdir" number="49" groups="file"/> + <syscall name="fchdir" number="50" groups="descriptor"/> + <syscall name="chroot" number="51" groups="file"/> + <syscall name="fchmod" number="52" groups="descriptor"/> + <syscall name="fchmodat" number="53" groups="descriptor,file"/> + <syscall name="fchownat" number="54" groups="descriptor,file"/> + <syscall name="fchown" number="55" groups="descriptor"/> + <syscall name="openat" number="56" groups="descriptor,file"/> + <syscall name="close" number="57" groups="descriptor"/> + <syscall name="vhangup" number="58"/> + <syscall name="pipe2" number="59" groups="descriptor"/> + <syscall name="quotactl" number="60" groups="file"/> + <syscall name="getdents64" number="61" groups="descriptor"/> + <syscall name="lseek" number="62" groups="descriptor"/> + <syscall name="read" number="63" groups="descriptor"/> + <syscall name="write" number="64" groups="descriptor"/> + <syscall name="readv" number="65" groups="descriptor"/> + <syscall name="writev" number="66" groups="descriptor"/> + <syscall name="pread64" number="67" groups="descriptor"/> + <syscall name="pwrite64" number="68" groups="descriptor"/> + <syscall name="preadv" number="69" groups="descriptor"/> + <syscall name="pwritev" number="70" groups="descriptor"/> + <syscall name="sendfile" number="71" groups="descriptor,network"/> + <syscall name="pselect6" number="72" groups="descriptor"/> + <syscall name="ppoll" number="73" groups="descriptor"/> + <syscall name="signalfd4" number="74" groups="descriptor,signal"/> + <syscall name="vmsplice" number="75" groups="descriptor"/> + <syscall name="splice" number="76" groups="descriptor"/> + <syscall name="tee" number="77" groups="descriptor"/> + <syscall name="readlinkat" number="78" groups="descriptor,file"/> + <syscall name="newfstatat" number="79" groups="descriptor,file"/> + <syscall name="fstat" number="80" groups="descriptor"/> + <syscall name="sync" number="81"/> + <syscall name="fsync" number="82" groups="descriptor"/> + <syscall name="fdatasync" number="83" groups="descriptor"/> + <syscall name="sync_file_range" number="84" groups="descriptor"/> + <syscall name="timerfd_create" number="85" groups="descriptor"/> + <syscall name="timerfd_settime" number="86" groups="descriptor"/> + <syscall name="timerfd_gettime" number="87" groups="descriptor"/> + <syscall name="utimensat" number="88" groups="descriptor,file"/> + <syscall name="acct" number="89" groups="file"/> + <syscall name="capget" number="90"/> + <syscall name="capset" number="91"/> + <syscall name="personality" number="92"/> + <syscall name="exit" number="93" groups="process"/> + <syscall name="exit_group" number="94" groups="process"/> + <syscall name="waitid" number="95" groups="process"/> + <syscall name="set_tid_address" number="96"/> + <syscall name="unshare" number="97" groups="process"/> + <syscall name="futex" number="98"/> + <syscall name="set_robust_list" number="99"/> + <syscall name="get_robust_list" number="100"/> + <syscall name="nanosleep" number="101"/> + <syscall name="getitimer" number="102"/> + <syscall name="setitimer" number="103"/> + <syscall name="kexec_load" number="104"/> + <syscall name="init_module" number="105"/> + <syscall name="delete_module" number="106"/> + <syscall name="timer_create" number="107"/> + <syscall name="timer_gettime" number="108"/> + <syscall name="timer_getoverrun" number="109"/> + <syscall name="timer_settime" number="110"/> + <syscall name="timer_delete" number="111"/> + <syscall name="clock_settime" number="112"/> + <syscall name="clock_gettime" number="113"/> + <syscall name="clock_getres" number="114"/> + <syscall name="clock_nanosleep" number="115"/> + <syscall name="syslog" number="116"/> + <syscall name="ptrace" number="117"/> + <syscall name="sched_setparam" number="118"/> + <syscall name="sched_setscheduler" number="119"/> + <syscall name="sched_getscheduler" number="120"/> + <syscall name="sched_getparam" number="121"/> + <syscall name="sched_setaffinity" number="122"/> + <syscall name="sched_getaffinity" number="123"/> + <syscall name="sched_yield" number="124"/> + <syscall name="sched_get_priority_max" number="125"/> + <syscall name="sched_get_priority_min" number="126"/> + <syscall name="sched_rr_get_interval" number="127"/> + <syscall name="restart_syscall" number="128"/> + <syscall name="kill" number="129" groups="signal"/> + <syscall name="tkill" number="130" groups="signal"/> + <syscall name="tgkill" number="131" groups="signal"/> + <syscall name="sigaltstack" number="132" groups="signal"/> + <syscall name="rt_sigsuspend" number="133" groups="signal"/> + <syscall name="rt_sigaction" number="134" groups="signal"/> + <syscall name="rt_sigprocmask" number="135" groups="signal"/> + <syscall name="rt_sigpending" number="136" groups="signal"/> + <syscall name="rt_sigtimedwait" number="137" groups="signal"/> + <syscall name="rt_sigqueueinfo" number="138" groups="signal"/> + <syscall name="rt_sigreturn" number="139" groups="signal"/> + <syscall name="setpriority" number="140"/> + <syscall name="getpriority" number="141"/> + <syscall name="reboot" number="142"/> + <syscall name="setregid" number="143"/> + <syscall name="setgid" number="144"/> + <syscall name="setreuid" number="145"/> + <syscall name="setuid" number="146"/> + <syscall name="setresuid" number="147"/> + <syscall name="getresuid" number="148"/> + <syscall name="setresgid" number="149"/> + <syscall name="getresgid" number="150"/> + <syscall name="setfsuid" number="151"/> + <syscall name="setfsgid" number="152"/> + <syscall name="times" number="153"/> + <syscall name="setpgid" number="154"/> + <syscall name="getpgid" number="155"/> + <syscall name="getsid" number="156"/> + <syscall name="setsid" number="157"/> + <syscall name="getgroups" number="158"/> + <syscall name="setgroups" number="159"/> + <syscall name="uname" number="160"/> + <syscall name="sethostname" number="161"/> + <syscall name="setdomainname" number="162"/> + <syscall name="getrlimit" number="163"/> + <syscall name="setrlimit" number="164"/> + <syscall name="getrusage" number="165"/> + <syscall name="umask" number="166"/> + <syscall name="prctl" number="167"/> + <syscall name="getcpu" number="168"/> + <syscall name="gettimeofday" number="169"/> + <syscall name="settimeofday" number="170"/> + <syscall name="adjtimex" number="171"/> + <syscall name="getpid" number="172"/> + <syscall name="getppid" number="173"/> + <syscall name="getuid" number="174"/> + <syscall name="geteuid" number="175"/> + <syscall name="getgid" number="176"/> + <syscall name="getegid" number="177"/> + <syscall name="gettid" number="178"/> + <syscall name="sysinfo" number="179"/> + <syscall name="mq_open" number="180"/> + <syscall name="mq_unlink" number="181"/> + <syscall name="mq_timedsend" number="182"/> + <syscall name="mq_timedreceive" number="183"/> + <syscall name="mq_notify" number="184"/> + <syscall name="mq_getsetattr" number="185"/> + <syscall name="msgget" number="186" groups="ipc"/> + <syscall name="msgctl" number="187" groups="ipc"/> + <syscall name="msgrcv" number="188" groups="ipc"/> + <syscall name="msgsnd" number="189" groups="ipc"/> + <syscall name="semget" number="190" groups="ipc"/> + <syscall name="semctl" number="191" groups="ipc"/> + <syscall name="semtimedop" number="192" groups="ipc"/> + <syscall name="semop" number="193" groups="ipc"/> + <syscall name="shmget" number="194" groups="ipc"/> + <syscall name="shmctl" number="195" groups="ipc"/> + <syscall name="shmat" number="196" groups="ipc,memory"/> + <syscall name="shmdt" number="197" groups="ipc,memory"/> + <syscall name="socket" number="198" groups="network"/> + <syscall name="socketpair" number="199" groups="network"/> + <syscall name="bind" number="200" groups="network"/> + <syscall name="listen" number="201" groups="network"/> + <syscall name="accept" number="202" groups="network"/> + <syscall name="connect" number="203" groups="network"/> + <syscall name="getsockname" number="204" groups="network"/> + <syscall name="getpeername" number="205" groups="network"/> + <syscall name="sendto" number="206" groups="network"/> + <syscall name="recvfrom" number="207" groups="network"/> + <syscall name="setsockopt" number="208" groups="network"/> + <syscall name="getsockopt" number="209" groups="network"/> + <syscall name="shutdown" number="210" groups="network"/> + <syscall name="sendmsg" number="211" groups="network"/> + <syscall name="recvmsg" number="212" groups="network"/> + <syscall name="readahead" number="213" groups="descriptor"/> + <syscall name="brk" number="214" groups="memory"/> + <syscall name="munmap" number="215" groups="memory"/> + <syscall name="mremap" number="216" groups="memory"/> + <syscall name="add_key" number="217"/> + <syscall name="request_key" number="218"/> + <syscall name="keyctl" number="219"/> + <syscall name="clone" number="220" groups="process"/> + <syscall name="execve" number="221" groups="file,process"/> + <syscall name="mmap" number="222" groups="descriptor,memory"/> + <syscall name="fadvise64" number="223" groups="descriptor"/> + <syscall name="swapon" number="224" groups="file"/> + <syscall name="swapoff" number="225" groups="file"/> + <syscall name="mprotect" number="226" groups="memory"/> + <syscall name="msync" number="227" groups="memory"/> + <syscall name="mlock" number="228" groups="memory"/> + <syscall name="munlock" number="229" groups="memory"/> + <syscall name="mlockall" number="230" groups="memory"/> + <syscall name="munlockall" number="231" groups="memory"/> + <syscall name="mincore" number="232" groups="memory"/> + <syscall name="madvise" number="233" groups="memory"/> + <syscall name="remap_file_pages" number="234" groups="memory"/> + <syscall name="mbind" number="235" groups="memory"/> + <syscall name="get_mempolicy" number="236" groups="memory"/> + <syscall name="set_mempolicy" number="237" groups="memory"/> + <syscall name="migrate_pages" number="238" groups="memory"/> + <syscall name="move_pages" number="239" groups="memory"/> + <syscall name="rt_tgsigqueueinfo" number="240" groups="process,signal"/> + <syscall name="perf_event_open" number="241" groups="descriptor"/> + <syscall name="accept4" number="242" groups="network"/> + <syscall name="recvmmsg" number="243" groups="network"/> + <syscall name="arch_specific_syscall" number="244"/> + <syscall name="wait4" number="260" groups="process"/> + <syscall name="prlimit64" number="261"/> + <syscall name="fanotify_init" number="262" groups="descriptor"/> + <syscall name="fanotify_mark" number="263" groups="descriptor,file"/> + <syscall name="name_to_handle_at" number="264" groups="descriptor,file"/> + <syscall name="open_by_handle_at" number="265" groups="descriptor"/> + <syscall name="clock_adjtime" number="266"/> + <syscall name="syncfs" number="267" groups="descriptor"/> + <syscall name="setns" number="268" groups="descriptor"/> + <syscall name="sendmmsg" number="269" groups="network"/> + <syscall name="process_vm_readv" number="270"/> + <syscall name="process_vm_writev" number="271"/> + <syscall name="kcmp" number="272"/> + <syscall name="syscalls" number="273"/> +</syscalls_info> diff --git a/tools/msys/mingw32/share/gdb/syscalls/amd64-linux.xml b/tools/msys/mingw32/share/gdb/syscalls/amd64-linux.xml new file mode 100644 index 0000000000000000000000000000000000000000..24d25d039d6e2054db496e3e1d1ede23cadcd1d1 --- /dev/null +++ b/tools/msys/mingw32/share/gdb/syscalls/amd64-linux.xml @@ -0,0 +1,311 @@ +<?xml version="1.0"?> +<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd"> +<!-- Copyright (C) 2009-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> +<!-- This file was generated using the following file: + + /usr/src/linux/arch/x86/include/asm/unistd_64.h + + The file mentioned above belongs to the Linux Kernel. --> +<syscalls_info> + <syscall name="read" number="0" groups="descriptor"/> + <syscall name="write" number="1" groups="descriptor"/> + <syscall name="open" number="2" groups="descriptor,file"/> + <syscall name="close" number="3" groups="descriptor"/> + <syscall name="stat" number="4" groups="file"/> + <syscall name="fstat" number="5" groups="descriptor"/> + <syscall name="lstat" number="6" groups="file"/> + <syscall name="poll" number="7" groups="descriptor"/> + <syscall name="lseek" number="8" groups="descriptor"/> + <syscall name="mmap" number="9" groups="descriptor,memory"/> + <syscall name="mprotect" number="10" groups="memory"/> + <syscall name="munmap" number="11" groups="memory"/> + <syscall name="brk" number="12" groups="memory"/> + <syscall name="rt_sigaction" number="13" groups="signal"/> + <syscall name="rt_sigprocmask" number="14" groups="signal"/> + <syscall name="rt_sigreturn" number="15" groups="signal"/> + <syscall name="ioctl" number="16" groups="descriptor"/> + <syscall name="pread64" number="17" groups="descriptor"/> + <syscall name="pwrite64" number="18" groups="descriptor"/> + <syscall name="readv" number="19" groups="descriptor"/> + <syscall name="writev" number="20" groups="descriptor"/> + <syscall name="access" number="21" groups="file"/> + <syscall name="pipe" number="22" groups="descriptor"/> + <syscall name="select" number="23" groups="descriptor"/> + <syscall name="sched_yield" number="24"/> + <syscall name="mremap" number="25" groups="memory"/> + <syscall name="msync" number="26" groups="memory"/> + <syscall name="mincore" number="27" groups="memory"/> + <syscall name="madvise" number="28" groups="memory"/> + <syscall name="shmget" number="29" groups="ipc"/> + <syscall name="shmat" number="30" groups="ipc,memory"/> + <syscall name="shmctl" number="31" groups="ipc"/> + <syscall name="dup" number="32" groups="descriptor"/> + <syscall name="dup2" number="33" groups="descriptor"/> + <syscall name="pause" number="34" groups="signal"/> + <syscall name="nanosleep" number="35"/> + <syscall name="getitimer" number="36"/> + <syscall name="alarm" number="37"/> + <syscall name="setitimer" number="38"/> + <syscall name="getpid" number="39"/> + <syscall name="sendfile" number="40" groups="descriptor,network"/> + <syscall name="socket" number="41" groups="network"/> + <syscall name="connect" number="42" groups="network"/> + <syscall name="accept" number="43" groups="network"/> + <syscall name="sendto" number="44" groups="network"/> + <syscall name="recvfrom" number="45" groups="network"/> + <syscall name="sendmsg" number="46" groups="network"/> + <syscall name="recvmsg" number="47" groups="network"/> + <syscall name="shutdown" number="48" groups="network"/> + <syscall name="bind" number="49" groups="network"/> + <syscall name="listen" number="50" groups="network"/> + <syscall name="getsockname" number="51" groups="network"/> + <syscall name="getpeername" number="52" groups="network"/> + <syscall name="socketpair" number="53" groups="network"/> + <syscall name="setsockopt" number="54" groups="network"/> + <syscall name="getsockopt" number="55" groups="network"/> + <syscall name="clone" number="56" groups="process"/> + <syscall name="fork" number="57" groups="process"/> + <syscall name="vfork" number="58" groups="process"/> + <syscall name="execve" number="59" groups="file,process"/> + <syscall name="exit" number="60" groups="process"/> + <syscall name="wait4" number="61" groups="process"/> + <syscall name="kill" number="62" groups="signal"/> + <syscall name="uname" number="63"/> + <syscall name="semget" number="64" groups="ipc"/> + <syscall name="semop" number="65" groups="ipc"/> + <syscall name="semctl" number="66" groups="ipc"/> + <syscall name="shmdt" number="67" groups="ipc,memory"/> + <syscall name="msgget" number="68" groups="ipc"/> + <syscall name="msgsnd" number="69" groups="ipc"/> + <syscall name="msgrcv" number="70" groups="ipc"/> + <syscall name="msgctl" number="71" groups="ipc"/> + <syscall name="fcntl" number="72" groups="descriptor"/> + <syscall name="flock" number="73" groups="descriptor"/> + <syscall name="fsync" number="74" groups="descriptor"/> + <syscall name="fdatasync" number="75" groups="descriptor"/> + <syscall name="truncate" number="76" groups="file"/> + <syscall name="ftruncate" number="77" groups="descriptor"/> + <syscall name="getdents" number="78" groups="descriptor"/> + <syscall name="getcwd" number="79" groups="file"/> + <syscall name="chdir" number="80" groups="file"/> + <syscall name="fchdir" number="81" groups="descriptor"/> + <syscall name="rename" number="82" groups="file"/> + <syscall name="mkdir" number="83" groups="file"/> + <syscall name="rmdir" number="84" groups="file"/> + <syscall name="creat" number="85" groups="descriptor,file"/> + <syscall name="link" number="86" groups="file"/> + <syscall name="unlink" number="87" groups="file"/> + <syscall name="symlink" number="88" groups="file"/> + <syscall name="readlink" number="89" groups="file"/> + <syscall name="chmod" number="90" groups="file"/> + <syscall name="fchmod" number="91" groups="descriptor"/> + <syscall name="chown" number="92" groups="file"/> + <syscall name="fchown" number="93" groups="descriptor"/> + <syscall name="lchown" number="94" groups="file"/> + <syscall name="umask" number="95"/> + <syscall name="gettimeofday" number="96"/> + <syscall name="getrlimit" number="97"/> + <syscall name="getrusage" number="98"/> + <syscall name="sysinfo" number="99"/> + <syscall name="times" number="100"/> + <syscall name="ptrace" number="101"/> + <syscall name="getuid" number="102"/> + <syscall name="syslog" number="103"/> + <syscall name="getgid" number="104"/> + <syscall name="setuid" number="105"/> + <syscall name="setgid" number="106"/> + <syscall name="geteuid" number="107"/> + <syscall name="getegid" number="108"/> + <syscall name="setpgid" number="109"/> + <syscall name="getppid" number="110"/> + <syscall name="getpgrp" number="111"/> + <syscall name="setsid" number="112"/> + <syscall name="setreuid" number="113"/> + <syscall name="setregid" number="114"/> + <syscall name="getgroups" number="115"/> + <syscall name="setgroups" number="116"/> + <syscall name="setresuid" number="117"/> + <syscall name="getresuid" number="118"/> + <syscall name="setresgid" number="119"/> + <syscall name="getresgid" number="120"/> + <syscall name="getpgid" number="121"/> + <syscall name="setfsuid" number="122"/> + <syscall name="setfsgid" number="123"/> + <syscall name="getsid" number="124"/> + <syscall name="capget" number="125"/> + <syscall name="capset" number="126"/> + <syscall name="rt_sigpending" number="127" groups="signal"/> + <syscall name="rt_sigtimedwait" number="128" groups="signal"/> + <syscall name="rt_sigqueueinfo" number="129" groups="signal"/> + <syscall name="rt_sigsuspend" number="130" groups="signal"/> + <syscall name="sigaltstack" number="131" groups="signal"/> + <syscall name="utime" number="132" groups="file"/> + <syscall name="mknod" number="133" groups="file"/> + <syscall name="uselib" number="134" groups="file"/> + <syscall name="personality" number="135"/> + <syscall name="ustat" number="136"/> + <syscall name="statfs" number="137" groups="file"/> + <syscall name="fstatfs" number="138" groups="descriptor"/> + <syscall name="sysfs" number="139"/> + <syscall name="getpriority" number="140"/> + <syscall name="setpriority" number="141"/> + <syscall name="sched_setparam" number="142"/> + <syscall name="sched_getparam" number="143"/> + <syscall name="sched_setscheduler" number="144"/> + <syscall name="sched_getscheduler" number="145"/> + <syscall name="sched_get_priority_max" number="146"/> + <syscall name="sched_get_priority_min" number="147"/> + <syscall name="sched_rr_get_interval" number="148"/> + <syscall name="mlock" number="149" groups="memory"/> + <syscall name="munlock" number="150" groups="memory"/> + <syscall name="mlockall" number="151" groups="memory"/> + <syscall name="munlockall" number="152" groups="memory"/> + <syscall name="vhangup" number="153"/> + <syscall name="modify_ldt" number="154"/> + <syscall name="pivot_root" number="155" groups="file"/> + <syscall name="_sysctl" number="156"/> + <syscall name="prctl" number="157"/> + <syscall name="arch_prctl" number="158" groups="process"/> + <syscall name="adjtimex" number="159"/> + <syscall name="setrlimit" number="160"/> + <syscall name="chroot" number="161" groups="file"/> + <syscall name="sync" number="162"/> + <syscall name="acct" number="163" groups="file"/> + <syscall name="settimeofday" number="164"/> + <syscall name="mount" number="165" groups="file"/> + <syscall name="umount2" number="166" groups="file"/> + <syscall name="swapon" number="167" groups="file"/> + <syscall name="swapoff" number="168" groups="file"/> + <syscall name="reboot" number="169"/> + <syscall name="sethostname" number="170"/> + <syscall name="setdomainname" number="171"/> + <syscall name="iopl" number="172"/> + <syscall name="ioperm" number="173"/> + <syscall name="create_module" number="174"/> + <syscall name="init_module" number="175"/> + <syscall name="delete_module" number="176"/> + <syscall name="get_kernel_syms" number="177"/> + <syscall name="query_module" number="178"/> + <syscall name="quotactl" number="179" groups="file"/> + <syscall name="nfsservctl" number="180"/> + <syscall name="getpmsg" number="181"/> + <syscall name="putpmsg" number="182"/> + <syscall name="afs_syscall" number="183"/> + <syscall name="tuxcall" number="184"/> + <syscall name="security" number="185"/> + <syscall name="gettid" number="186"/> + <syscall name="readahead" number="187" groups="descriptor"/> + <syscall name="setxattr" number="188" groups="file"/> + <syscall name="lsetxattr" number="189" groups="file"/> + <syscall name="fsetxattr" number="190" groups="descriptor"/> + <syscall name="getxattr" number="191" groups="file"/> + <syscall name="lgetxattr" number="192" groups="file"/> + <syscall name="fgetxattr" number="193" groups="descriptor"/> + <syscall name="listxattr" number="194" groups="file"/> + <syscall name="llistxattr" number="195" groups="file"/> + <syscall name="flistxattr" number="196" groups="descriptor"/> + <syscall name="removexattr" number="197" groups="file"/> + <syscall name="lremovexattr" number="198" groups="file"/> + <syscall name="fremovexattr" number="199" groups="descriptor"/> + <syscall name="tkill" number="200" groups="signal"/> + <syscall name="time" number="201"/> + <syscall name="futex" number="202"/> + <syscall name="sched_setaffinity" number="203"/> + <syscall name="sched_getaffinity" number="204"/> + <syscall name="set_thread_area" number="205"/> + <syscall name="io_setup" number="206"/> + <syscall name="io_destroy" number="207"/> + <syscall name="io_getevents" number="208"/> + <syscall name="io_submit" number="209"/> + <syscall name="io_cancel" number="210"/> + <syscall name="get_thread_area" number="211"/> + <syscall name="lookup_dcookie" number="212"/> + <syscall name="epoll_create" number="213" groups="descriptor"/> + <syscall name="epoll_ctl_old" number="214"/> + <syscall name="epoll_wait_old" number="215"/> + <syscall name="remap_file_pages" number="216" groups="memory"/> + <syscall name="getdents64" number="217" groups="descriptor"/> + <syscall name="set_tid_address" number="218"/> + <syscall name="restart_syscall" number="219"/> + <syscall name="semtimedop" number="220" groups="ipc"/> + <syscall name="fadvise64" number="221" groups="descriptor"/> + <syscall name="timer_create" number="222"/> + <syscall name="timer_settime" number="223"/> + <syscall name="timer_gettime" number="224"/> + <syscall name="timer_getoverrun" number="225"/> + <syscall name="timer_delete" number="226"/> + <syscall name="clock_settime" number="227"/> + <syscall name="clock_gettime" number="228"/> + <syscall name="clock_getres" number="229"/> + <syscall name="clock_nanosleep" number="230"/> + <syscall name="exit_group" number="231" groups="process"/> + <syscall name="epoll_wait" number="232" groups="descriptor"/> + <syscall name="epoll_ctl" number="233" groups="descriptor"/> + <syscall name="tgkill" number="234" groups="signal"/> + <syscall name="utimes" number="235" groups="file"/> + <syscall name="vserver" number="236"/> + <syscall name="mbind" number="237" groups="memory"/> + <syscall name="set_mempolicy" number="238" groups="memory"/> + <syscall name="get_mempolicy" number="239" groups="memory"/> + <syscall name="mq_open" number="240"/> + <syscall name="mq_unlink" number="241"/> + <syscall name="mq_timedsend" number="242"/> + <syscall name="mq_timedreceive" number="243"/> + <syscall name="mq_notify" number="244"/> + <syscall name="mq_getsetattr" number="245"/> + <syscall name="kexec_load" number="246"/> + <syscall name="waitid" number="247" groups="process"/> + <syscall name="add_key" number="248"/> + <syscall name="request_key" number="249"/> + <syscall name="keyctl" number="250"/> + <syscall name="ioprio_set" number="251"/> + <syscall name="ioprio_get" number="252"/> + <syscall name="inotify_init" number="253" groups="descriptor"/> + <syscall name="inotify_add_watch" number="254" groups="descriptor"/> + <syscall name="inotify_rm_watch" number="255" groups="descriptor"/> + <syscall name="migrate_pages" number="256" groups="memory"/> + <syscall name="openat" number="257" groups="descriptor,file"/> + <syscall name="mkdirat" number="258" groups="descriptor,file"/> + <syscall name="mknodat" number="259" groups="descriptor,file"/> + <syscall name="fchownat" number="260" groups="descriptor,file"/> + <syscall name="futimesat" number="261" groups="descriptor,file"/> + <syscall name="newfstatat" number="262" groups="descriptor,file"/> + <syscall name="unlinkat" number="263" groups="descriptor,file"/> + <syscall name="renameat" number="264" groups="descriptor,file"/> + <syscall name="linkat" number="265" groups="descriptor,file"/> + <syscall name="symlinkat" number="266" groups="descriptor,file"/> + <syscall name="readlinkat" number="267" groups="descriptor,file"/> + <syscall name="fchmodat" number="268" groups="descriptor,file"/> + <syscall name="faccessat" number="269" groups="descriptor,file"/> + <syscall name="pselect6" number="270" groups="descriptor"/> + <syscall name="ppoll" number="271" groups="descriptor"/> + <syscall name="unshare" number="272" groups="process"/> + <syscall name="set_robust_list" number="273"/> + <syscall name="get_robust_list" number="274"/> + <syscall name="splice" number="275" groups="descriptor"/> + <syscall name="tee" number="276" groups="descriptor"/> + <syscall name="sync_file_range" number="277" groups="descriptor"/> + <syscall name="vmsplice" number="278" groups="descriptor"/> + <syscall name="move_pages" number="279" groups="memory"/> + <syscall name="utimensat" number="280" groups="descriptor,file"/> + <syscall name="epoll_pwait" number="281" groups="descriptor"/> + <syscall name="signalfd" number="282" groups="descriptor,signal"/> + <syscall name="timerfd_create" number="283" groups="descriptor"/> + <syscall name="eventfd" number="284" groups="descriptor"/> + <syscall name="fallocate" number="285" groups="descriptor"/> + <syscall name="timerfd_settime" number="286" groups="descriptor"/> + <syscall name="timerfd_gettime" number="287" groups="descriptor"/> + <syscall name="accept4" number="288" groups="network"/> + <syscall name="signalfd4" number="289" groups="descriptor,signal"/> + <syscall name="eventfd2" number="290" groups="descriptor"/> + <syscall name="epoll_create1" number="291" groups="descriptor"/> + <syscall name="dup3" number="292" groups="descriptor"/> + <syscall name="pipe2" number="293" groups="descriptor"/> + <syscall name="inotify_init1" number="294" groups="descriptor"/> + <syscall name="preadv" number="295" groups="descriptor"/> + <syscall name="pwritev" number="296" groups="descriptor"/> +</syscalls_info> diff --git a/tools/msys/mingw32/share/gdb/syscalls/arm-linux.xml b/tools/msys/mingw32/share/gdb/syscalls/arm-linux.xml new file mode 100644 index 0000000000000000000000000000000000000000..d136e46248764b9d5898cd0846e964ab50318e13 --- /dev/null +++ b/tools/msys/mingw32/share/gdb/syscalls/arm-linux.xml @@ -0,0 +1,395 @@ +<?xml version="1.0"?> +<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd"> +<!-- Copyright (C) 2009-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. This file is offered as-is, + without any warranty. --> +<!-- This file was generated using the following file: + + linux/arch/arm/include/uapi/asm/unistd.h + + The file mentioned above belongs to the Linux Kernel. + Some small hand-edits were made. --> +<syscalls_info> + <syscall name="restart_syscall" number="0"/> + <syscall name="exit" number="1" groups="process"/> + <syscall name="fork" number="2" groups="process"/> + <syscall name="read" number="3" groups="descriptor"/> + <syscall name="write" number="4" groups="descriptor"/> + <syscall name="open" number="5" groups="descriptor,file"/> + <syscall name="close" number="6" groups="descriptor"/> + <syscall name="waitpid" number="7" groups="process"/> <!-- removed --> + <syscall name="creat" number="8" groups="descriptor,file"/> + <syscall name="link" number="9" groups="file"/> + <syscall name="unlink" number="10" groups="file"/> + <syscall name="execve" number="11" groups="file,process"/> + <syscall name="chdir" number="12" groups="file"/> + <syscall name="time" number="13"/> + <syscall name="mknod" number="14" groups="file"/> + <syscall name="chmod" number="15" groups="file"/> + <syscall name="lchown" number="16" groups="file"/> + <syscall name="break" number="17" groups="memory"/> <!-- removed --> + <syscall name="oldstat" number="18" groups="file"/> <!-- removed --> + <syscall name="lseek" number="19" groups="descriptor"/> + <syscall name="getpid" number="20"/> + <syscall name="mount" number="21" groups="file"/> + <syscall name="umount" number="22" groups="file"/> + <syscall name="setuid" number="23"/> + <syscall name="getuid" number="24"/> + <syscall name="stime" number="25"/> + <syscall name="ptrace" number="26"/> + <syscall name="alarm" number="27"/> + <syscall name="oldfstat" number="28" groups="descriptor"/> <!-- removed --> + <syscall name="pause" number="29" groups="signal"/> + <syscall name="utime" number="30" groups="file"/> + <syscall name="stty" number="31"/> <!-- removed --> + <syscall name="gtty" number="32"/> <!-- removed --> + <syscall name="access" number="33" groups="file"/> + <syscall name="nice" number="34"/> + <syscall name="ftime" number="35"/> <!-- removed --> + <syscall name="sync" number="36"/> + <syscall name="kill" number="37" groups="signal"/> + <syscall name="rename" number="38" groups="file"/> + <syscall name="mkdir" number="39" groups="file"/> + <syscall name="rmdir" number="40" groups="file"/> + <syscall name="dup" number="41" groups="descriptor"/> + <syscall name="pipe" number="42" groups="descriptor"/> + <syscall name="times" number="43"/> + <syscall name="prof" number="44"/> <!-- removed --> + <syscall name="brk" number="45" groups="memory"/> + <syscall name="setgid" number="46"/> + <syscall name="getgid" number="47"/> + <syscall name="signal" number="48" groups="signal"/> <!-- removed --> + <syscall name="geteuid" number="49"/> + <syscall name="getegid" number="50"/> + <syscall name="acct" number="51" groups="file"/> + <syscall name="umount2" number="52" groups="file"/> + <syscall name="lock" number="53"/> <!-- removed --> + <syscall name="ioctl" number="54" groups="descriptor"/> + <syscall name="fcntl" number="55" groups="descriptor"/> + <syscall name="mpx" number="56"/> <!-- removed --> + <syscall name="setpgid" number="57"/> + <syscall name="ulimit" number="58"/> <!-- removed --> + <syscall name="oldolduname" number="59"/> <!-- removed --> + <syscall name="umask" number="60"/> + <syscall name="chroot" number="61" groups="file"/> + <syscall name="ustat" number="62"/> + <syscall name="dup2" number="63" groups="descriptor"/> + <syscall name="getppid" number="64"/> + <syscall name="getpgrp" number="65"/> + <syscall name="setsid" number="66"/> + <syscall name="sigaction" number="67" groups="signal"/> + <syscall name="sgetmask" number="68" groups="signal"/> <!-- removed --> + <syscall name="ssetmask" number="69" groups="signal"/> <!-- removed --> + <syscall name="setreuid" number="70"/> + <syscall name="setregid" number="71"/> + <syscall name="sigsuspend" number="72" groups="signal"/> + <syscall name="sigpending" number="73" groups="signal"/> + <syscall name="sethostname" number="74"/> + <syscall name="setrlimit" number="75"/> + <syscall name="getrlimit" number="76"/> + <syscall name="getrusage" number="77"/> + <syscall name="gettimeofday" number="78"/> + <syscall name="settimeofday" number="79"/> + <syscall name="getgroups" number="80"/> + <syscall name="setgroups" number="81"/> + <syscall name="select" number="82" groups="descriptor"/> + <syscall name="symlink" number="83" groups="file"/> + <syscall name="oldlstat" number="84" groups="file"/> <!-- removed --> + <syscall name="readlink" number="85" groups="file"/> + <syscall name="uselib" number="86" groups="file"/> + <syscall name="swapon" number="87" groups="file"/> + <syscall name="reboot" number="88"/> + <syscall name="readdir" number="89" groups="descriptor"/> + <syscall name="mmap" number="90" groups="descriptor,memory"/> + <syscall name="munmap" number="91" groups="memory"/> + <syscall name="truncate" number="92" groups="file"/> + <syscall name="ftruncate" number="93" groups="descriptor"/> + <syscall name="fchmod" number="94" groups="descriptor"/> + <syscall name="fchown" number="95" groups="descriptor"/> + <syscall name="getpriority" number="96"/> + <syscall name="setpriority" number="97"/> + <syscall name="profil" number="98"/> <!-- removed --> + <syscall name="statfs" number="99" groups="file"/> + <syscall name="fstatfs" number="100" groups="descriptor"/> + <syscall name="ioperm" number="101"/> <!-- removed --> + <syscall name="socketcall" number="102" groups="descriptor"/> + <syscall name="syslog" number="103"/> + <syscall name="setitimer" number="104"/> + <syscall name="getitimer" number="105"/> + <syscall name="stat" number="106" groups="file"/> + <syscall name="lstat" number="107" groups="file"/> + <syscall name="fstat" number="108" groups="descriptor"/> + <syscall name="olduname" number="109"/> <!-- removed --> + <syscall name="iopl" number="110"/> <!-- removed --> + <syscall name="vhangup" number="111"/> + <syscall name="idle" number="112"/> <!-- removed --> + <syscall name="syscall" number="113"/> + <syscall name="wait4" number="114" groups="process"/> + <syscall name="swapoff" number="115" groups="file"/> + <syscall name="sysinfo" number="116"/> + <syscall name="ipc" number="117" groups="ipc"/> + <syscall name="fsync" number="118" groups="descriptor"/> + <syscall name="sigreturn" number="119" groups="signal"/> + <syscall name="clone" number="120" groups="process"/> + <syscall name="setdomainname" number="121"/> + <syscall name="uname" number="122"/> + <syscall name="modify_ldt" number="123"/> <!-- removed --> + <syscall name="adjtimex" number="124"/> + <syscall name="mprotect" number="125" groups="memory"/> + <syscall name="sigprocmask" number="126" groups="signal"/> + <syscall name="create_module" number="127"/> <!-- removed --> + <syscall name="init_module" number="128"/> + <syscall name="delete_module" number="129"/> + <syscall name="get_kernel_syms" number="130"/> <!-- removed --> + <syscall name="quotactl" number="131" groups="file"/> + <syscall name="getpgid" number="132"/> + <syscall name="fchdir" number="133" groups="descriptor"/> + <syscall name="bdflush" number="134"/> + <syscall name="sysfs" number="135"/> + <syscall name="personality" number="136"/> + <syscall name="afs_syscall" number="137"/> <!-- removed --> + <syscall name="setfsuid" number="138"/> + <syscall name="setfsgid" number="139"/> + <syscall name="_llseek" number="140" groups="descriptor"/> + <syscall name="getdents" number="141" groups="descriptor"/> + <syscall name="_newselect" number="142" groups="descriptor"/> + <syscall name="flock" number="143" groups="descriptor"/> + <syscall name="msync" number="144" groups="memory"/> + <syscall name="readv" number="145" groups="descriptor"/> + <syscall name="writev" number="146" groups="descriptor"/> + <syscall name="getsid" number="147"/> + <syscall name="fdatasync" number="148" groups="descriptor"/> + <syscall name="_sysctl" number="149"/> + <syscall name="mlock" number="150" groups="memory"/> + <syscall name="munlock" number="151" groups="memory"/> + <syscall name="mlockall" number="152" groups="memory"/> + <syscall name="munlockall" number="153" groups="memory"/> + <syscall name="sched_setparam" number="154"/> + <syscall name="sched_getparam" number="155"/> + <syscall name="sched_setscheduler" number="156"/> + <syscall name="sched_getscheduler" number="157"/> + <syscall name="sched_yield" number="158"/> + <syscall name="sched_get_priority_max" number="159"/> + <syscall name="sched_get_priority_min" number="160"/> + <syscall name="sched_rr_get_interval" number="161"/> + <syscall name="nanosleep" number="162"/> + <syscall name="mremap" number="163" groups="memory"/> + <syscall name="setresuid" number="164"/> + <syscall name="getresuid" number="165"/> + <syscall name="vm86" number="166"/> <!-- removed --> + <syscall name="query_module" number="167"/> <!-- removed --> + <syscall name="poll" number="168" groups="descriptor"/> + <syscall name="nfsservctl" number="169"/> + <syscall name="setresgid" number="170"/> + <syscall name="getresgid" number="171"/> + <syscall name="prctl" number="172"/> + <syscall name="rt_sigreturn" number="173" groups="signal"/> + <syscall name="rt_sigaction" number="174" groups="signal"/> + <syscall name="rt_sigprocmask" number="175" groups="signal"/> + <syscall name="rt_sigpending" number="176" groups="signal"/> + <syscall name="rt_sigtimedwait" number="177" groups="signal"/> + <syscall name="rt_sigqueueinfo" number="178" groups="signal"/> + <syscall name="rt_sigsuspend" number="179" groups="signal"/> + <syscall name="pread64" number="180" groups="descriptor"/> + <syscall name="pwrite64" number="181" groups="descriptor"/> + <syscall name="chown" number="182" groups="file"/> + <syscall name="getcwd" number="183" groups="file"/> + <syscall name="capget" number="184"/> + <syscall name="capset" number="185"/> + <syscall name="sigaltstack" number="186" groups="signal"/> + <syscall name="sendfile" number="187" groups="descriptor,network"/> + <syscall name="vfork" number="190" groups="process"/> + <syscall name="ugetrlimit" number="191"/> + <syscall name="mmap2" number="192" groups="descriptor,memory"/> + <syscall name="truncate64" number="193" groups="file"/> + <syscall name="ftruncate64" number="194" groups="descriptor"/> + <syscall name="stat64" number="195" groups="file"/> + <syscall name="lstat64" number="196" groups="file"/> + <syscall name="fstat64" number="197" groups="descriptor"/> + <syscall name="lchown32" number="198" groups="file"/> + <syscall name="getuid32" number="199"/> + <syscall name="getgid32" number="200"/> + <syscall name="geteuid32" number="201"/> + <syscall name="getegid32" number="202"/> + <syscall name="setreuid32" number="203"/> + <syscall name="setregid32" number="204"/> + <syscall name="getgroups32" number="205"/> + <syscall name="setgroups32" number="206"/> + <syscall name="fchown32" number="207" groups="descriptor"/> + <syscall name="setresuid32" number="208"/> + <syscall name="getresuid32" number="209"/> + <syscall name="setresgid32" number="210"/> + <syscall name="getresgid32" number="211"/> + <syscall name="chown32" number="212" groups="file"/> + <syscall name="setuid32" number="213"/> + <syscall name="setgid32" number="214"/> + <syscall name="setfsuid32" number="215"/> + <syscall name="setfsgid32" number="216"/> + <syscall name="getdents64" number="217" groups="descriptor"/> + <syscall name="pivot_root" number="218" groups="file"/> + <syscall name="mincore" number="219" groups="memory"/> + <syscall name="madvise" number="220" groups="memory"/> + <syscall name="fcntl64" number="221" groups="descriptor"/> + <syscall name="gettid" number="224"/> + <syscall name="readahead" number="225" groups="descriptor"/> + <syscall name="setxattr" number="226" groups="file"/> + <syscall name="lsetxattr" number="227" groups="file"/> + <syscall name="fsetxattr" number="228" groups="descriptor"/> + <syscall name="getxattr" number="229" groups="file"/> + <syscall name="lgetxattr" number="230" groups="file"/> + <syscall name="fgetxattr" number="231" groups="descriptor"/> + <syscall name="listxattr" number="232" groups="file"/> + <syscall name="llistxattr" number="233" groups="file"/> + <syscall name="flistxattr" number="234" groups="descriptor"/> + <syscall name="removexattr" number="235" groups="file"/> + <syscall name="lremovexattr" number="236" groups="file"/> + <syscall name="fremovexattr" number="237" groups="descriptor"/> + <syscall name="tkill" number="238" groups="signal"/> + <syscall name="sendfile64" number="239" groups="descriptor,network"/> + <syscall name="futex" number="240"/> + <syscall name="sched_setaffinity" number="241"/> + <syscall name="sched_getaffinity" number="242"/> + <syscall name="io_setup" number="243"/> + <syscall name="io_destroy" number="244"/> + <syscall name="io_getevents" number="245"/> + <syscall name="io_submit" number="246"/> + <syscall name="io_cancel" number="247"/> + <syscall name="exit_group" number="248" groups="process"/> + <syscall name="lookup_dcookie" number="249"/> + <syscall name="epoll_create" number="250" groups="descriptor"/> + <syscall name="epoll_ctl" number="251" groups="descriptor"/> + <syscall name="epoll_wait" number="252" groups="descriptor"/> + <syscall name="remap_file_pages" number="253" groups="memory"/> + <syscall name="set_tid_address" number="256"/> + <syscall name="timer_create" number="257"/> + <syscall name="timer_settime" number="258"/> + <syscall name="timer_gettime" number="259"/> + <syscall name="timer_getoverrun" number="260"/> + <syscall name="timer_delete" number="261"/> + <syscall name="clock_settime" number="262"/> + <syscall name="clock_gettime" number="263"/> + <syscall name="clock_getres" number="264"/> + <syscall name="clock_nanosleep" number="265"/> + <syscall name="statfs64" number="266" groups="file"/> + <syscall name="fstatfs64" number="267" groups="descriptor"/> + <syscall name="tgkill" number="268" groups="signal"/> + <syscall name="utimes" number="269" groups="file"/> + <syscall name="arm_fadvise64_64" number="270"/> + <syscall name="pciconfig_iobase" number="271"/> + <syscall name="pciconfig_read" number="272"/> + <syscall name="pciconfig_write" number="273"/> + <syscall name="mq_open" number="274"/> + <syscall name="mq_unlink" number="275"/> + <syscall name="mq_timedsend" number="276"/> + <syscall name="mq_timedreceive" number="277"/> + <syscall name="mq_notify" number="278"/> + <syscall name="mq_getsetattr" number="279"/> + <syscall name="waitid" number="280" groups="process"/> + <syscall name="socket" number="281" groups="network"/> + <syscall name="bind" number="282" groups="network"/> + <syscall name="connect" number="283" groups="network"/> + <syscall name="listen" number="284" groups="network"/> + <syscall name="accept" number="285" groups="network"/> + <syscall name="getsockname" number="286" groups="network"/> + <syscall name="getpeername" number="287" groups="network"/> + <syscall name="socketpair" number="288" groups="network"/> + <syscall name="send" number="289" groups="network"/> + <syscall name="sendto" number="290" groups="network"/> + <syscall name="recv" number="291" groups="network"/> + <syscall name="recvfrom" number="292" groups="network"/> + <syscall name="shutdown" number="293" groups="network"/> + <syscall name="setsockopt" number="294" groups="network"/> + <syscall name="getsockopt" number="295" groups="network"/> + <syscall name="sendmsg" number="296" groups="network"/> + <syscall name="recvmsg" number="297" groups="network"/> + <syscall name="semop" number="298" groups="ipc"/> + <syscall name="semget" number="299" groups="ipc"/> + <syscall name="semctl" number="300" groups="ipc"/> + <syscall name="msgsnd" number="301" groups="ipc"/> + <syscall name="msgrcv" number="302" groups="ipc"/> + <syscall name="msgget" number="303" groups="ipc"/> + <syscall name="msgctl" number="304" groups="ipc"/> + <syscall name="shmat" number="305" groups="ipc,memory"/> + <syscall name="shmdt" number="306" groups="ipc,memory"/> + <syscall name="shmget" number="307" groups="ipc"/> + <syscall name="shmctl" number="308" groups="ipc"/> + <syscall name="add_key" number="309"/> + <syscall name="request_key" number="310"/> + <syscall name="keyctl" number="311"/> + <syscall name="semtimedop" number="312" groups="ipc"/> + <syscall name="vserver" number="313"/> + <syscall name="ioprio_set" number="314"/> + <syscall name="ioprio_get" number="315"/> + <syscall name="inotify_init" number="316" groups="descriptor"/> + <syscall name="inotify_add_watch" number="317" groups="descriptor"/> + <syscall name="inotify_rm_watch" number="318" groups="descriptor"/> + <syscall name="mbind" number="319" groups="memory"/> + <syscall name="get_mempolicy" number="320" groups="memory"/> + <syscall name="set_mempolicy" number="321" groups="memory"/> + <syscall name="openat" number="322" groups="descriptor,file"/> + <syscall name="mkdirat" number="323" groups="descriptor,file"/> + <syscall name="mknodat" number="324" groups="descriptor,file"/> + <syscall name="fchownat" number="325" groups="descriptor,file"/> + <syscall name="futimesat" number="326" groups="descriptor,file"/> + <syscall name="fstatat64" number="327" groups="descriptor,file"/> + <syscall name="unlinkat" number="328" groups="descriptor,file"/> + <syscall name="renameat" number="329" groups="descriptor,file"/> + <syscall name="linkat" number="330" groups="descriptor,file"/> + <syscall name="symlinkat" number="331" groups="descriptor,file"/> + <syscall name="readlinkat" number="332" groups="descriptor,file"/> + <syscall name="fchmodat" number="333" groups="descriptor,file"/> + <syscall name="faccessat" number="334" groups="descriptor,file"/> + <syscall name="pselect6" number="335" groups="descriptor"/> + <syscall name="ppoll" number="336" groups="descriptor"/> + <syscall name="unshare" number="337" groups="process"/> + <syscall name="set_robust_list" number="338"/> + <syscall name="get_robust_list" number="339"/> + <syscall name="splice" number="340" groups="descriptor"/> + <syscall name="arm_sync_file_range" number="341"/> + <syscall name="tee" number="342" groups="descriptor"/> + <syscall name="vmsplice" number="343" groups="descriptor"/> + <syscall name="move_pages" number="344" groups="memory"/> + <syscall name="getcpu" number="345"/> + <syscall name="epoll_pwait" number="346" groups="descriptor"/> + <syscall name="kexec_load" number="347"/> + <syscall name="utimensat" number="348" groups="descriptor,file"/> + <syscall name="signalfd" number="349" groups="descriptor,signal"/> + <syscall name="timerfd_create" number="350" groups="descriptor"/> + <syscall name="eventfd" number="351" groups="descriptor"/> + <syscall name="fallocate" number="352" groups="descriptor"/> + <syscall name="timerfd_settime" number="353" groups="descriptor"/> + <syscall name="timerfd_gettime" number="354" groups="descriptor"/> + <syscall name="signalfd4" number="355" groups="descriptor,signal"/> + <syscall name="eventfd2" number="356" groups="descriptor"/> + <syscall name="epoll_create1" number="357" groups="descriptor"/> + <syscall name="dup3" number="358" groups="descriptor"/> + <syscall name="pipe2" number="359" groups="descriptor"/> + <syscall name="inotify_init1" number="360" groups="descriptor"/> + <syscall name="preadv" number="361" groups="descriptor"/> + <syscall name="pwritev" number="362" groups="descriptor"/> + <syscall name="rt_tgsigqueueinfo" number="363" groups="process,signal"/> + <syscall name="perf_event_open" number="364" groups="descriptor"/> + <syscall name="recvmmsg" number="365" groups="network"/> + <syscall name="accept4" number="366" groups="network"/> + <syscall name="fanotify_init" number="367" groups="descriptor"/> + <syscall name="fanotify_mark" number="368" groups="descriptor,file"/> + <syscall name="prlimit64" number="369"/> + <syscall name="name_to_handle_at" number="370" groups="descriptor,file"/> + <syscall name="open_by_handle_at" number="371" groups="descriptor"/> + <syscall name="clock_adjtime" number="372"/> + <syscall name="syncfs" number="373" groups="descriptor"/> + <syscall name="sendmmsg" number="374" groups="network"/> + <syscall name="setns" number="375" groups="descriptor"/> + <syscall name="process_vm_readv" number="376"/> + <syscall name="process_vm_writev" number="377"/> + <syscall name="kcmp" number="378"/> + <syscall name="finit_module" number="379" groups="descriptor"/> + <syscall name="ARM_breakpoint" number="983041"/> + <syscall name="ARM_cacheflush" number="983042"/> + <syscall name="ARM_usr26" number="983043"/> + <syscall name="ARM_usr32" number="983044"/> + <syscall name="ARM_set_tls" number="983045"/> +</syscalls_info> diff --git a/tools/msys/mingw32/share/gdb/syscalls/freebsd.xml b/tools/msys/mingw32/share/gdb/syscalls/freebsd.xml new file mode 100644 index 0000000000000000000000000000000000000000..c9655e4890d70228baff34cf11b65e76201fc27d --- /dev/null +++ b/tools/msys/mingw32/share/gdb/syscalls/freebsd.xml @@ -0,0 +1,474 @@ +<?xml version="1.0"?> <!-- THIS FILE IS GENERATED -*- buffer-read-only: t -*- --> +<!-- vi:set ro: --> +<!-- Copyright (C) 2009-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> + +<!DOCTYPE feature SYSTEM "gdb-syscalls.dtd"> + +<!-- This file was generated using the following file: + + /usr/src/sys/sys/syscall.h + + The file mentioned above belongs to the FreeBSD Kernel. --> + +<syscalls_info> + <syscall name="syscall" number="0"/> + <syscall name="exit" number="1"/> + <syscall name="fork" number="2"/> + <syscall name="read" number="3"/> + <syscall name="write" number="4"/> + <syscall name="open" number="5"/> + <syscall name="close" number="6"/> + <syscall name="wait4" number="7"/> + <syscall name="link" number="9"/> + <syscall name="unlink" number="10"/> + <syscall name="execv" number="11"/> + <syscall name="chdir" number="12"/> + <syscall name="fchdir" number="13"/> + <syscall name="freebsd11_mknod" number="14" alias="mknod"/> + <syscall name="chmod" number="15"/> + <syscall name="chown" number="16"/> + <syscall name="break" number="17"/> + <syscall name="freebsd4_getfsstat" number="18" alias="getfsstat"/> + <syscall name="getpid" number="20"/> + <syscall name="mount" number="21"/> + <syscall name="unmount" number="22"/> + <syscall name="setuid" number="23"/> + <syscall name="getuid" number="24"/> + <syscall name="geteuid" number="25"/> + <syscall name="ptrace" number="26"/> + <syscall name="recvmsg" number="27"/> + <syscall name="sendmsg" number="28"/> + <syscall name="recvfrom" number="29"/> + <syscall name="accept" number="30"/> + <syscall name="getpeername" number="31"/> + <syscall name="getsockname" number="32"/> + <syscall name="access" number="33"/> + <syscall name="chflags" number="34"/> + <syscall name="fchflags" number="35"/> + <syscall name="sync" number="36"/> + <syscall name="kill" number="37"/> + <syscall name="getppid" number="39"/> + <syscall name="dup" number="41"/> + <syscall name="freebsd10_pipe" number="42" alias="pipe"/> + <syscall name="getegid" number="43"/> + <syscall name="profil" number="44"/> + <syscall name="ktrace" number="45"/> + <syscall name="getgid" number="47"/> + <syscall name="getlogin" number="49"/> + <syscall name="setlogin" number="50"/> + <syscall name="acct" number="51"/> + <syscall name="sigaltstack" number="53"/> + <syscall name="ioctl" number="54"/> + <syscall name="reboot" number="55"/> + <syscall name="revoke" number="56"/> + <syscall name="symlink" number="57"/> + <syscall name="readlink" number="58"/> + <syscall name="execve" number="59"/> + <syscall name="umask" number="60"/> + <syscall name="chroot" number="61"/> + <syscall name="msync" number="65"/> + <syscall name="vfork" number="66"/> + <syscall name="vread" number="67"/> + <syscall name="vwrite" number="68"/> + <syscall name="sbrk" number="69"/> + <syscall name="sstk" number="70"/> + <syscall name="freebsd11_vadvise" number="72" alias="vadvise"/> + <syscall name="munmap" number="73"/> + <syscall name="mprotect" number="74"/> + <syscall name="madvise" number="75"/> + <syscall name="vhangup" number="76"/> + <syscall name="vlimit" number="77"/> + <syscall name="mincore" number="78"/> + <syscall name="getgroups" number="79"/> + <syscall name="setgroups" number="80"/> + <syscall name="getpgrp" number="81"/> + <syscall name="setpgid" number="82"/> + <syscall name="setitimer" number="83"/> + <syscall name="swapon" number="85"/> + <syscall name="getitimer" number="86"/> + <syscall name="getdtablesize" number="89"/> + <syscall name="dup2" number="90"/> + <syscall name="fcntl" number="92"/> + <syscall name="select" number="93"/> + <syscall name="fsync" number="95"/> + <syscall name="setpriority" number="96"/> + <syscall name="socket" number="97"/> + <syscall name="connect" number="98"/> + <syscall name="getpriority" number="100"/> + <syscall name="bind" number="104"/> + <syscall name="setsockopt" number="105"/> + <syscall name="listen" number="106"/> + <syscall name="vtimes" number="107"/> + <syscall name="vtrace" number="115"/> + <syscall name="gettimeofday" number="116"/> + <syscall name="getrusage" number="117"/> + <syscall name="getsockopt" number="118"/> + <syscall name="readv" number="120"/> + <syscall name="writev" number="121"/> + <syscall name="settimeofday" number="122"/> + <syscall name="fchown" number="123"/> + <syscall name="fchmod" number="124"/> + <syscall name="setreuid" number="126"/> + <syscall name="setregid" number="127"/> + <syscall name="rename" number="128"/> + <syscall name="flock" number="131"/> + <syscall name="mkfifo" number="132"/> + <syscall name="sendto" number="133"/> + <syscall name="shutdown" number="134"/> + <syscall name="socketpair" number="135"/> + <syscall name="mkdir" number="136"/> + <syscall name="rmdir" number="137"/> + <syscall name="utimes" number="138"/> + <syscall name="adjtime" number="140"/> + <syscall name="setsid" number="147"/> + <syscall name="quotactl" number="148"/> + <syscall name="nlm_syscall" number="154"/> + <syscall name="nfssvc" number="155"/> + <syscall name="freebsd4_statfs" number="157" alias="statfs"/> + <syscall name="freebsd4_fstatfs" number="158" alias="fstatfs"/> + <syscall name="lgetfh" number="160"/> + <syscall name="getfh" number="161"/> + <syscall name="freebsd4_getdomainname" number="162" alias="getdomainname"/> + <syscall name="freebsd4_setdomainname" number="163" alias="setdomainname"/> + <syscall name="freebsd4_uname" number="164" alias="uname"/> + <syscall name="sysarch" number="165"/> + <syscall name="rtprio" number="166"/> + <syscall name="semsys" number="169"/> + <syscall name="msgsys" number="170"/> + <syscall name="shmsys" number="171"/> + <syscall name="freebsd6_pread" number="173" alias="pread"/> + <syscall name="freebsd6_pwrite" number="174" alias="pwrite"/> + <syscall name="setfib" number="175"/> + <syscall name="ntp_adjtime" number="176"/> + <syscall name="setgid" number="181"/> + <syscall name="setegid" number="182"/> + <syscall name="seteuid" number="183"/> + <syscall name="lfs_bmapv" number="184"/> + <syscall name="lfs_markv" number="185"/> + <syscall name="lfs_segclean" number="186"/> + <syscall name="lfs_segwait" number="187"/> + <syscall name="freebsd11_stat" number="188" alias="stat"/> + <syscall name="freebsd11_fstat" number="189" alias="fstat"/> + <syscall name="freebsd11_lstat" number="190" alias="lstat"/> + <syscall name="pathconf" number="191"/> + <syscall name="fpathconf" number="192"/> + <syscall name="getrlimit" number="194"/> + <syscall name="setrlimit" number="195"/> + <syscall name="freebsd11_getdirentries" number="196" alias="getdirentries"/> + <syscall name="freebsd6_mmap" number="197" alias="mmap"/> + <syscall name="__syscall" number="198"/> + <syscall name="freebsd6_lseek" number="199" alias="lseek"/> + <syscall name="freebsd6_truncate" number="200" alias="truncate"/> + <syscall name="freebsd6_ftruncate" number="201" alias="ftruncate"/> + <syscall name="__sysctl" number="202"/> + <syscall name="mlock" number="203"/> + <syscall name="munlock" number="204"/> + <syscall name="undelete" number="205"/> + <syscall name="futimes" number="206"/> + <syscall name="getpgid" number="207"/> + <syscall name="poll" number="209"/> + <syscall name="freebsd7___semctl" number="220" alias="__semctl"/> + <syscall name="semget" number="221"/> + <syscall name="semop" number="222"/> + <syscall name="semconfig" number="223"/> + <syscall name="freebsd7_msgctl" number="224" alias="msgctl"/> + <syscall name="msgget" number="225"/> + <syscall name="msgsnd" number="226"/> + <syscall name="msgrcv" number="227"/> + <syscall name="shmat" number="228"/> + <syscall name="freebsd7_shmctl" number="229" alias="shmctl"/> + <syscall name="shmdt" number="230"/> + <syscall name="shmget" number="231"/> + <syscall name="clock_gettime" number="232"/> + <syscall name="clock_settime" number="233"/> + <syscall name="clock_getres" number="234"/> + <syscall name="ktimer_create" number="235"/> + <syscall name="ktimer_delete" number="236"/> + <syscall name="ktimer_settime" number="237"/> + <syscall name="ktimer_gettime" number="238"/> + <syscall name="ktimer_getoverrun" number="239"/> + <syscall name="nanosleep" number="240"/> + <syscall name="ffclock_getcounter" number="241"/> + <syscall name="ffclock_setestimate" number="242"/> + <syscall name="ffclock_getestimate" number="243"/> + <syscall name="clock_nanosleep" number="244"/> + <syscall name="clock_getcpuclockid2" number="247"/> + <syscall name="ntp_gettime" number="248"/> + <syscall name="minherit" number="250"/> + <syscall name="rfork" number="251"/> + <syscall name="openbsd_poll" number="252"/> + <syscall name="issetugid" number="253"/> + <syscall name="lchown" number="254"/> + <syscall name="aio_read" number="255"/> + <syscall name="aio_write" number="256"/> + <syscall name="lio_listio" number="257"/> + <syscall name="freebsd11_getdents" number="272" alias="getdents"/> + <syscall name="lchmod" number="274"/> + <syscall name="netbsd_lchown" number="275"/> + <syscall name="lutimes" number="276"/> + <syscall name="netbsd_msync" number="277"/> + <syscall name="freebsd11_nstat" number="278" alias="nstat"/> + <syscall name="freebsd11_nfstat" number="279" alias="nfstat"/> + <syscall name="freebsd11_nlstat" number="280" alias="nlstat"/> + <syscall name="preadv" number="289"/> + <syscall name="pwritev" number="290"/> + <syscall name="freebsd4_fhstatfs" number="297" alias="fhstatfs"/> + <syscall name="fhopen" number="298"/> + <syscall name="freebsd11_fhstat" number="299" alias="fhstat"/> + <syscall name="modnext" number="300"/> + <syscall name="modstat" number="301"/> + <syscall name="modfnext" number="302"/> + <syscall name="modfind" number="303"/> + <syscall name="kldload" number="304"/> + <syscall name="kldunload" number="305"/> + <syscall name="kldfind" number="306"/> + <syscall name="kldnext" number="307"/> + <syscall name="kldstat" number="308"/> + <syscall name="kldfirstmod" number="309"/> + <syscall name="getsid" number="310"/> + <syscall name="setresuid" number="311"/> + <syscall name="setresgid" number="312"/> + <syscall name="signanosleep" number="313"/> + <syscall name="aio_return" number="314"/> + <syscall name="aio_suspend" number="315"/> + <syscall name="aio_cancel" number="316"/> + <syscall name="aio_error" number="317"/> + <syscall name="freebsd6_aio_read" number="318" alias="aio_read"/> + <syscall name="freebsd6_aio_write" number="319" alias="aio_write"/> + <syscall name="freebsd6_lio_listio" number="320" alias="lio_listio"/> + <syscall name="yield" number="321"/> + <syscall name="thr_sleep" number="322"/> + <syscall name="thr_wakeup" number="323"/> + <syscall name="mlockall" number="324"/> + <syscall name="munlockall" number="325"/> + <syscall name="__getcwd" number="326"/> + <syscall name="sched_setparam" number="327"/> + <syscall name="sched_getparam" number="328"/> + <syscall name="sched_setscheduler" number="329"/> + <syscall name="sched_getscheduler" number="330"/> + <syscall name="sched_yield" number="331"/> + <syscall name="sched_get_priority_max" number="332"/> + <syscall name="sched_get_priority_min" number="333"/> + <syscall name="sched_rr_get_interval" number="334"/> + <syscall name="utrace" number="335"/> + <syscall name="freebsd4_sendfile" number="336" alias="sendfile"/> + <syscall name="kldsym" number="337"/> + <syscall name="jail" number="338"/> + <syscall name="nnpfs_syscall" number="339"/> + <syscall name="sigprocmask" number="340"/> + <syscall name="sigsuspend" number="341"/> + <syscall name="freebsd4_sigaction" number="342" alias="sigaction"/> + <syscall name="sigpending" number="343"/> + <syscall name="freebsd4_sigreturn" number="344" alias="sigreturn"/> + <syscall name="sigtimedwait" number="345"/> + <syscall name="sigwaitinfo" number="346"/> + <syscall name="__acl_get_file" number="347"/> + <syscall name="__acl_set_file" number="348"/> + <syscall name="__acl_get_fd" number="349"/> + <syscall name="__acl_set_fd" number="350"/> + <syscall name="__acl_delete_file" number="351"/> + <syscall name="__acl_delete_fd" number="352"/> + <syscall name="__acl_aclcheck_file" number="353"/> + <syscall name="__acl_aclcheck_fd" number="354"/> + <syscall name="extattrctl" number="355"/> + <syscall name="extattr_set_file" number="356"/> + <syscall name="extattr_get_file" number="357"/> + <syscall name="extattr_delete_file" number="358"/> + <syscall name="aio_waitcomplete" number="359"/> + <syscall name="getresuid" number="360"/> + <syscall name="getresgid" number="361"/> + <syscall name="kqueue" number="362"/> + <syscall name="freebsd11_kevent" number="363" alias="kevent"/> + <syscall name="__cap_get_proc" number="364"/> + <syscall name="__cap_set_proc" number="365"/> + <syscall name="__cap_get_fd" number="366"/> + <syscall name="__cap_get_file" number="367"/> + <syscall name="__cap_set_fd" number="368"/> + <syscall name="__cap_set_file" number="369"/> + <syscall name="extattr_set_fd" number="371"/> + <syscall name="extattr_get_fd" number="372"/> + <syscall name="extattr_delete_fd" number="373"/> + <syscall name="__setugid" number="374"/> + <syscall name="nfsclnt" number="375"/> + <syscall name="eaccess" number="376"/> + <syscall name="afs3_syscall" number="377"/> + <syscall name="nmount" number="378"/> + <syscall name="kse_exit" number="379"/> + <syscall name="kse_wakeup" number="380"/> + <syscall name="kse_create" number="381"/> + <syscall name="kse_thr_interrupt" number="382"/> + <syscall name="kse_release" number="383"/> + <syscall name="__mac_get_proc" number="384"/> + <syscall name="__mac_set_proc" number="385"/> + <syscall name="__mac_get_fd" number="386"/> + <syscall name="__mac_get_file" number="387"/> + <syscall name="__mac_set_fd" number="388"/> + <syscall name="__mac_set_file" number="389"/> + <syscall name="kenv" number="390"/> + <syscall name="lchflags" number="391"/> + <syscall name="uuidgen" number="392"/> + <syscall name="sendfile" number="393"/> + <syscall name="mac_syscall" number="394"/> + <syscall name="freebsd11_getfsstat" number="395" alias="getfsstat"/> + <syscall name="freebsd11_statfs" number="396" alias="statfs"/> + <syscall name="freebsd11_fstatfs" number="397" alias="fstatfs"/> + <syscall name="freebsd11_fhstatfs" number="398" alias="fhstatfs"/> + <syscall name="ksem_close" number="400"/> + <syscall name="ksem_post" number="401"/> + <syscall name="ksem_wait" number="402"/> + <syscall name="ksem_trywait" number="403"/> + <syscall name="ksem_init" number="404"/> + <syscall name="ksem_open" number="405"/> + <syscall name="ksem_unlink" number="406"/> + <syscall name="ksem_getvalue" number="407"/> + <syscall name="ksem_destroy" number="408"/> + <syscall name="__mac_get_pid" number="409"/> + <syscall name="__mac_get_link" number="410"/> + <syscall name="__mac_set_link" number="411"/> + <syscall name="extattr_set_link" number="412"/> + <syscall name="extattr_get_link" number="413"/> + <syscall name="extattr_delete_link" number="414"/> + <syscall name="__mac_execve" number="415"/> + <syscall name="sigaction" number="416"/> + <syscall name="sigreturn" number="417"/> + <syscall name="getcontext" number="421"/> + <syscall name="setcontext" number="422"/> + <syscall name="swapcontext" number="423"/> + <syscall name="swapoff" number="424"/> + <syscall name="__acl_get_link" number="425"/> + <syscall name="__acl_set_link" number="426"/> + <syscall name="__acl_delete_link" number="427"/> + <syscall name="__acl_aclcheck_link" number="428"/> + <syscall name="sigwait" number="429"/> + <syscall name="thr_create" number="430"/> + <syscall name="thr_exit" number="431"/> + <syscall name="thr_self" number="432"/> + <syscall name="thr_kill" number="433"/> + <syscall name="jail_attach" number="436"/> + <syscall name="extattr_list_fd" number="437"/> + <syscall name="extattr_list_file" number="438"/> + <syscall name="extattr_list_link" number="439"/> + <syscall name="kse_switchin" number="440"/> + <syscall name="ksem_timedwait" number="441"/> + <syscall name="thr_suspend" number="442"/> + <syscall name="thr_wake" number="443"/> + <syscall name="kldunloadf" number="444"/> + <syscall name="audit" number="445"/> + <syscall name="auditon" number="446"/> + <syscall name="getauid" number="447"/> + <syscall name="setauid" number="448"/> + <syscall name="getaudit" number="449"/> + <syscall name="setaudit" number="450"/> + <syscall name="getaudit_addr" number="451"/> + <syscall name="setaudit_addr" number="452"/> + <syscall name="auditctl" number="453"/> + <syscall name="_umtx_op" number="454"/> + <syscall name="thr_new" number="455"/> + <syscall name="sigqueue" number="456"/> + <syscall name="kmq_open" number="457"/> + <syscall name="kmq_setattr" number="458"/> + <syscall name="kmq_timedreceive" number="459"/> + <syscall name="kmq_timedsend" number="460"/> + <syscall name="kmq_notify" number="461"/> + <syscall name="kmq_unlink" number="462"/> + <syscall name="abort2" number="463"/> + <syscall name="thr_set_name" number="464"/> + <syscall name="aio_fsync" number="465"/> + <syscall name="rtprio_thread" number="466"/> + <syscall name="sctp_peeloff" number="471"/> + <syscall name="sctp_generic_sendmsg" number="472"/> + <syscall name="sctp_generic_sendmsg_iov" number="473"/> + <syscall name="sctp_generic_recvmsg" number="474"/> + <syscall name="pread" number="475"/> + <syscall name="pwrite" number="476"/> + <syscall name="mmap" number="477"/> + <syscall name="lseek" number="478"/> + <syscall name="truncate" number="479"/> + <syscall name="ftruncate" number="480"/> + <syscall name="thr_kill2" number="481"/> + <syscall name="shm_open" number="482"/> + <syscall name="shm_unlink" number="483"/> + <syscall name="cpuset" number="484"/> + <syscall name="cpuset_setid" number="485"/> + <syscall name="cpuset_getid" number="486"/> + <syscall name="cpuset_getaffinity" number="487"/> + <syscall name="cpuset_setaffinity" number="488"/> + <syscall name="faccessat" number="489"/> + <syscall name="fchmodat" number="490"/> + <syscall name="fchownat" number="491"/> + <syscall name="fexecve" number="492"/> + <syscall name="freebsd11_fstatat" number="493" alias="fstatat"/> + <syscall name="futimesat" number="494"/> + <syscall name="linkat" number="495"/> + <syscall name="mkdirat" number="496"/> + <syscall name="mkfifoat" number="497"/> + <syscall name="freebsd11_mknodat" number="498" alias="mknodat"/> + <syscall name="openat" number="499"/> + <syscall name="readlinkat" number="500"/> + <syscall name="renameat" number="501"/> + <syscall name="symlinkat" number="502"/> + <syscall name="unlinkat" number="503"/> + <syscall name="posix_openpt" number="504"/> + <syscall name="gssd_syscall" number="505"/> + <syscall name="jail_get" number="506"/> + <syscall name="jail_set" number="507"/> + <syscall name="jail_remove" number="508"/> + <syscall name="closefrom" number="509"/> + <syscall name="__semctl" number="510"/> + <syscall name="msgctl" number="511"/> + <syscall name="shmctl" number="512"/> + <syscall name="lpathconf" number="513"/> + <syscall name="cap_new" number="514"/> + <syscall name="__cap_rights_get" number="515"/> + <syscall name="cap_enter" number="516"/> + <syscall name="cap_getmode" number="517"/> + <syscall name="pdfork" number="518"/> + <syscall name="pdkill" number="519"/> + <syscall name="pdgetpid" number="520"/> + <syscall name="pselect" number="522"/> + <syscall name="getloginclass" number="523"/> + <syscall name="setloginclass" number="524"/> + <syscall name="rctl_get_racct" number="525"/> + <syscall name="rctl_get_rules" number="526"/> + <syscall name="rctl_get_limits" number="527"/> + <syscall name="rctl_add_rule" number="528"/> + <syscall name="rctl_remove_rule" number="529"/> + <syscall name="posix_fallocate" number="530"/> + <syscall name="posix_fadvise" number="531"/> + <syscall name="wait6" number="532"/> + <syscall name="cap_rights_limit" number="533"/> + <syscall name="cap_ioctls_limit" number="534"/> + <syscall name="cap_ioctls_get" number="535"/> + <syscall name="cap_fcntls_limit" number="536"/> + <syscall name="cap_fcntls_get" number="537"/> + <syscall name="bindat" number="538"/> + <syscall name="connectat" number="539"/> + <syscall name="chflagsat" number="540"/> + <syscall name="accept4" number="541"/> + <syscall name="pipe2" number="542"/> + <syscall name="aio_mlock" number="543"/> + <syscall name="procctl" number="544"/> + <syscall name="ppoll" number="545"/> + <syscall name="futimens" number="546"/> + <syscall name="utimensat" number="547"/> + <syscall name="numa_getaffinity" number="548"/> + <syscall name="numa_setaffinity" number="549"/> + <syscall name="fdatasync" number="550"/> + <syscall name="fstat" number="551"/> + <syscall name="fstatat" number="552"/> + <syscall name="fhstat" number="553"/> + <syscall name="getdirentries" number="554"/> + <syscall name="statfs" number="555"/> + <syscall name="fstatfs" number="556"/> + <syscall name="getfsstat" number="557"/> + <syscall name="fhstatfs" number="558"/> + <syscall name="mknodat" number="559"/> + <syscall name="kevent" number="560"/> + <syscall name="cpuset_getdomain" number="561"/> + <syscall name="cpuset_setdomain" number="562"/> + <syscall name="getrandom" number="563"/> +</syscalls_info> diff --git a/tools/msys/mingw32/share/gdb/syscalls/gdb-syscalls.dtd b/tools/msys/mingw32/share/gdb/syscalls/gdb-syscalls.dtd new file mode 100644 index 0000000000000000000000000000000000000000..d7d83f7fbbd7c5ad63d497cd918f1f9a74003857 --- /dev/null +++ b/tools/msys/mingw32/share/gdb/syscalls/gdb-syscalls.dtd @@ -0,0 +1,16 @@ +<!-- Copyright (C) 2009-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> + +<!-- The root element of a syscall info is <syscalls-info>. --> + +<!ELEMENT syscalls-info (syscall*)> + +<!ELEMENT syscall EMPTY> +<!ATTLIST syscall + name CDATA #REQUIRED + number CDATA #REQUIRED + alias CDATA #IMPLIED + groups CDATA #IMPLIED> diff --git a/tools/msys/mingw32/share/gdb/syscalls/i386-linux.xml b/tools/msys/mingw32/share/gdb/syscalls/i386-linux.xml new file mode 100644 index 0000000000000000000000000000000000000000..55bff9f3b7a6353396e72df23434d854535fc494 --- /dev/null +++ b/tools/msys/mingw32/share/gdb/syscalls/i386-linux.xml @@ -0,0 +1,337 @@ +<?xml version="1.0"?> +<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd"> +<!-- Copyright (C) 2009-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> +<!-- This file was generated using the following file: + + /usr/src/linux/arch/x86/include/asm/unistd_32.h + + The file mentioned above belongs to the Linux Kernel. --> +<syscalls_info> + <syscall name="restart_syscall" number="0"/> + <syscall name="exit" number="1" groups="process"/> + <syscall name="fork" number="2" groups="process"/> + <syscall name="read" number="3" groups="descriptor"/> + <syscall name="write" number="4" groups="descriptor"/> + <syscall name="open" number="5" groups="descriptor,file"/> + <syscall name="close" number="6" groups="descriptor"/> + <syscall name="waitpid" number="7" groups="process"/> + <syscall name="creat" number="8" groups="descriptor,file"/> + <syscall name="link" number="9" groups="file"/> + <syscall name="unlink" number="10" groups="file"/> + <syscall name="execve" number="11" groups="file,process"/> + <syscall name="chdir" number="12" groups="file"/> + <syscall name="time" number="13"/> + <syscall name="mknod" number="14" groups="file"/> + <syscall name="chmod" number="15" groups="file"/> + <syscall name="lchown" number="16" groups="file"/> + <syscall name="break" number="17" groups="memory"/> + <syscall name="oldstat" number="18" groups="file"/> + <syscall name="lseek" number="19" groups="descriptor"/> + <syscall name="getpid" number="20"/> + <syscall name="mount" number="21" groups="file"/> + <syscall name="umount" number="22" groups="file"/> + <syscall name="setuid" number="23"/> + <syscall name="getuid" number="24"/> + <syscall name="stime" number="25"/> + <syscall name="ptrace" number="26"/> + <syscall name="alarm" number="27"/> + <syscall name="oldfstat" number="28" groups="descriptor"/> + <syscall name="pause" number="29" groups="signal"/> + <syscall name="utime" number="30" groups="file"/> + <syscall name="stty" number="31"/> + <syscall name="gtty" number="32"/> + <syscall name="access" number="33" groups="file"/> + <syscall name="nice" number="34"/> + <syscall name="ftime" number="35"/> + <syscall name="sync" number="36"/> + <syscall name="kill" number="37" groups="signal"/> + <syscall name="rename" number="38" groups="file"/> + <syscall name="mkdir" number="39" groups="file"/> + <syscall name="rmdir" number="40" groups="file"/> + <syscall name="dup" number="41" groups="descriptor"/> + <syscall name="pipe" number="42" groups="descriptor"/> + <syscall name="times" number="43"/> + <syscall name="prof" number="44"/> + <syscall name="brk" number="45" groups="memory"/> + <syscall name="setgid" number="46"/> + <syscall name="getgid" number="47"/> + <syscall name="signal" number="48" groups="signal"/> + <syscall name="geteuid" number="49"/> + <syscall name="getegid" number="50"/> + <syscall name="acct" number="51" groups="file"/> + <syscall name="umount2" number="52" groups="file"/> + <syscall name="lock" number="53"/> + <syscall name="ioctl" number="54" groups="descriptor"/> + <syscall name="fcntl" number="55" groups="descriptor"/> + <syscall name="mpx" number="56"/> + <syscall name="setpgid" number="57"/> + <syscall name="ulimit" number="58"/> + <syscall name="oldolduname" number="59"/> + <syscall name="umask" number="60"/> + <syscall name="chroot" number="61" groups="file"/> + <syscall name="ustat" number="62"/> + <syscall name="dup2" number="63" groups="descriptor"/> + <syscall name="getppid" number="64"/> + <syscall name="getpgrp" number="65"/> + <syscall name="setsid" number="66"/> + <syscall name="sigaction" number="67" groups="signal"/> + <syscall name="sgetmask" number="68" groups="signal"/> + <syscall name="ssetmask" number="69" groups="signal"/> + <syscall name="setreuid" number="70"/> + <syscall name="setregid" number="71"/> + <syscall name="sigsuspend" number="72" groups="signal"/> + <syscall name="sigpending" number="73" groups="signal"/> + <syscall name="sethostname" number="74"/> + <syscall name="setrlimit" number="75"/> + <syscall name="getrlimit" number="76"/> + <syscall name="getrusage" number="77"/> + <syscall name="gettimeofday" number="78"/> + <syscall name="settimeofday" number="79"/> + <syscall name="getgroups" number="80"/> + <syscall name="setgroups" number="81"/> + <syscall name="select" number="82" groups="descriptor"/> + <syscall name="symlink" number="83" groups="file"/> + <syscall name="oldlstat" number="84" groups="file"/> + <syscall name="readlink" number="85" groups="file"/> + <syscall name="uselib" number="86" groups="file"/> + <syscall name="swapon" number="87" groups="file"/> + <syscall name="reboot" number="88"/> + <syscall name="readdir" number="89" groups="descriptor"/> + <syscall name="mmap" number="90" groups="descriptor,memory"/> + <syscall name="munmap" number="91" groups="memory"/> + <syscall name="truncate" number="92" groups="file"/> + <syscall name="ftruncate" number="93" groups="descriptor"/> + <syscall name="fchmod" number="94" groups="descriptor"/> + <syscall name="fchown" number="95" groups="descriptor"/> + <syscall name="getpriority" number="96"/> + <syscall name="setpriority" number="97"/> + <syscall name="profil" number="98"/> + <syscall name="statfs" number="99" groups="file"/> + <syscall name="fstatfs" number="100" groups="descriptor"/> + <syscall name="ioperm" number="101"/> + <syscall name="socketcall" number="102" groups="descriptor"/> + <syscall name="syslog" number="103"/> + <syscall name="setitimer" number="104"/> + <syscall name="getitimer" number="105"/> + <syscall name="stat" number="106" groups="file"/> + <syscall name="lstat" number="107" groups="file"/> + <syscall name="fstat" number="108" groups="descriptor"/> + <syscall name="olduname" number="109"/> + <syscall name="iopl" number="110"/> + <syscall name="vhangup" number="111"/> + <syscall name="idle" number="112"/> + <syscall name="vm86old" number="113"/> + <syscall name="wait4" number="114" groups="process"/> + <syscall name="swapoff" number="115" groups="file"/> + <syscall name="sysinfo" number="116"/> + <syscall name="ipc" number="117" groups="ipc"/> + <syscall name="fsync" number="118" groups="descriptor"/> + <syscall name="sigreturn" number="119" groups="signal"/> + <syscall name="clone" number="120" groups="process"/> + <syscall name="setdomainname" number="121"/> + <syscall name="uname" number="122"/> + <syscall name="modify_ldt" number="123"/> + <syscall name="adjtimex" number="124"/> + <syscall name="mprotect" number="125" groups="memory"/> + <syscall name="sigprocmask" number="126" groups="signal"/> + <syscall name="create_module" number="127"/> + <syscall name="init_module" number="128"/> + <syscall name="delete_module" number="129"/> + <syscall name="get_kernel_syms" number="130"/> + <syscall name="quotactl" number="131" groups="file"/> + <syscall name="getpgid" number="132"/> + <syscall name="fchdir" number="133" groups="descriptor"/> + <syscall name="bdflush" number="134"/> + <syscall name="sysfs" number="135"/> + <syscall name="personality" number="136"/> + <syscall name="afs_syscall" number="137"/> + <syscall name="setfsuid" number="138"/> + <syscall name="setfsgid" number="139"/> + <syscall name="_llseek" number="140" groups="descriptor"/> + <syscall name="getdents" number="141" groups="descriptor"/> + <syscall name="_newselect" number="142" groups="descriptor"/> + <syscall name="flock" number="143" groups="descriptor"/> + <syscall name="msync" number="144" groups="memory"/> + <syscall name="readv" number="145" groups="descriptor"/> + <syscall name="writev" number="146" groups="descriptor"/> + <syscall name="getsid" number="147"/> + <syscall name="fdatasync" number="148" groups="descriptor"/> + <syscall name="_sysctl" number="149"/> + <syscall name="mlock" number="150" groups="memory"/> + <syscall name="munlock" number="151" groups="memory"/> + <syscall name="mlockall" number="152" groups="memory"/> + <syscall name="munlockall" number="153" groups="memory"/> + <syscall name="sched_setparam" number="154"/> + <syscall name="sched_getparam" number="155"/> + <syscall name="sched_setscheduler" number="156"/> + <syscall name="sched_getscheduler" number="157"/> + <syscall name="sched_yield" number="158"/> + <syscall name="sched_get_priority_max" number="159"/> + <syscall name="sched_get_priority_min" number="160"/> + <syscall name="sched_rr_get_interval" number="161"/> + <syscall name="nanosleep" number="162"/> + <syscall name="mremap" number="163" groups="memory"/> + <syscall name="setresuid" number="164"/> + <syscall name="getresuid" number="165"/> + <syscall name="vm86" number="166"/> + <syscall name="query_module" number="167"/> + <syscall name="poll" number="168" groups="descriptor"/> + <syscall name="nfsservctl" number="169"/> + <syscall name="setresgid" number="170"/> + <syscall name="getresgid" number="171"/> + <syscall name="prctl" number="172"/> + <syscall name="rt_sigreturn" number="173" groups="signal"/> + <syscall name="rt_sigaction" number="174" groups="signal"/> + <syscall name="rt_sigprocmask" number="175" groups="signal"/> + <syscall name="rt_sigpending" number="176" groups="signal"/> + <syscall name="rt_sigtimedwait" number="177" groups="signal"/> + <syscall name="rt_sigqueueinfo" number="178" groups="signal"/> + <syscall name="rt_sigsuspend" number="179" groups="signal"/> + <syscall name="pread64" number="180" groups="descriptor"/> + <syscall name="pwrite64" number="181" groups="descriptor"/> + <syscall name="chown" number="182" groups="file"/> + <syscall name="getcwd" number="183" groups="file"/> + <syscall name="capget" number="184"/> + <syscall name="capset" number="185"/> + <syscall name="sigaltstack" number="186" groups="signal"/> + <syscall name="sendfile" number="187" groups="descriptor,network"/> + <syscall name="getpmsg" number="188"/> + <syscall name="putpmsg" number="189"/> + <syscall name="vfork" number="190" groups="process"/> + <syscall name="ugetrlimit" number="191"/> + <syscall name="mmap2" number="192" groups="descriptor,memory"/> + <syscall name="truncate64" number="193" groups="file"/> + <syscall name="ftruncate64" number="194" groups="descriptor"/> + <syscall name="stat64" number="195" groups="file"/> + <syscall name="lstat64" number="196" groups="file"/> + <syscall name="fstat64" number="197" groups="descriptor"/> + <syscall name="lchown32" number="198" groups="file"/> + <syscall name="getuid32" number="199"/> + <syscall name="getgid32" number="200"/> + <syscall name="geteuid32" number="201"/> + <syscall name="getegid32" number="202"/> + <syscall name="setreuid32" number="203"/> + <syscall name="setregid32" number="204"/> + <syscall name="getgroups32" number="205"/> + <syscall name="setgroups32" number="206"/> + <syscall name="fchown32" number="207" groups="descriptor"/> + <syscall name="setresuid32" number="208"/> + <syscall name="getresuid32" number="209"/> + <syscall name="setresgid32" number="210"/> + <syscall name="getresgid32" number="211"/> + <syscall name="chown32" number="212" groups="file"/> + <syscall name="setuid32" number="213"/> + <syscall name="setgid32" number="214"/> + <syscall name="setfsuid32" number="215"/> + <syscall name="setfsgid32" number="216"/> + <syscall name="pivot_root" number="217" groups="file"/> + <syscall name="mincore" number="218" groups="memory"/> + <syscall name="madvise" number="219" groups="memory"/> + <syscall name="madvise1" number="220"/> + <syscall name="getdents64" number="221" groups="descriptor"/> + <syscall name="fcntl64" number="222" groups="descriptor"/> + <syscall name="gettid" number="224"/> + <syscall name="readahead" number="225" groups="descriptor"/> + <syscall name="setxattr" number="226" groups="file"/> + <syscall name="lsetxattr" number="227" groups="file"/> + <syscall name="fsetxattr" number="228" groups="descriptor"/> + <syscall name="getxattr" number="229" groups="file"/> + <syscall name="lgetxattr" number="230" groups="file"/> + <syscall name="fgetxattr" number="231" groups="descriptor"/> + <syscall name="listxattr" number="232" groups="file"/> + <syscall name="llistxattr" number="233" groups="file"/> + <syscall name="flistxattr" number="234" groups="descriptor"/> + <syscall name="removexattr" number="235" groups="file"/> + <syscall name="lremovexattr" number="236" groups="file"/> + <syscall name="fremovexattr" number="237" groups="descriptor"/> + <syscall name="tkill" number="238" groups="signal"/> + <syscall name="sendfile64" number="239" groups="descriptor,network"/> + <syscall name="futex" number="240"/> + <syscall name="sched_setaffinity" number="241"/> + <syscall name="sched_getaffinity" number="242"/> + <syscall name="set_thread_area" number="243"/> + <syscall name="get_thread_area" number="244"/> + <syscall name="io_setup" number="245"/> + <syscall name="io_destroy" number="246"/> + <syscall name="io_getevents" number="247"/> + <syscall name="io_submit" number="248"/> + <syscall name="io_cancel" number="249"/> + <syscall name="fadvise64" number="250" groups="descriptor"/> + <syscall name="exit_group" number="252" groups="process"/> + <syscall name="lookup_dcookie" number="253"/> + <syscall name="epoll_create" number="254" groups="descriptor"/> + <syscall name="epoll_ctl" number="255" groups="descriptor"/> + <syscall name="epoll_wait" number="256" groups="descriptor"/> + <syscall name="remap_file_pages" number="257" groups="memory"/> + <syscall name="set_tid_address" number="258"/> + <syscall name="timer_create" number="259"/> + <syscall name="timer_settime" number="260"/> + <syscall name="timer_gettime" number="261"/> + <syscall name="timer_getoverrun" number="262"/> + <syscall name="timer_delete" number="263"/> + <syscall name="clock_settime" number="264"/> + <syscall name="clock_gettime" number="265"/> + <syscall name="clock_getres" number="266"/> + <syscall name="clock_nanosleep" number="267"/> + <syscall name="statfs64" number="268" groups="file"/> + <syscall name="fstatfs64" number="269" groups="descriptor"/> + <syscall name="tgkill" number="270" groups="signal"/> + <syscall name="utimes" number="271" groups="file"/> + <syscall name="fadvise64_64" number="272" groups="descriptor"/> + <syscall name="vserver" number="273"/> + <syscall name="mbind" number="274" groups="memory"/> + <syscall name="get_mempolicy" number="275" groups="memory"/> + <syscall name="set_mempolicy" number="276" groups="memory"/> + <syscall name="mq_open" number="277"/> + <syscall name="mq_unlink" number="278"/> + <syscall name="mq_timedsend" number="279"/> + <syscall name="mq_timedreceive" number="280"/> + <syscall name="mq_notify" number="281"/> + <syscall name="mq_getsetattr" number="282"/> + <syscall name="kexec_load" number="283"/> + <syscall name="waitid" number="284" groups="process"/> + <syscall name="add_key" number="286"/> + <syscall name="request_key" number="287"/> + <syscall name="keyctl" number="288"/> + <syscall name="ioprio_set" number="289"/> + <syscall name="ioprio_get" number="290"/> + <syscall name="inotify_init" number="291" groups="descriptor"/> + <syscall name="inotify_add_watch" number="292" groups="descriptor"/> + <syscall name="inotify_rm_watch" number="293" groups="descriptor"/> + <syscall name="migrate_pages" number="294" groups="memory"/> + <syscall name="openat" number="295" groups="descriptor,file"/> + <syscall name="mkdirat" number="296" groups="descriptor,file"/> + <syscall name="mknodat" number="297" groups="descriptor,file"/> + <syscall name="fchownat" number="298" groups="descriptor,file"/> + <syscall name="futimesat" number="299" groups="descriptor,file"/> + <syscall name="fstatat64" number="300" groups="descriptor,file"/> + <syscall name="unlinkat" number="301" groups="descriptor,file"/> + <syscall name="renameat" number="302" groups="descriptor,file"/> + <syscall name="linkat" number="303" groups="descriptor,file"/> + <syscall name="symlinkat" number="304" groups="descriptor,file"/> + <syscall name="readlinkat" number="305" groups="descriptor,file"/> + <syscall name="fchmodat" number="306" groups="descriptor,file"/> + <syscall name="faccessat" number="307" groups="descriptor,file"/> + <syscall name="pselect6" number="308" groups="descriptor"/> + <syscall name="ppoll" number="309" groups="descriptor"/> + <syscall name="unshare" number="310" groups="process"/> + <syscall name="set_robust_list" number="311"/> + <syscall name="get_robust_list" number="312"/> + <syscall name="splice" number="313" groups="descriptor"/> + <syscall name="sync_file_range" number="314" groups="descriptor"/> + <syscall name="tee" number="315" groups="descriptor"/> + <syscall name="vmsplice" number="316" groups="descriptor"/> + <syscall name="move_pages" number="317" groups="memory"/> + <syscall name="getcpu" number="318"/> + <syscall name="epoll_pwait" number="319" groups="descriptor"/> + <syscall name="utimensat" number="320" groups="descriptor,file"/> + <syscall name="signalfd" number="321" groups="descriptor,signal"/> + <syscall name="timerfd_create" number="322" groups="descriptor"/> + <syscall name="eventfd" number="323" groups="descriptor"/> + <syscall name="fallocate" number="324" groups="descriptor"/> + <syscall name="timerfd_settime" number="325" groups="descriptor"/> +</syscalls_info> diff --git a/tools/msys/mingw32/share/gdb/syscalls/mips-n32-linux.xml b/tools/msys/mingw32/share/gdb/syscalls/mips-n32-linux.xml new file mode 100644 index 0000000000000000000000000000000000000000..810922f313048cb83fc8cfd83c5bfde48b8d9e62 --- /dev/null +++ b/tools/msys/mingw32/share/gdb/syscalls/mips-n32-linux.xml @@ -0,0 +1,316 @@ +<?xml version="1.0"?> +<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd"> +<!-- Copyright (C) 2011-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> +<!-- This file was generated using the following file: + + /usr/src/linux/arch/mips/include/asm/unistd.h + + The file mentioned above belongs to the Linux Kernel. --> +<syscalls_info> + <syscall name="read" number="6000" groups="descriptor"/> + <syscall name="write" number="6001" groups="descriptor"/> + <syscall name="open" number="6002" groups="descriptor,file"/> + <syscall name="close" number="6003" groups="descriptor"/> + <syscall name="stat" number="6004" groups="file"/> + <syscall name="fstat" number="6005" groups="descriptor"/> + <syscall name="lstat" number="6006" groups="file"/> + <syscall name="poll" number="6007" groups="descriptor"/> + <syscall name="lseek" number="6008" groups="descriptor"/> + <syscall name="mmap" number="6009" groups="descriptor,memory"/> + <syscall name="mprotect" number="6010" groups="memory"/> + <syscall name="munmap" number="6011" groups="memory"/> + <syscall name="brk" number="6012" groups="memory"/> + <syscall name="rt_sigaction" number="6013" groups="signal"/> + <syscall name="rt_sigprocmask" number="6014" groups="signal"/> + <syscall name="ioctl" number="6015" groups="descriptor"/> + <syscall name="pread64" number="6016" groups="descriptor"/> + <syscall name="pwrite64" number="6017" groups="descriptor"/> + <syscall name="readv" number="6018" groups="descriptor"/> + <syscall name="writev" number="6019" groups="descriptor"/> + <syscall name="access" number="6020" groups="file"/> + <syscall name="pipe" number="6021" groups="descriptor"/> + <syscall name="_newselect" number="6022" groups="descriptor"/> + <syscall name="sched_yield" number="6023"/> + <syscall name="mremap" number="6024" groups="memory"/> + <syscall name="msync" number="6025" groups="memory"/> + <syscall name="mincore" number="6026" groups="memory"/> + <syscall name="madvise" number="6027" groups="memory"/> + <syscall name="shmget" number="6028" groups="ipc"/> + <syscall name="shmat" number="6029" groups="ipc,memory"/> + <syscall name="shmctl" number="6030" groups="ipc"/> + <syscall name="dup" number="6031" groups="descriptor"/> + <syscall name="dup2" number="6032" groups="descriptor"/> + <syscall name="pause" number="6033" groups="signal"/> + <syscall name="nanosleep" number="6034"/> + <syscall name="getitimer" number="6035"/> + <syscall name="setitimer" number="6036"/> + <syscall name="alarm" number="6037"/> + <syscall name="getpid" number="6038"/> + <syscall name="sendfile" number="6039" groups="descriptor,network"/> + <syscall name="socket" number="6040" groups="network"/> + <syscall name="connect" number="6041" groups="network"/> + <syscall name="accept" number="6042" groups="network"/> + <syscall name="sendto" number="6043" groups="network"/> + <syscall name="recvfrom" number="6044" groups="network"/> + <syscall name="sendmsg" number="6045" groups="network"/> + <syscall name="recvmsg" number="6046" groups="network"/> + <syscall name="shutdown" number="6047" groups="network"/> + <syscall name="bind" number="6048" groups="network"/> + <syscall name="listen" number="6049" groups="network"/> + <syscall name="getsockname" number="6050" groups="network"/> + <syscall name="getpeername" number="6051" groups="network"/> + <syscall name="socketpair" number="6052" groups="network"/> + <syscall name="setsockopt" number="6053" groups="network"/> + <syscall name="getsockopt" number="6054" groups="network"/> + <syscall name="clone" number="6055" groups="process"/> + <syscall name="fork" number="6056" groups="process"/> + <syscall name="execve" number="6057" groups="file,process"/> + <syscall name="exit" number="6058" groups="process"/> + <syscall name="wait4" number="6059" groups="process"/> + <syscall name="kill" number="6060" groups="signal"/> + <syscall name="uname" number="6061"/> + <syscall name="semget" number="6062" groups="ipc"/> + <syscall name="semop" number="6063" groups="ipc"/> + <syscall name="semctl" number="6064" groups="ipc"/> + <syscall name="shmdt" number="6065" groups="ipc,memory"/> + <syscall name="msgget" number="6066" groups="ipc"/> + <syscall name="msgsnd" number="6067" groups="ipc"/> + <syscall name="msgrcv" number="6068" groups="ipc"/> + <syscall name="msgctl" number="6069" groups="ipc"/> + <syscall name="fcntl" number="6070" groups="descriptor"/> + <syscall name="flock" number="6071" groups="descriptor"/> + <syscall name="fsync" number="6072" groups="descriptor"/> + <syscall name="fdatasync" number="6073" groups="descriptor"/> + <syscall name="truncate" number="6074" groups="file"/> + <syscall name="ftruncate" number="6075" groups="descriptor"/> + <syscall name="getdents" number="6076" groups="descriptor"/> + <syscall name="getcwd" number="6077" groups="file"/> + <syscall name="chdir" number="6078" groups="file"/> + <syscall name="fchdir" number="6079" groups="descriptor"/> + <syscall name="rename" number="6080" groups="file"/> + <syscall name="mkdir" number="6081" groups="file"/> + <syscall name="rmdir" number="6082" groups="file"/> + <syscall name="creat" number="6083" groups="descriptor,file"/> + <syscall name="link" number="6084" groups="file"/> + <syscall name="unlink" number="6085" groups="file"/> + <syscall name="symlink" number="6086" groups="file"/> + <syscall name="readlink" number="6087" groups="file"/> + <syscall name="chmod" number="6088" groups="file"/> + <syscall name="fchmod" number="6089" groups="descriptor"/> + <syscall name="chown" number="6090" groups="file"/> + <syscall name="fchown" number="6091" groups="descriptor"/> + <syscall name="lchown" number="6092" groups="file"/> + <syscall name="umask" number="6093"/> + <syscall name="gettimeofday" number="6094"/> + <syscall name="getrlimit" number="6095"/> + <syscall name="getrusage" number="6096"/> + <syscall name="sysinfo" number="6097"/> + <syscall name="times" number="6098"/> + <syscall name="ptrace" number="6099"/> + <syscall name="getuid" number="6100"/> + <syscall name="syslog" number="6101"/> + <syscall name="getgid" number="6102"/> + <syscall name="setuid" number="6103"/> + <syscall name="setgid" number="6104"/> + <syscall name="geteuid" number="6105"/> + <syscall name="getegid" number="6106"/> + <syscall name="setpgid" number="6107"/> + <syscall name="getppid" number="6108"/> + <syscall name="getpgrp" number="6109"/> + <syscall name="setsid" number="6110"/> + <syscall name="setreuid" number="6111"/> + <syscall name="setregid" number="6112"/> + <syscall name="getgroups" number="6113"/> + <syscall name="setgroups" number="6114"/> + <syscall name="setresuid" number="6115"/> + <syscall name="getresuid" number="6116"/> + <syscall name="setresgid" number="6117"/> + <syscall name="getresgid" number="6118"/> + <syscall name="getpgid" number="6119"/> + <syscall name="setfsuid" number="6120"/> + <syscall name="setfsgid" number="6121"/> + <syscall name="getsid" number="6122"/> + <syscall name="capget" number="6123"/> + <syscall name="capset" number="6124"/> + <syscall name="rt_sigpending" number="6125" groups="signal"/> + <syscall name="rt_sigtimedwait" number="6126" groups="signal"/> + <syscall name="rt_sigqueueinfo" number="6127" groups="signal"/> + <syscall name="rt_sigsuspend" number="6128" groups="signal"/> + <syscall name="sigaltstack" number="6129" groups="signal"/> + <syscall name="utime" number="6130" groups="file"/> + <syscall name="mknod" number="6131" groups="file"/> + <syscall name="personality" number="6132"/> + <syscall name="ustat" number="6133"/> + <syscall name="statfs" number="6134" groups="file"/> + <syscall name="fstatfs" number="6135" groups="descriptor"/> + <syscall name="sysfs" number="6136"/> + <syscall name="getpriority" number="6137"/> + <syscall name="setpriority" number="6138"/> + <syscall name="sched_setparam" number="6139"/> + <syscall name="sched_getparam" number="6140"/> + <syscall name="sched_setscheduler" number="6141"/> + <syscall name="sched_getscheduler" number="6142"/> + <syscall name="sched_get_priority_max" number="6143"/> + <syscall name="sched_get_priority_min" number="6144"/> + <syscall name="sched_rr_get_interval" number="6145"/> + <syscall name="mlock" number="6146" groups="memory"/> + <syscall name="munlock" number="6147" groups="memory"/> + <syscall name="mlockall" number="6148" groups="memory"/> + <syscall name="munlockall" number="6149" groups="memory"/> + <syscall name="vhangup" number="6150"/> + <syscall name="pivot_root" number="6151" groups="file"/> + <syscall name="_sysctl" number="6152"/> + <syscall name="prctl" number="6153"/> + <syscall name="adjtimex" number="6154"/> + <syscall name="setrlimit" number="6155"/> + <syscall name="chroot" number="6156" groups="file"/> + <syscall name="sync" number="6157"/> + <syscall name="acct" number="6158" groups="file"/> + <syscall name="settimeofday" number="6159"/> + <syscall name="mount" number="6160" groups="file"/> + <syscall name="umount2" number="6161" groups="file"/> + <syscall name="swapon" number="6162" groups="file"/> + <syscall name="swapoff" number="6163" groups="file"/> + <syscall name="reboot" number="6164"/> + <syscall name="sethostname" number="6165"/> + <syscall name="setdomainname" number="6166"/> + <syscall name="create_module" number="6167"/> + <syscall name="init_module" number="6168"/> + <syscall name="delete_module" number="6169"/> + <syscall name="get_kernel_syms" number="6170"/> + <syscall name="query_module" number="6171"/> + <syscall name="quotactl" number="6172" groups="file"/> + <syscall name="nfsservctl" number="6173"/> + <syscall name="getpmsg" number="6174"/> + <syscall name="putpmsg" number="6175"/> + <syscall name="afs_syscall" number="6176"/> + <syscall name="reserved177" number="6177"/> + <syscall name="gettid" number="6178"/> + <syscall name="readahead" number="6179" groups="descriptor"/> + <syscall name="setxattr" number="6180" groups="file"/> + <syscall name="lsetxattr" number="6181" groups="file"/> + <syscall name="fsetxattr" number="6182" groups="descriptor"/> + <syscall name="getxattr" number="6183" groups="file"/> + <syscall name="lgetxattr" number="6184" groups="file"/> + <syscall name="fgetxattr" number="6185" groups="descriptor"/> + <syscall name="listxattr" number="6186" groups="file"/> + <syscall name="llistxattr" number="6187" groups="file"/> + <syscall name="flistxattr" number="6188" groups="descriptor"/> + <syscall name="removexattr" number="6189" groups="file"/> + <syscall name="lremovexattr" number="6190" groups="file"/> + <syscall name="fremovexattr" number="6191" groups="descriptor"/> + <syscall name="tkill" number="6192" groups="signal"/> + <syscall name="reserved193" number="6193"/> + <syscall name="futex" number="6194"/> + <syscall name="sched_setaffinity" number="6195"/> + <syscall name="sched_getaffinity" number="6196"/> + <syscall name="cacheflush" number="6197"/> + <syscall name="cachectl" number="6198"/> + <syscall name="sysmips" number="6199"/> + <syscall name="io_setup" number="6200"/> + <syscall name="io_destroy" number="6201"/> + <syscall name="io_getevents" number="6202"/> + <syscall name="io_submit" number="6203"/> + <syscall name="io_cancel" number="6204"/> + <syscall name="exit_group" number="6205" groups="process"/> + <syscall name="lookup_dcookie" number="6206"/> + <syscall name="epoll_create" number="6207" groups="descriptor"/> + <syscall name="epoll_ctl" number="6208" groups="descriptor"/> + <syscall name="epoll_wait" number="6209" groups="descriptor"/> + <syscall name="remap_file_pages" number="6210" groups="memory"/> + <syscall name="rt_sigreturn" number="6211" groups="signal"/> + <syscall name="fcntl64" number="6212" groups="descriptor"/> + <syscall name="set_tid_address" number="6213"/> + <syscall name="restart_syscall" number="6214"/> + <syscall name="semtimedop" number="6215" groups="ipc"/> + <syscall name="fadvise64" number="6216" groups="descriptor"/> + <syscall name="statfs64" number="6217" groups="file"/> + <syscall name="fstatfs64" number="6218" groups="descriptor"/> + <syscall name="sendfile64" number="6219" groups="descriptor,network"/> + <syscall name="timer_create" number="6220"/> + <syscall name="timer_settime" number="6221"/> + <syscall name="timer_gettime" number="6222"/> + <syscall name="timer_getoverrun" number="6223"/> + <syscall name="timer_delete" number="6224"/> + <syscall name="clock_settime" number="6225"/> + <syscall name="clock_gettime" number="6226"/> + <syscall name="clock_getres" number="6227"/> + <syscall name="clock_nanosleep" number="6228"/> + <syscall name="tgkill" number="6229" groups="signal"/> + <syscall name="utimes" number="6230" groups="file"/> + <syscall name="mbind" number="6231" groups="memory"/> + <syscall name="get_mempolicy" number="6232" groups="memory"/> + <syscall name="set_mempolicy" number="6233" groups="memory"/> + <syscall name="mq_open" number="6234"/> + <syscall name="mq_unlink" number="6235"/> + <syscall name="mq_timedsend" number="6236"/> + <syscall name="mq_timedreceive" number="6237"/> + <syscall name="mq_notify" number="6238"/> + <syscall name="mq_getsetattr" number="6239"/> + <syscall name="vserver" number="6240"/> + <syscall name="waitid" number="6241" groups="process"/> + <syscall name="add_key" number="6243"/> + <syscall name="request_key" number="6244"/> + <syscall name="keyctl" number="6245"/> + <syscall name="set_thread_area" number="6246"/> + <syscall name="inotify_init" number="6247" groups="descriptor"/> + <syscall name="inotify_add_watch" number="6248" groups="descriptor"/> + <syscall name="inotify_rm_watch" number="6249" groups="descriptor"/> + <syscall name="migrate_pages" number="6250" groups="memory"/> + <syscall name="openat" number="6251" groups="descriptor,file"/> + <syscall name="mkdirat" number="6252" groups="descriptor,file"/> + <syscall name="mknodat" number="6253" groups="descriptor,file"/> + <syscall name="fchownat" number="6254" groups="descriptor,file"/> + <syscall name="futimesat" number="6255" groups="descriptor,file"/> + <syscall name="newfstatat" number="6256" groups="descriptor,file"/> + <syscall name="unlinkat" number="6257" groups="descriptor,file"/> + <syscall name="renameat" number="6258" groups="descriptor,file"/> + <syscall name="linkat" number="6259" groups="descriptor,file"/> + <syscall name="symlinkat" number="6260" groups="descriptor,file"/> + <syscall name="readlinkat" number="6261" groups="descriptor,file"/> + <syscall name="fchmodat" number="6262" groups="descriptor,file"/> + <syscall name="faccessat" number="6263" groups="descriptor,file"/> + <syscall name="pselect6" number="6264" groups="descriptor"/> + <syscall name="ppoll" number="6265" groups="descriptor"/> + <syscall name="unshare" number="6266" groups="process"/> + <syscall name="splice" number="6267" groups="descriptor"/> + <syscall name="sync_file_range" number="6268" groups="descriptor"/> + <syscall name="tee" number="6269" groups="descriptor"/> + <syscall name="vmsplice" number="6270" groups="descriptor"/> + <syscall name="move_pages" number="6271" groups="memory"/> + <syscall name="set_robust_list" number="6272"/> + <syscall name="get_robust_list" number="6273"/> + <syscall name="kexec_load" number="6274"/> + <syscall name="getcpu" number="6275"/> + <syscall name="epoll_pwait" number="6276" groups="descriptor"/> + <syscall name="ioprio_set" number="6277"/> + <syscall name="ioprio_get" number="6278"/> + <syscall name="utimensat" number="6279" groups="descriptor,file"/> + <syscall name="signalfd" number="6280" groups="descriptor,signal"/> + <syscall name="timerfd" number="6281" groups="descriptor"/> + <syscall name="eventfd" number="6282" groups="descriptor"/> + <syscall name="fallocate" number="6283" groups="descriptor"/> + <syscall name="timerfd_create" number="6284" groups="descriptor"/> + <syscall name="timerfd_gettime" number="6285" groups="descriptor"/> + <syscall name="timerfd_settime" number="6286" groups="descriptor"/> + <syscall name="signalfd4" number="6287" groups="descriptor,signal"/> + <syscall name="eventfd2" number="6288" groups="descriptor"/> + <syscall name="epoll_create1" number="6289" groups="descriptor"/> + <syscall name="dup3" number="6290" groups="descriptor"/> + <syscall name="pipe2" number="6291" groups="descriptor"/> + <syscall name="inotify_init1" number="6292" groups="descriptor"/> + <syscall name="preadv" number="6293" groups="descriptor"/> + <syscall name="pwritev" number="6294" groups="descriptor"/> + <syscall name="rt_tgsigqueueinfo" number="6295" groups="process,signal"/> + <syscall name="perf_event_open" number="6296" groups="descriptor"/> + <syscall name="accept4" number="6297" groups="network"/> + <syscall name="recvmmsg" number="6298" groups="network"/> + <syscall name="getdents64" number="6299" groups="descriptor"/> + <syscall name="fanotify_init" number="6300" groups="descriptor"/> + <syscall name="fanotify_mark" number="6301" groups="descriptor,file"/> + <syscall name="prlimit64" number="6302"/> +</syscalls_info> diff --git a/tools/msys/mingw32/share/gdb/syscalls/mips-n64-linux.xml b/tools/msys/mingw32/share/gdb/syscalls/mips-n64-linux.xml new file mode 100644 index 0000000000000000000000000000000000000000..18ba610a7ec5efb7448f7b457811c84216aabdfb --- /dev/null +++ b/tools/msys/mingw32/share/gdb/syscalls/mips-n64-linux.xml @@ -0,0 +1,309 @@ +<?xml version="1.0"?> +<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd"> +<!-- Copyright (C) 2011-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> +<!-- This file was generated using the following file: + + /usr/src/linux/arch/mips/include/asm/unistd.h + + The file mentioned above belongs to the Linux Kernel. --> +<syscalls_info> + <syscall name="read" number="5000" groups="descriptor"/> + <syscall name="write" number="5001" groups="descriptor"/> + <syscall name="open" number="5002" groups="descriptor,file"/> + <syscall name="close" number="5003" groups="descriptor"/> + <syscall name="stat" number="5004" groups="file"/> + <syscall name="fstat" number="5005" groups="descriptor"/> + <syscall name="lstat" number="5006" groups="file"/> + <syscall name="poll" number="5007" groups="descriptor"/> + <syscall name="lseek" number="5008" groups="descriptor"/> + <syscall name="mmap" number="5009" groups="descriptor,memory"/> + <syscall name="mprotect" number="5010" groups="memory"/> + <syscall name="munmap" number="5011" groups="memory"/> + <syscall name="brk" number="5012" groups="memory"/> + <syscall name="rt_sigaction" number="5013" groups="signal"/> + <syscall name="rt_sigprocmask" number="5014" groups="signal"/> + <syscall name="ioctl" number="5015" groups="descriptor"/> + <syscall name="pread64" number="5016" groups="descriptor"/> + <syscall name="pwrite64" number="5017" groups="descriptor"/> + <syscall name="readv" number="5018" groups="descriptor"/> + <syscall name="writev" number="5019" groups="descriptor"/> + <syscall name="access" number="5020" groups="file"/> + <syscall name="pipe" number="5021" groups="descriptor"/> + <syscall name="_newselect" number="5022" groups="descriptor"/> + <syscall name="sched_yield" number="5023"/> + <syscall name="mremap" number="5024" groups="memory"/> + <syscall name="msync" number="5025" groups="memory"/> + <syscall name="mincore" number="5026" groups="memory"/> + <syscall name="madvise" number="5027" groups="memory"/> + <syscall name="shmget" number="5028" groups="ipc"/> + <syscall name="shmat" number="5029" groups="ipc,memory"/> + <syscall name="shmctl" number="5030" groups="ipc"/> + <syscall name="dup" number="5031" groups="descriptor"/> + <syscall name="dup2" number="5032" groups="descriptor"/> + <syscall name="pause" number="5033" groups="signal"/> + <syscall name="nanosleep" number="5034"/> + <syscall name="getitimer" number="5035"/> + <syscall name="setitimer" number="5036"/> + <syscall name="alarm" number="5037"/> + <syscall name="getpid" number="5038"/> + <syscall name="sendfile" number="5039" groups="descriptor,network"/> + <syscall name="socket" number="5040" groups="network"/> + <syscall name="connect" number="5041" groups="network"/> + <syscall name="accept" number="5042" groups="network"/> + <syscall name="sendto" number="5043" groups="network"/> + <syscall name="recvfrom" number="5044" groups="network"/> + <syscall name="sendmsg" number="5045" groups="network"/> + <syscall name="recvmsg" number="5046" groups="network"/> + <syscall name="shutdown" number="5047" groups="network"/> + <syscall name="bind" number="5048" groups="network"/> + <syscall name="listen" number="5049" groups="network"/> + <syscall name="getsockname" number="5050" groups="network"/> + <syscall name="getpeername" number="5051" groups="network"/> + <syscall name="socketpair" number="5052" groups="network"/> + <syscall name="setsockopt" number="5053" groups="network"/> + <syscall name="getsockopt" number="5054" groups="network"/> + <syscall name="clone" number="5055" groups="process"/> + <syscall name="fork" number="5056" groups="process"/> + <syscall name="execve" number="5057" groups="file,process"/> + <syscall name="exit" number="5058" groups="process"/> + <syscall name="wait4" number="5059" groups="process"/> + <syscall name="kill" number="5060" groups="signal"/> + <syscall name="uname" number="5061"/> + <syscall name="semget" number="5062" groups="ipc"/> + <syscall name="semop" number="5063" groups="ipc"/> + <syscall name="semctl" number="5064" groups="ipc"/> + <syscall name="shmdt" number="5065" groups="ipc,memory"/> + <syscall name="msgget" number="5066" groups="ipc"/> + <syscall name="msgsnd" number="5067" groups="ipc"/> + <syscall name="msgrcv" number="5068" groups="ipc"/> + <syscall name="msgctl" number="5069" groups="ipc"/> + <syscall name="fcntl" number="5070" groups="descriptor"/> + <syscall name="flock" number="5071" groups="descriptor"/> + <syscall name="fsync" number="5072" groups="descriptor"/> + <syscall name="fdatasync" number="5073" groups="descriptor"/> + <syscall name="truncate" number="5074" groups="file"/> + <syscall name="ftruncate" number="5075" groups="descriptor"/> + <syscall name="getdents" number="5076" groups="descriptor"/> + <syscall name="getcwd" number="5077" groups="file"/> + <syscall name="chdir" number="5078" groups="file"/> + <syscall name="fchdir" number="5079" groups="descriptor"/> + <syscall name="rename" number="5080" groups="file"/> + <syscall name="mkdir" number="5081" groups="file"/> + <syscall name="rmdir" number="5082" groups="file"/> + <syscall name="creat" number="5083" groups="descriptor,file"/> + <syscall name="link" number="5084" groups="file"/> + <syscall name="unlink" number="5085" groups="file"/> + <syscall name="symlink" number="5086" groups="file"/> + <syscall name="readlink" number="5087" groups="file"/> + <syscall name="chmod" number="5088" groups="file"/> + <syscall name="fchmod" number="5089" groups="descriptor"/> + <syscall name="chown" number="5090" groups="file"/> + <syscall name="fchown" number="5091" groups="descriptor"/> + <syscall name="lchown" number="5092" groups="file"/> + <syscall name="umask" number="5093"/> + <syscall name="gettimeofday" number="5094"/> + <syscall name="getrlimit" number="5095"/> + <syscall name="getrusage" number="5096"/> + <syscall name="sysinfo" number="5097"/> + <syscall name="times" number="5098"/> + <syscall name="ptrace" number="5099"/> + <syscall name="getuid" number="5100"/> + <syscall name="syslog" number="5101"/> + <syscall name="getgid" number="5102"/> + <syscall name="setuid" number="5103"/> + <syscall name="setgid" number="5104"/> + <syscall name="geteuid" number="5105"/> + <syscall name="getegid" number="5106"/> + <syscall name="setpgid" number="5107"/> + <syscall name="getppid" number="5108"/> + <syscall name="getpgrp" number="5109"/> + <syscall name="setsid" number="5110"/> + <syscall name="setreuid" number="5111"/> + <syscall name="setregid" number="5112"/> + <syscall name="getgroups" number="5113"/> + <syscall name="setgroups" number="5114"/> + <syscall name="setresuid" number="5115"/> + <syscall name="getresuid" number="5116"/> + <syscall name="setresgid" number="5117"/> + <syscall name="getresgid" number="5118"/> + <syscall name="getpgid" number="5119"/> + <syscall name="setfsuid" number="5120"/> + <syscall name="setfsgid" number="5121"/> + <syscall name="getsid" number="5122"/> + <syscall name="capget" number="5123"/> + <syscall name="capset" number="5124"/> + <syscall name="rt_sigpending" number="5125" groups="signal"/> + <syscall name="rt_sigtimedwait" number="5126" groups="signal"/> + <syscall name="rt_sigqueueinfo" number="5127" groups="signal"/> + <syscall name="rt_sigsuspend" number="5128" groups="signal"/> + <syscall name="sigaltstack" number="5129" groups="signal"/> + <syscall name="utime" number="5130" groups="file"/> + <syscall name="mknod" number="5131" groups="file"/> + <syscall name="personality" number="5132"/> + <syscall name="ustat" number="5133"/> + <syscall name="statfs" number="5134" groups="file"/> + <syscall name="fstatfs" number="5135" groups="descriptor"/> + <syscall name="sysfs" number="5136"/> + <syscall name="getpriority" number="5137"/> + <syscall name="setpriority" number="5138"/> + <syscall name="sched_setparam" number="5139"/> + <syscall name="sched_getparam" number="5140"/> + <syscall name="sched_setscheduler" number="5141"/> + <syscall name="sched_getscheduler" number="5142"/> + <syscall name="sched_get_priority_max" number="5143"/> + <syscall name="sched_get_priority_min" number="5144"/> + <syscall name="sched_rr_get_interval" number="5145"/> + <syscall name="mlock" number="5146" groups="memory"/> + <syscall name="munlock" number="5147" groups="memory"/> + <syscall name="mlockall" number="5148" groups="memory"/> + <syscall name="munlockall" number="5149" groups="memory"/> + <syscall name="vhangup" number="5150"/> + <syscall name="pivot_root" number="5151" groups="file"/> + <syscall name="_sysctl" number="5152"/> + <syscall name="prctl" number="5153"/> + <syscall name="adjtimex" number="5154"/> + <syscall name="setrlimit" number="5155"/> + <syscall name="chroot" number="5156" groups="file"/> + <syscall name="sync" number="5157"/> + <syscall name="acct" number="5158" groups="file"/> + <syscall name="settimeofday" number="5159"/> + <syscall name="mount" number="5160" groups="file"/> + <syscall name="umount2" number="5161" groups="file"/> + <syscall name="swapon" number="5162" groups="file"/> + <syscall name="swapoff" number="5163" groups="file"/> + <syscall name="reboot" number="5164"/> + <syscall name="sethostname" number="5165"/> + <syscall name="setdomainname" number="5166"/> + <syscall name="create_module" number="5167"/> + <syscall name="init_module" number="5168"/> + <syscall name="delete_module" number="5169"/> + <syscall name="get_kernel_syms" number="5170"/> + <syscall name="query_module" number="5171"/> + <syscall name="quotactl" number="5172" groups="file"/> + <syscall name="nfsservctl" number="5173"/> + <syscall name="getpmsg" number="5174"/> + <syscall name="putpmsg" number="5175"/> + <syscall name="afs_syscall" number="5176"/> + <syscall name="gettid" number="5178"/> + <syscall name="readahead" number="5179" groups="descriptor"/> + <syscall name="setxattr" number="5180" groups="file"/> + <syscall name="lsetxattr" number="5181" groups="file"/> + <syscall name="fsetxattr" number="5182" groups="descriptor"/> + <syscall name="getxattr" number="5183" groups="file"/> + <syscall name="lgetxattr" number="5184" groups="file"/> + <syscall name="fgetxattr" number="5185" groups="descriptor"/> + <syscall name="listxattr" number="5186" groups="file"/> + <syscall name="llistxattr" number="5187" groups="file"/> + <syscall name="flistxattr" number="5188" groups="descriptor"/> + <syscall name="removexattr" number="5189" groups="file"/> + <syscall name="lremovexattr" number="5190" groups="file"/> + <syscall name="fremovexattr" number="5191" groups="descriptor"/> + <syscall name="tkill" number="5192" groups="signal"/> + <syscall name="futex" number="5194"/> + <syscall name="sched_setaffinity" number="5195"/> + <syscall name="sched_getaffinity" number="5196"/> + <syscall name="cacheflush" number="5197"/> + <syscall name="cachectl" number="5198"/> + <syscall name="sysmips" number="5199"/> + <syscall name="io_setup" number="5200"/> + <syscall name="io_destroy" number="5201"/> + <syscall name="io_getevents" number="5202"/> + <syscall name="io_submit" number="5203"/> + <syscall name="io_cancel" number="5204"/> + <syscall name="exit_group" number="5205" groups="process"/> + <syscall name="lookup_dcookie" number="5206"/> + <syscall name="epoll_create" number="5207" groups="descriptor"/> + <syscall name="epoll_ctl" number="5208" groups="descriptor"/> + <syscall name="epoll_wait" number="5209" groups="descriptor"/> + <syscall name="remap_file_pages" number="5210" groups="memory"/> + <syscall name="rt_sigreturn" number="5211" groups="signal"/> + <syscall name="set_tid_address" number="5212"/> + <syscall name="restart_syscall" number="5213"/> + <syscall name="semtimedop" number="5214" groups="ipc"/> + <syscall name="fadvise64" number="5215" groups="descriptor"/> + <syscall name="timer_create" number="5216"/> + <syscall name="timer_settime" number="5217"/> + <syscall name="timer_gettime" number="5218"/> + <syscall name="timer_getoverrun" number="5219"/> + <syscall name="timer_delete" number="5220"/> + <syscall name="clock_settime" number="5221"/> + <syscall name="clock_gettime" number="5222"/> + <syscall name="clock_getres" number="5223"/> + <syscall name="clock_nanosleep" number="5224"/> + <syscall name="tgkill" number="5225" groups="signal"/> + <syscall name="utimes" number="5226" groups="file"/> + <syscall name="mbind" number="5227" groups="memory"/> + <syscall name="get_mempolicy" number="5228" groups="memory"/> + <syscall name="set_mempolicy" number="5229" groups="memory"/> + <syscall name="mq_open" number="5230"/> + <syscall name="mq_unlink" number="5231"/> + <syscall name="mq_timedsend" number="5232"/> + <syscall name="mq_timedreceive" number="5233"/> + <syscall name="mq_notify" number="5234"/> + <syscall name="mq_getsetattr" number="5235"/> + <syscall name="vserver" number="5236"/> + <syscall name="waitid" number="5237" groups="process"/> + <syscall name="add_key" number="5239"/> + <syscall name="request_key" number="5240"/> + <syscall name="keyctl" number="5241"/> + <syscall name="set_thread_area" number="5242"/> + <syscall name="inotify_init" number="5243" groups="descriptor"/> + <syscall name="inotify_add_watch" number="5244" groups="descriptor"/> + <syscall name="inotify_rm_watch" number="5245" groups="descriptor"/> + <syscall name="migrate_pages" number="5246" groups="memory"/> + <syscall name="openat" number="5247" groups="descriptor,file"/> + <syscall name="mkdirat" number="5248" groups="descriptor,file"/> + <syscall name="mknodat" number="5249" groups="descriptor,file"/> + <syscall name="fchownat" number="5250" groups="descriptor,file"/> + <syscall name="futimesat" number="5251" groups="descriptor,file"/> + <syscall name="newfstatat" number="5252" groups="descriptor,file"/> + <syscall name="unlinkat" number="5253" groups="descriptor,file"/> + <syscall name="renameat" number="5254" groups="descriptor,file"/> + <syscall name="linkat" number="5255" groups="descriptor,file"/> + <syscall name="symlinkat" number="5256" groups="descriptor,file"/> + <syscall name="readlinkat" number="5257" groups="descriptor,file"/> + <syscall name="fchmodat" number="5258" groups="descriptor,file"/> + <syscall name="faccessat" number="5259" groups="descriptor,file"/> + <syscall name="pselect6" number="5260" groups="descriptor"/> + <syscall name="ppoll" number="5261" groups="descriptor"/> + <syscall name="unshare" number="5262" groups="process"/> + <syscall name="splice" number="5263" groups="descriptor"/> + <syscall name="sync_file_range" number="5264" groups="descriptor"/> + <syscall name="tee" number="5265" groups="descriptor"/> + <syscall name="vmsplice" number="5266" groups="descriptor"/> + <syscall name="move_pages" number="5267" groups="memory"/> + <syscall name="set_robust_list" number="5268"/> + <syscall name="get_robust_list" number="5269"/> + <syscall name="kexec_load" number="5270"/> + <syscall name="getcpu" number="5271"/> + <syscall name="epoll_pwait" number="5272" groups="descriptor"/> + <syscall name="ioprio_set" number="5273"/> + <syscall name="ioprio_get" number="5274"/> + <syscall name="utimensat" number="5275" groups="descriptor,file"/> + <syscall name="signalfd" number="5276" groups="descriptor,signal"/> + <syscall name="timerfd" number="5277" groups="descriptor"/> + <syscall name="eventfd" number="5278" groups="descriptor"/> + <syscall name="fallocate" number="5279" groups="descriptor"/> + <syscall name="timerfd_create" number="5280" groups="descriptor"/> + <syscall name="timerfd_gettime" number="5281" groups="descriptor"/> + <syscall name="timerfd_settime" number="5282" groups="descriptor"/> + <syscall name="signalfd4" number="5283" groups="descriptor,signal"/> + <syscall name="eventfd2" number="5284" groups="descriptor"/> + <syscall name="epoll_create1" number="5285" groups="descriptor"/> + <syscall name="dup3" number="5286" groups="descriptor"/> + <syscall name="pipe2" number="5287" groups="descriptor"/> + <syscall name="inotify_init1" number="5288" groups="descriptor"/> + <syscall name="preadv" number="5289" groups="descriptor"/> + <syscall name="pwritev" number="5290" groups="descriptor"/> + <syscall name="rt_tgsigqueueinfo" number="5291" groups="process,signal"/> + <syscall name="perf_event_open" number="5292" groups="descriptor"/> + <syscall name="accept4" number="5293" groups="network"/> + <syscall name="recvmmsg" number="5294" groups="network"/> + <syscall name="fanotify_init" number="5295" groups="descriptor"/> + <syscall name="fanotify_mark" number="5296" groups="descriptor,file"/> + <syscall name="prlimit64" number="5297"/> +</syscalls_info> diff --git a/tools/msys/mingw32/share/gdb/syscalls/mips-o32-linux.xml b/tools/msys/mingw32/share/gdb/syscalls/mips-o32-linux.xml new file mode 100644 index 0000000000000000000000000000000000000000..5cc086a9a28be09edbe75d56015ffb9a0f15efbb --- /dev/null +++ b/tools/msys/mingw32/share/gdb/syscalls/mips-o32-linux.xml @@ -0,0 +1,344 @@ +<?xml version="1.0"?> +<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd"> +<!-- Copyright (C) 2011-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> +<!-- This file was generated using the following file: + + /usr/src/linux/arch/mips/include/asm/unistd.h + + The file mentioned above belongs to the Linux Kernel. --> +<syscalls_info> + <syscall name="syscall" number="4000"/> + <syscall name="exit" number="4001" groups="process"/> + <syscall name="fork" number="4002" groups="process"/> + <syscall name="read" number="4003" groups="descriptor"/> + <syscall name="write" number="4004" groups="descriptor"/> + <syscall name="open" number="4005" groups="descriptor,file"/> + <syscall name="close" number="4006" groups="descriptor"/> + <syscall name="waitpid" number="4007" groups="process"/> + <syscall name="creat" number="4008" groups="descriptor,file"/> + <syscall name="link" number="4009" groups="file"/> + <syscall name="unlink" number="4010" groups="file"/> + <syscall name="execve" number="4011" groups="file,process"/> + <syscall name="chdir" number="4012" groups="file"/> + <syscall name="time" number="4013"/> + <syscall name="mknod" number="4014" groups="file"/> + <syscall name="chmod" number="4015" groups="file"/> + <syscall name="lchown" number="4016" groups="file"/> + <syscall name="break" number="4017" groups="memory"/> + <syscall name="lseek" number="4019" groups="descriptor"/> + <syscall name="getpid" number="4020"/> + <syscall name="mount" number="4021" groups="file"/> + <syscall name="umount" number="4022" groups="file"/> + <syscall name="setuid" number="4023"/> + <syscall name="getuid" number="4024"/> + <syscall name="stime" number="4025"/> + <syscall name="ptrace" number="4026"/> + <syscall name="alarm" number="4027"/> + <syscall name="pause" number="4029" groups="signal"/> + <syscall name="utime" number="4030" groups="file"/> + <syscall name="stty" number="4031"/> + <syscall name="gtty" number="4032"/> + <syscall name="access" number="4033" groups="file"/> + <syscall name="nice" number="4034"/> + <syscall name="ftime" number="4035"/> + <syscall name="sync" number="4036"/> + <syscall name="kill" number="4037" groups="signal"/> + <syscall name="rename" number="4038" groups="file"/> + <syscall name="mkdir" number="4039" groups="file"/> + <syscall name="rmdir" number="4040" groups="file"/> + <syscall name="dup" number="4041" groups="descriptor"/> + <syscall name="pipe" number="4042" groups="descriptor"/> + <syscall name="times" number="4043"/> + <syscall name="prof" number="4044"/> + <syscall name="brk" number="4045" groups="memory"/> + <syscall name="setgid" number="4046"/> + <syscall name="getgid" number="4047"/> + <syscall name="signal" number="4048" groups="signal"/> + <syscall name="geteuid" number="4049"/> + <syscall name="getegid" number="4050"/> + <syscall name="acct" number="4051" groups="file"/> + <syscall name="umount2" number="4052" groups="file"/> + <syscall name="lock" number="4053"/> + <syscall name="ioctl" number="4054" groups="descriptor"/> + <syscall name="fcntl" number="4055" groups="descriptor"/> + <syscall name="mpx" number="4056"/> + <syscall name="setpgid" number="4057"/> + <syscall name="ulimit" number="4058"/> + <syscall name="umask" number="4060"/> + <syscall name="chroot" number="4061" groups="file"/> + <syscall name="ustat" number="4062"/> + <syscall name="dup2" number="4063" groups="descriptor"/> + <syscall name="getppid" number="4064"/> + <syscall name="getpgrp" number="4065"/> + <syscall name="setsid" number="4066"/> + <syscall name="sigaction" number="4067" groups="signal"/> + <syscall name="sgetmask" number="4068" groups="signal"/> + <syscall name="ssetmask" number="4069" groups="signal"/> + <syscall name="setreuid" number="4070"/> + <syscall name="setregid" number="4071"/> + <syscall name="sigsuspend" number="4072" groups="signal"/> + <syscall name="sigpending" number="4073" groups="signal"/> + <syscall name="sethostname" number="4074"/> + <syscall name="setrlimit" number="4075"/> + <syscall name="getrlimit" number="4076"/> + <syscall name="getrusage" number="4077"/> + <syscall name="gettimeofday" number="4078"/> + <syscall name="settimeofday" number="4079"/> + <syscall name="getgroups" number="4080"/> + <syscall name="setgroups" number="4081"/> + <syscall name="symlink" number="4083" groups="file"/> + <syscall name="readlink" number="4085" groups="file"/> + <syscall name="uselib" number="4086" groups="file"/> + <syscall name="swapon" number="4087" groups="file"/> + <syscall name="reboot" number="4088"/> + <syscall name="readdir" number="4089" groups="descriptor"/> + <syscall name="mmap" number="4090" groups="descriptor,memory"/> + <syscall name="munmap" number="4091" groups="memory"/> + <syscall name="truncate" number="4092" groups="file"/> + <syscall name="ftruncate" number="4093" groups="descriptor"/> + <syscall name="fchmod" number="4094" groups="descriptor"/> + <syscall name="fchown" number="4095" groups="descriptor"/> + <syscall name="getpriority" number="4096"/> + <syscall name="setpriority" number="4097"/> + <syscall name="profil" number="4098"/> + <syscall name="statfs" number="4099" groups="file"/> + <syscall name="fstatfs" number="4100" groups="descriptor"/> + <syscall name="ioperm" number="4101"/> + <syscall name="socketcall" number="4102" groups="descriptor"/> + <syscall name="syslog" number="4103"/> + <syscall name="setitimer" number="4104"/> + <syscall name="getitimer" number="4105"/> + <syscall name="stat" number="4106" groups="file"/> + <syscall name="lstat" number="4107" groups="file"/> + <syscall name="fstat" number="4108" groups="descriptor"/> + <syscall name="iopl" number="4110"/> + <syscall name="vhangup" number="4111"/> + <syscall name="idle" number="4112"/> + <syscall name="vm86" number="4113"/> + <syscall name="wait4" number="4114" groups="process"/> + <syscall name="swapoff" number="4115" groups="file"/> + <syscall name="sysinfo" number="4116"/> + <syscall name="ipc" number="4117" groups="ipc"/> + <syscall name="fsync" number="4118" groups="descriptor"/> + <syscall name="sigreturn" number="4119" groups="signal"/> + <syscall name="clone" number="4120" groups="process"/> + <syscall name="setdomainname" number="4121"/> + <syscall name="uname" number="4122"/> + <syscall name="modify_ldt" number="4123"/> + <syscall name="adjtimex" number="4124"/> + <syscall name="mprotect" number="4125" groups="memory"/> + <syscall name="sigprocmask" number="4126" groups="signal"/> + <syscall name="create_module" number="4127"/> + <syscall name="init_module" number="4128"/> + <syscall name="delete_module" number="4129"/> + <syscall name="get_kernel_syms" number="4130"/> + <syscall name="quotactl" number="4131" groups="file"/> + <syscall name="getpgid" number="4132"/> + <syscall name="fchdir" number="4133" groups="descriptor"/> + <syscall name="bdflush" number="4134"/> + <syscall name="sysfs" number="4135"/> + <syscall name="personality" number="4136"/> + <syscall name="afs_syscall" number="4137"/> + <syscall name="setfsuid" number="4138"/> + <syscall name="setfsgid" number="4139"/> + <syscall name="_llseek" number="4140" groups="descriptor"/> + <syscall name="getdents" number="4141" groups="descriptor"/> + <syscall name="_newselect" number="4142" groups="descriptor"/> + <syscall name="flock" number="4143" groups="descriptor"/> + <syscall name="msync" number="4144" groups="memory"/> + <syscall name="readv" number="4145" groups="descriptor"/> + <syscall name="writev" number="4146" groups="descriptor"/> + <syscall name="cacheflush" number="4147"/> + <syscall name="cachectl" number="4148"/> + <syscall name="sysmips" number="4149"/> + <syscall name="getsid" number="4151"/> + <syscall name="fdatasync" number="4152" groups="descriptor"/> + <syscall name="_sysctl" number="4153"/> + <syscall name="mlock" number="4154" groups="memory"/> + <syscall name="munlock" number="4155" groups="memory"/> + <syscall name="mlockall" number="4156" groups="memory"/> + <syscall name="munlockall" number="4157" groups="memory"/> + <syscall name="sched_setparam" number="4158"/> + <syscall name="sched_getparam" number="4159"/> + <syscall name="sched_setscheduler" number="4160"/> + <syscall name="sched_getscheduler" number="4161"/> + <syscall name="sched_yield" number="4162"/> + <syscall name="sched_get_priority_max" number="4163"/> + <syscall name="sched_get_priority_min" number="4164"/> + <syscall name="sched_rr_get_interval" number="4165"/> + <syscall name="nanosleep" number="4166"/> + <syscall name="mremap" number="4167" groups="memory"/> + <syscall name="accept" number="4168" groups="network"/> + <syscall name="bind" number="4169" groups="network"/> + <syscall name="connect" number="4170" groups="network"/> + <syscall name="getpeername" number="4171" groups="network"/> + <syscall name="getsockname" number="4172" groups="network"/> + <syscall name="getsockopt" number="4173" groups="network"/> + <syscall name="listen" number="4174" groups="network"/> + <syscall name="recv" number="4175" groups="network"/> + <syscall name="recvfrom" number="4176" groups="network"/> + <syscall name="recvmsg" number="4177" groups="network"/> + <syscall name="send" number="4178" groups="network"/> + <syscall name="sendmsg" number="4179" groups="network"/> + <syscall name="sendto" number="4180" groups="network"/> + <syscall name="setsockopt" number="4181" groups="network"/> + <syscall name="shutdown" number="4182" groups="network"/> + <syscall name="socket" number="4183" groups="network"/> + <syscall name="socketpair" number="4184" groups="network"/> + <syscall name="setresuid" number="4185"/> + <syscall name="getresuid" number="4186"/> + <syscall name="query_module" number="4187"/> + <syscall name="poll" number="4188" groups="descriptor"/> + <syscall name="nfsservctl" number="4189"/> + <syscall name="setresgid" number="4190"/> + <syscall name="getresgid" number="4191"/> + <syscall name="prctl" number="4192"/> + <syscall name="rt_sigreturn" number="4193" groups="signal"/> + <syscall name="rt_sigaction" number="4194" groups="signal"/> + <syscall name="rt_sigprocmask" number="4195" groups="signal"/> + <syscall name="rt_sigpending" number="4196" groups="signal"/> + <syscall name="rt_sigtimedwait" number="4197" groups="signal"/> + <syscall name="rt_sigqueueinfo" number="4198" groups="signal"/> + <syscall name="rt_sigsuspend" number="4199" groups="signal"/> + <syscall name="pread64" number="4200" groups="descriptor"/> + <syscall name="pwrite64" number="4201" groups="descriptor"/> + <syscall name="chown" number="4202" groups="file"/> + <syscall name="getcwd" number="4203" groups="file"/> + <syscall name="capget" number="4204"/> + <syscall name="capset" number="4205"/> + <syscall name="sigaltstack" number="4206" groups="signal"/> + <syscall name="sendfile" number="4207" groups="descriptor,network"/> + <syscall name="getpmsg" number="4208"/> + <syscall name="putpmsg" number="4209"/> + <syscall name="mmap2" number="4210" groups="descriptor,memory"/> + <syscall name="truncate64" number="4211" groups="file"/> + <syscall name="ftruncate64" number="4212" groups="descriptor"/> + <syscall name="stat64" number="4213" groups="file"/> + <syscall name="lstat64" number="4214" groups="file"/> + <syscall name="fstat64" number="4215" groups="descriptor"/> + <syscall name="pivot_root" number="4216" groups="file"/> + <syscall name="mincore" number="4217" groups="memory"/> + <syscall name="madvise" number="4218" groups="memory"/> + <syscall name="getdents64" number="4219" groups="descriptor"/> + <syscall name="fcntl64" number="4220" groups="descriptor"/> + <syscall name="gettid" number="4222"/> + <syscall name="readahead" number="4223" groups="descriptor"/> + <syscall name="setxattr" number="4224" groups="file"/> + <syscall name="lsetxattr" number="4225" groups="file"/> + <syscall name="fsetxattr" number="4226" groups="descriptor"/> + <syscall name="getxattr" number="4227" groups="file"/> + <syscall name="lgetxattr" number="4228" groups="file"/> + <syscall name="fgetxattr" number="4229" groups="descriptor"/> + <syscall name="listxattr" number="4230" groups="file"/> + <syscall name="llistxattr" number="4231" groups="file"/> + <syscall name="flistxattr" number="4232" groups="descriptor"/> + <syscall name="removexattr" number="4233" groups="file"/> + <syscall name="lremovexattr" number="4234" groups="file"/> + <syscall name="fremovexattr" number="4235" groups="descriptor"/> + <syscall name="tkill" number="4236" groups="signal"/> + <syscall name="sendfile64" number="4237" groups="descriptor,network"/> + <syscall name="futex" number="4238"/> + <syscall name="sched_setaffinity" number="4239"/> + <syscall name="sched_getaffinity" number="4240"/> + <syscall name="io_setup" number="4241"/> + <syscall name="io_destroy" number="4242"/> + <syscall name="io_getevents" number="4243"/> + <syscall name="io_submit" number="4244"/> + <syscall name="io_cancel" number="4245"/> + <syscall name="exit_group" number="4246" groups="process"/> + <syscall name="lookup_dcookie" number="4247"/> + <syscall name="epoll_create" number="4248" groups="descriptor"/> + <syscall name="epoll_ctl" number="4249" groups="descriptor"/> + <syscall name="epoll_wait" number="4250" groups="descriptor"/> + <syscall name="remap_file_pages" number="4251" groups="memory"/> + <syscall name="set_tid_address" number="4252"/> + <syscall name="restart_syscall" number="4253"/> + <syscall name="fadvise64" number="4254" groups="descriptor"/> + <syscall name="statfs64" number="4255" groups="file"/> + <syscall name="fstatfs64" number="4256" groups="descriptor"/> + <syscall name="timer_create" number="4257"/> + <syscall name="timer_settime" number="4258"/> + <syscall name="timer_gettime" number="4259"/> + <syscall name="timer_getoverrun" number="4260"/> + <syscall name="timer_delete" number="4261"/> + <syscall name="clock_settime" number="4262"/> + <syscall name="clock_gettime" number="4263"/> + <syscall name="clock_getres" number="4264"/> + <syscall name="clock_nanosleep" number="4265"/> + <syscall name="tgkill" number="4266" groups="signal"/> + <syscall name="utimes" number="4267" groups="file"/> + <syscall name="mbind" number="4268" groups="memory"/> + <syscall name="get_mempolicy" number="4269" groups="memory"/> + <syscall name="set_mempolicy" number="4270" groups="memory"/> + <syscall name="mq_open" number="4271"/> + <syscall name="mq_unlink" number="4272"/> + <syscall name="mq_timedsend" number="4273"/> + <syscall name="mq_timedreceive" number="4274"/> + <syscall name="mq_notify" number="4275"/> + <syscall name="mq_getsetattr" number="4276"/> + <syscall name="vserver" number="4277"/> + <syscall name="waitid" number="4278" groups="process"/> + <syscall name="add_key" number="4280"/> + <syscall name="request_key" number="4281"/> + <syscall name="keyctl" number="4282"/> + <syscall name="set_thread_area" number="4283"/> + <syscall name="inotify_init" number="4284" groups="descriptor"/> + <syscall name="inotify_add_watch" number="4285" groups="descriptor"/> + <syscall name="inotify_rm_watch" number="4286" groups="descriptor"/> + <syscall name="migrate_pages" number="4287" groups="memory"/> + <syscall name="openat" number="4288" groups="descriptor,file"/> + <syscall name="mkdirat" number="4289" groups="descriptor,file"/> + <syscall name="mknodat" number="4290" groups="descriptor,file"/> + <syscall name="fchownat" number="4291" groups="descriptor,file"/> + <syscall name="futimesat" number="4292" groups="descriptor,file"/> + <syscall name="fstatat64" number="4293" groups="descriptor,file"/> + <syscall name="unlinkat" number="4294" groups="descriptor,file"/> + <syscall name="renameat" number="4295" groups="descriptor,file"/> + <syscall name="linkat" number="4296" groups="descriptor,file"/> + <syscall name="symlinkat" number="4297" groups="descriptor,file"/> + <syscall name="readlinkat" number="4298" groups="descriptor,file"/> + <syscall name="fchmodat" number="4299" groups="descriptor,file"/> + <syscall name="faccessat" number="4300" groups="descriptor,file"/> + <syscall name="pselect6" number="4301" groups="descriptor"/> + <syscall name="ppoll" number="4302" groups="descriptor"/> + <syscall name="unshare" number="4303" groups="process"/> + <syscall name="splice" number="4304" groups="descriptor"/> + <syscall name="sync_file_range" number="4305" groups="descriptor"/> + <syscall name="tee" number="4306" groups="descriptor"/> + <syscall name="vmsplice" number="4307" groups="descriptor"/> + <syscall name="move_pages" number="4308" groups="memory"/> + <syscall name="set_robust_list" number="4309"/> + <syscall name="get_robust_list" number="4310"/> + <syscall name="kexec_load" number="4311"/> + <syscall name="getcpu" number="4312"/> + <syscall name="epoll_pwait" number="4313" groups="descriptor"/> + <syscall name="ioprio_set" number="4314"/> + <syscall name="ioprio_get" number="4315"/> + <syscall name="utimensat" number="4316" groups="descriptor,file"/> + <syscall name="signalfd" number="4317" groups="descriptor,signal"/> + <syscall name="timerfd" number="4318" groups="descriptor"/> + <syscall name="eventfd" number="4319" groups="descriptor"/> + <syscall name="fallocate" number="4320" groups="descriptor"/> + <syscall name="timerfd_create" number="4321" groups="descriptor"/> + <syscall name="timerfd_gettime" number="4322" groups="descriptor"/> + <syscall name="timerfd_settime" number="4323" groups="descriptor"/> + <syscall name="signalfd4" number="4324" groups="descriptor,signal"/> + <syscall name="eventfd2" number="4325" groups="descriptor"/> + <syscall name="epoll_create1" number="4326" groups="descriptor"/> + <syscall name="dup3" number="4327" groups="descriptor"/> + <syscall name="pipe2" number="4328" groups="descriptor"/> + <syscall name="inotify_init1" number="4329" groups="descriptor"/> + <syscall name="preadv" number="4330" groups="descriptor"/> + <syscall name="pwritev" number="4331" groups="descriptor"/> + <syscall name="rt_tgsigqueueinfo" number="4332" groups="process,signal"/> + <syscall name="perf_event_open" number="4333" groups="descriptor"/> + <syscall name="accept4" number="4334" groups="network"/> + <syscall name="recvmmsg" number="4335" groups="network"/> + <syscall name="fanotify_init" number="4336" groups="descriptor"/> + <syscall name="fanotify_mark" number="4337" groups="descriptor,file"/> + <syscall name="prlimit64" number="4338"/> +</syscalls_info> diff --git a/tools/msys/mingw32/share/gdb/syscalls/ppc-linux.xml b/tools/msys/mingw32/share/gdb/syscalls/ppc-linux.xml new file mode 100644 index 0000000000000000000000000000000000000000..a733d37237f9d26dddd27740690e15bbe6e3b405 --- /dev/null +++ b/tools/msys/mingw32/share/gdb/syscalls/ppc-linux.xml @@ -0,0 +1,307 @@ +<?xml version="1.0"?> +<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd"> +<!-- Copyright (C) 2009-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> +<!-- This file was generated using the following file: + + /usr/src/linux/arch/powerpc/include/asm/unistd.h + + The file mentioned above belongs to the Linux Kernel. --> +<syscalls_info> + <syscall name="restart_syscall" number="0"/> + <syscall name="exit" number="1" groups="process"/> + <syscall name="fork" number="2" groups="process"/> + <syscall name="read" number="3" groups="descriptor"/> + <syscall name="write" number="4" groups="descriptor"/> + <syscall name="open" number="5" groups="descriptor,file"/> + <syscall name="close" number="6" groups="descriptor"/> + <syscall name="waitpid" number="7" groups="process"/> + <syscall name="creat" number="8" groups="descriptor,file"/> + <syscall name="link" number="9" groups="file"/> + <syscall name="unlink" number="10" groups="file"/> + <syscall name="execve" number="11" groups="file,process"/> + <syscall name="chdir" number="12" groups="file"/> + <syscall name="time" number="13"/> + <syscall name="mknod" number="14" groups="file"/> + <syscall name="chmod" number="15" groups="file"/> + <syscall name="lchown" number="16" groups="file"/> + <syscall name="break" number="17" groups="memory"/> + <syscall name="oldstat" number="18" groups="file"/> + <syscall name="lseek" number="19" groups="descriptor"/> + <syscall name="getpid" number="20"/> + <syscall name="mount" number="21" groups="file"/> + <syscall name="umount" number="22" groups="file"/> + <syscall name="setuid" number="23"/> + <syscall name="getuid" number="24"/> + <syscall name="stime" number="25"/> + <syscall name="ptrace" number="26"/> + <syscall name="alarm" number="27"/> + <syscall name="oldfstat" number="28" groups="descriptor"/> + <syscall name="pause" number="29" groups="signal"/> + <syscall name="utime" number="30" groups="file"/> + <syscall name="stty" number="31"/> + <syscall name="gtty" number="32"/> + <syscall name="access" number="33" groups="file"/> + <syscall name="nice" number="34"/> + <syscall name="ftime" number="35"/> + <syscall name="sync" number="36"/> + <syscall name="kill" number="37" groups="signal"/> + <syscall name="rename" number="38" groups="file"/> + <syscall name="mkdir" number="39" groups="file"/> + <syscall name="rmdir" number="40" groups="file"/> + <syscall name="dup" number="41" groups="descriptor"/> + <syscall name="pipe" number="42" groups="descriptor"/> + <syscall name="times" number="43"/> + <syscall name="prof" number="44"/> + <syscall name="brk" number="45" groups="memory"/> + <syscall name="setgid" number="46"/> + <syscall name="getgid" number="47"/> + <syscall name="signal" number="48" groups="signal"/> + <syscall name="geteuid" number="49"/> + <syscall name="getegid" number="50"/> + <syscall name="acct" number="51" groups="file"/> + <syscall name="umount2" number="52" groups="file"/> + <syscall name="lock" number="53"/> + <syscall name="ioctl" number="54" groups="descriptor"/> + <syscall name="fcntl" number="55" groups="descriptor"/> + <syscall name="mpx" number="56"/> + <syscall name="setpgid" number="57"/> + <syscall name="ulimit" number="58"/> + <syscall name="oldolduname" number="59"/> + <syscall name="umask" number="60"/> + <syscall name="chroot" number="61" groups="file"/> + <syscall name="ustat" number="62"/> + <syscall name="dup2" number="63" groups="descriptor"/> + <syscall name="getppid" number="64"/> + <syscall name="getpgrp" number="65"/> + <syscall name="setsid" number="66"/> + <syscall name="sigaction" number="67" groups="signal"/> + <syscall name="sgetmask" number="68" groups="signal"/> + <syscall name="ssetmask" number="69" groups="signal"/> + <syscall name="setreuid" number="70"/> + <syscall name="setregid" number="71"/> + <syscall name="sigsuspend" number="72" groups="signal"/> + <syscall name="sigpending" number="73" groups="signal"/> + <syscall name="sethostname" number="74"/> + <syscall name="setrlimit" number="75"/> + <syscall name="getrlimit" number="76"/> + <syscall name="getrusage" number="77"/> + <syscall name="gettimeofday" number="78"/> + <syscall name="settimeofday" number="79"/> + <syscall name="getgroups" number="80"/> + <syscall name="setgroups" number="81"/> + <syscall name="select" number="82" groups="descriptor"/> + <syscall name="symlink" number="83" groups="file"/> + <syscall name="oldlstat" number="84" groups="file"/> + <syscall name="readlink" number="85" groups="file"/> + <syscall name="uselib" number="86" groups="file"/> + <syscall name="swapon" number="87" groups="file"/> + <syscall name="reboot" number="88"/> + <syscall name="readdir" number="89" groups="descriptor"/> + <syscall name="mmap" number="90" groups="descriptor,memory"/> + <syscall name="munmap" number="91" groups="memory"/> + <syscall name="truncate" number="92" groups="file"/> + <syscall name="ftruncate" number="93" groups="descriptor"/> + <syscall name="fchmod" number="94" groups="descriptor"/> + <syscall name="fchown" number="95" groups="descriptor"/> + <syscall name="getpriority" number="96"/> + <syscall name="setpriority" number="97"/> + <syscall name="profil" number="98"/> + <syscall name="statfs" number="99" groups="file"/> + <syscall name="fstatfs" number="100" groups="descriptor"/> + <syscall name="ioperm" number="101"/> + <syscall name="socketcall" number="102" groups="descriptor"/> + <syscall name="syslog" number="103"/> + <syscall name="setitimer" number="104"/> + <syscall name="getitimer" number="105"/> + <syscall name="stat" number="106" groups="file"/> + <syscall name="lstat" number="107" groups="file"/> + <syscall name="fstat" number="108" groups="descriptor"/> + <syscall name="olduname" number="109"/> + <syscall name="iopl" number="110"/> + <syscall name="vhangup" number="111"/> + <syscall name="idle" number="112"/> + <syscall name="vm86" number="113"/> + <syscall name="wait4" number="114" groups="process"/> + <syscall name="swapoff" number="115" groups="file"/> + <syscall name="sysinfo" number="116"/> + <syscall name="ipc" number="117" groups="ipc"/> + <syscall name="fsync" number="118" groups="descriptor"/> + <syscall name="sigreturn" number="119" groups="signal"/> + <syscall name="clone" number="120" groups="process"/> + <syscall name="setdomainname" number="121"/> + <syscall name="uname" number="122"/> + <syscall name="modify_ldt" number="123"/> + <syscall name="adjtimex" number="124"/> + <syscall name="mprotect" number="125" groups="memory"/> + <syscall name="sigprocmask" number="126" groups="signal"/> + <syscall name="create_module" number="127"/> + <syscall name="init_module" number="128"/> + <syscall name="delete_module" number="129"/> + <syscall name="get_kernel_syms" number="130"/> + <syscall name="quotactl" number="131" groups="file"/> + <syscall name="getpgid" number="132"/> + <syscall name="fchdir" number="133" groups="descriptor"/> + <syscall name="bdflush" number="134"/> + <syscall name="sysfs" number="135"/> + <syscall name="personality" number="136"/> + <syscall name="afs_syscall" number="137"/> + <syscall name="setfsuid" number="138"/> + <syscall name="setfsgid" number="139"/> + <syscall name="_llseek" number="140" groups="descriptor"/> + <syscall name="getdents" number="141" groups="descriptor"/> + <syscall name="_newselect" number="142" groups="descriptor"/> + <syscall name="flock" number="143" groups="descriptor"/> + <syscall name="msync" number="144" groups="memory"/> + <syscall name="readv" number="145" groups="descriptor"/> + <syscall name="writev" number="146" groups="descriptor"/> + <syscall name="getsid" number="147"/> + <syscall name="fdatasync" number="148" groups="descriptor"/> + <syscall name="_sysctl" number="149"/> + <syscall name="mlock" number="150" groups="memory"/> + <syscall name="munlock" number="151" groups="memory"/> + <syscall name="mlockall" number="152" groups="memory"/> + <syscall name="munlockall" number="153" groups="memory"/> + <syscall name="sched_setparam" number="154"/> + <syscall name="sched_getparam" number="155"/> + <syscall name="sched_setscheduler" number="156"/> + <syscall name="sched_getscheduler" number="157"/> + <syscall name="sched_yield" number="158"/> + <syscall name="sched_get_priority_max" number="159"/> + <syscall name="sched_get_priority_min" number="160"/> + <syscall name="sched_rr_get_interval" number="161"/> + <syscall name="nanosleep" number="162"/> + <syscall name="mremap" number="163" groups="memory"/> + <syscall name="setresuid" number="164"/> + <syscall name="getresuid" number="165"/> + <syscall name="query_module" number="166"/> + <syscall name="poll" number="167" groups="descriptor"/> + <syscall name="nfsservctl" number="168"/> + <syscall name="setresgid" number="169"/> + <syscall name="getresgid" number="170"/> + <syscall name="prctl" number="171"/> + <syscall name="rt_sigreturn" number="172" groups="signal"/> + <syscall name="rt_sigaction" number="173" groups="signal"/> + <syscall name="rt_sigprocmask" number="174" groups="signal"/> + <syscall name="rt_sigpending" number="175" groups="signal"/> + <syscall name="rt_sigtimedwait" number="176" groups="signal"/> + <syscall name="rt_sigqueueinfo" number="177" groups="signal"/> + <syscall name="rt_sigsuspend" number="178" groups="signal"/> + <syscall name="pread64" number="179" groups="descriptor"/> + <syscall name="pwrite64" number="180" groups="descriptor"/> + <syscall name="chown" number="181" groups="file"/> + <syscall name="getcwd" number="182" groups="file"/> + <syscall name="capget" number="183"/> + <syscall name="capset" number="184"/> + <syscall name="sigaltstack" number="185" groups="signal"/> + <syscall name="sendfile" number="186" groups="descriptor,network"/> + <syscall name="getpmsg" number="187"/> + <syscall name="putpmsg" number="188"/> + <syscall name="vfork" number="189" groups="process"/> + <syscall name="ugetrlimit" number="190"/> + <syscall name="readahead" number="191" groups="descriptor"/> + <syscall name="mmap2" number="192" groups="descriptor,memory"/> + <syscall name="truncate64" number="193" groups="file"/> + <syscall name="ftruncate64" number="194" groups="descriptor"/> + <syscall name="stat64" number="195" groups="file"/> + <syscall name="lstat64" number="196" groups="file"/> + <syscall name="fstat64" number="197" groups="descriptor"/> + <syscall name="pciconfig_read" number="198"/> + <syscall name="pciconfig_write" number="199"/> + <syscall name="pciconfig_iobase" number="200"/> + <syscall name="multiplexer" number="201"/> + <syscall name="getdents64" number="202" groups="descriptor"/> + <syscall name="pivot_root" number="203" groups="file"/> + <syscall name="fcntl64" number="204" groups="descriptor"/> + <syscall name="madvise" number="205" groups="memory"/> + <syscall name="mincore" number="206" groups="memory"/> + <syscall name="gettid" number="207"/> + <syscall name="tkill" number="208" groups="signal"/> + <syscall name="setxattr" number="209" groups="file"/> + <syscall name="lsetxattr" number="210" groups="file"/> + <syscall name="fsetxattr" number="211" groups="descriptor"/> + <syscall name="getxattr" number="212" groups="file"/> + <syscall name="lgetxattr" number="213" groups="file"/> + <syscall name="fgetxattr" number="214" groups="descriptor"/> + <syscall name="listxattr" number="215" groups="file"/> + <syscall name="llistxattr" number="216" groups="file"/> + <syscall name="flistxattr" number="217" groups="descriptor"/> + <syscall name="removexattr" number="218" groups="file"/> + <syscall name="lremovexattr" number="219" groups="file"/> + <syscall name="fremovexattr" number="220" groups="descriptor"/> + <syscall name="futex" number="221"/> + <syscall name="sched_setaffinity" number="222"/> + <syscall name="sched_getaffinity" number="223"/> + <syscall name="tuxcall" number="225"/> + <syscall name="sendfile64" number="226" groups="descriptor,network"/> + <syscall name="io_setup" number="227"/> + <syscall name="io_destroy" number="228"/> + <syscall name="io_getevents" number="229"/> + <syscall name="io_submit" number="230"/> + <syscall name="io_cancel" number="231"/> + <syscall name="set_tid_address" number="232"/> + <syscall name="fadvise64" number="233" groups="descriptor"/> + <syscall name="exit_group" number="234" groups="process"/> + <syscall name="lookup_dcookie" number="235"/> + <syscall name="epoll_create" number="236" groups="descriptor"/> + <syscall name="epoll_ctl" number="237" groups="descriptor"/> + <syscall name="epoll_wait" number="238" groups="descriptor"/> + <syscall name="remap_file_pages" number="239" groups="memory"/> + <syscall name="timer_create" number="240"/> + <syscall name="timer_settime" number="241"/> + <syscall name="timer_gettime" number="242"/> + <syscall name="timer_getoverrun" number="243"/> + <syscall name="timer_delete" number="244"/> + <syscall name="clock_settime" number="245"/> + <syscall name="clock_gettime" number="246"/> + <syscall name="clock_getres" number="247"/> + <syscall name="clock_nanosleep" number="248"/> + <syscall name="swapcontext" number="249"/> + <syscall name="tgkill" number="250" groups="signal"/> + <syscall name="utimes" number="251" groups="file"/> + <syscall name="statfs64" number="252" groups="file"/> + <syscall name="fstatfs64" number="253" groups="descriptor"/> + <syscall name="fadvise64_64" number="254" groups="descriptor"/> + <syscall name="rtas" number="255"/> + <syscall name="sys_debug_setcontext" number="256"/> + <syscall name="mbind" number="259" groups="memory"/> + <syscall name="get_mempolicy" number="260" groups="memory"/> + <syscall name="set_mempolicy" number="261" groups="memory"/> + <syscall name="mq_open" number="262"/> + <syscall name="mq_unlink" number="263"/> + <syscall name="mq_timedsend" number="264"/> + <syscall name="mq_timedreceive" number="265"/> + <syscall name="mq_notify" number="266"/> + <syscall name="mq_getsetattr" number="267"/> + <syscall name="kexec_load" number="268"/> + <syscall name="add_key" number="269"/> + <syscall name="request_key" number="270"/> + <syscall name="keyctl" number="271"/> + <syscall name="waitid" number="272" groups="process"/> + <syscall name="ioprio_set" number="273"/> + <syscall name="ioprio_get" number="274"/> + <syscall name="inotify_init" number="275" groups="descriptor"/> + <syscall name="inotify_add_watch" number="276" groups="descriptor"/> + <syscall name="inotify_rm_watch" number="277" groups="descriptor"/> + <syscall name="spu_run" number="278"/> + <syscall name="spu_create" number="279"/> + <syscall name="pselect6" number="280" groups="descriptor"/> + <syscall name="ppoll" number="281" groups="descriptor"/> + <syscall name="unshare" number="282" groups="process"/> + <syscall name="openat" number="286" groups="descriptor,file"/> + <syscall name="mkdirat" number="287" groups="descriptor,file"/> + <syscall name="mknodat" number="288" groups="descriptor,file"/> + <syscall name="fchownat" number="289" groups="descriptor,file"/> + <syscall name="futimesat" number="290" groups="descriptor,file"/> + <syscall name="fstatat64" number="291" groups="descriptor,file"/> + <syscall name="unlinkat" number="292" groups="descriptor,file"/> + <syscall name="renameat" number="293" groups="descriptor,file"/> + <syscall name="linkat" number="294" groups="descriptor,file"/> + <syscall name="symlinkat" number="295" groups="descriptor,file"/> + <syscall name="readlinkat" number="296" groups="descriptor,file"/> + <syscall name="fchmodat" number="297" groups="descriptor,file"/> + <syscall name="faccessat" number="298" groups="descriptor,file"/> +</syscalls_info> diff --git a/tools/msys/mingw32/share/gdb/syscalls/ppc64-linux.xml b/tools/msys/mingw32/share/gdb/syscalls/ppc64-linux.xml new file mode 100644 index 0000000000000000000000000000000000000000..b56e0b78d15176b43c3069074bf0501708de5246 --- /dev/null +++ b/tools/msys/mingw32/share/gdb/syscalls/ppc64-linux.xml @@ -0,0 +1,292 @@ +<?xml version="1.0"?> +<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd"> +<!-- Copyright (C) 2009-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> +<!-- This file was generated using the following file: + + /usr/src/linux/arch/powerpc/include/asm/unistd.h + + The file mentioned above belongs to the Linux Kernel. --> +<syscalls_info> + <syscall name="restart_syscall" number="0"/> + <syscall name="exit" number="1" groups="process"/> + <syscall name="fork" number="2" groups="process"/> + <syscall name="read" number="3" groups="descriptor"/> + <syscall name="write" number="4" groups="descriptor"/> + <syscall name="open" number="5" groups="descriptor,file"/> + <syscall name="close" number="6" groups="descriptor"/> + <syscall name="waitpid" number="7" groups="process"/> + <syscall name="creat" number="8" groups="descriptor,file"/> + <syscall name="link" number="9" groups="file"/> + <syscall name="unlink" number="10" groups="file"/> + <syscall name="execve" number="11" groups="file,process"/> + <syscall name="chdir" number="12" groups="file"/> + <syscall name="time" number="13"/> + <syscall name="mknod" number="14" groups="file"/> + <syscall name="chmod" number="15" groups="file"/> + <syscall name="lchown" number="16" groups="file"/> + <syscall name="break" number="17" groups="memory"/> + <syscall name="oldstat" number="18" groups="file"/> + <syscall name="lseek" number="19" groups="descriptor"/> + <syscall name="getpid" number="20"/> + <syscall name="mount" number="21" groups="file"/> + <syscall name="umount" number="22" groups="file"/> + <syscall name="setuid" number="23"/> + <syscall name="getuid" number="24"/> + <syscall name="stime" number="25"/> + <syscall name="ptrace" number="26"/> + <syscall name="alarm" number="27"/> + <syscall name="oldfstat" number="28" groups="descriptor"/> + <syscall name="pause" number="29" groups="signal"/> + <syscall name="utime" number="30" groups="file"/> + <syscall name="stty" number="31"/> + <syscall name="gtty" number="32"/> + <syscall name="access" number="33" groups="file"/> + <syscall name="nice" number="34"/> + <syscall name="ftime" number="35"/> + <syscall name="sync" number="36"/> + <syscall name="kill" number="37" groups="signal"/> + <syscall name="rename" number="38" groups="file"/> + <syscall name="mkdir" number="39" groups="file"/> + <syscall name="rmdir" number="40" groups="file"/> + <syscall name="dup" number="41" groups="descriptor"/> + <syscall name="pipe" number="42" groups="descriptor"/> + <syscall name="times" number="43"/> + <syscall name="prof" number="44"/> + <syscall name="brk" number="45" groups="memory"/> + <syscall name="setgid" number="46"/> + <syscall name="getgid" number="47"/> + <syscall name="signal" number="48" groups="signal"/> + <syscall name="geteuid" number="49"/> + <syscall name="getegid" number="50"/> + <syscall name="acct" number="51" groups="file"/> + <syscall name="umount2" number="52" groups="file"/> + <syscall name="lock" number="53"/> + <syscall name="ioctl" number="54" groups="descriptor"/> + <syscall name="fcntl" number="55" groups="descriptor"/> + <syscall name="mpx" number="56"/> + <syscall name="setpgid" number="57"/> + <syscall name="ulimit" number="58"/> + <syscall name="oldolduname" number="59"/> + <syscall name="umask" number="60"/> + <syscall name="chroot" number="61" groups="file"/> + <syscall name="ustat" number="62"/> + <syscall name="dup2" number="63" groups="descriptor"/> + <syscall name="getppid" number="64"/> + <syscall name="getpgrp" number="65"/> + <syscall name="setsid" number="66"/> + <syscall name="sigaction" number="67" groups="signal"/> + <syscall name="sgetmask" number="68" groups="signal"/> + <syscall name="ssetmask" number="69" groups="signal"/> + <syscall name="setreuid" number="70"/> + <syscall name="setregid" number="71"/> + <syscall name="sigsuspend" number="72" groups="signal"/> + <syscall name="sigpending" number="73" groups="signal"/> + <syscall name="sethostname" number="74"/> + <syscall name="setrlimit" number="75"/> + <syscall name="getrlimit" number="76"/> + <syscall name="getrusage" number="77"/> + <syscall name="gettimeofday" number="78"/> + <syscall name="settimeofday" number="79"/> + <syscall name="getgroups" number="80"/> + <syscall name="setgroups" number="81"/> + <syscall name="select" number="82" groups="descriptor"/> + <syscall name="symlink" number="83" groups="file"/> + <syscall name="oldlstat" number="84" groups="file"/> + <syscall name="readlink" number="85" groups="file"/> + <syscall name="uselib" number="86" groups="file"/> + <syscall name="swapon" number="87" groups="file"/> + <syscall name="reboot" number="88"/> + <syscall name="readdir" number="89" groups="descriptor"/> + <syscall name="mmap" number="90" groups="descriptor,memory"/> + <syscall name="munmap" number="91" groups="memory"/> + <syscall name="truncate" number="92" groups="file"/> + <syscall name="ftruncate" number="93" groups="descriptor"/> + <syscall name="fchmod" number="94" groups="descriptor"/> + <syscall name="fchown" number="95" groups="descriptor"/> + <syscall name="getpriority" number="96"/> + <syscall name="setpriority" number="97"/> + <syscall name="profil" number="98"/> + <syscall name="statfs" number="99" groups="file"/> + <syscall name="fstatfs" number="100" groups="descriptor"/> + <syscall name="ioperm" number="101"/> + <syscall name="socketcall" number="102" groups="descriptor"/> + <syscall name="syslog" number="103"/> + <syscall name="setitimer" number="104"/> + <syscall name="getitimer" number="105"/> + <syscall name="stat" number="106" groups="file"/> + <syscall name="lstat" number="107" groups="file"/> + <syscall name="fstat" number="108" groups="descriptor"/> + <syscall name="olduname" number="109"/> + <syscall name="iopl" number="110"/> + <syscall name="vhangup" number="111"/> + <syscall name="idle" number="112"/> + <syscall name="vm86" number="113"/> + <syscall name="wait4" number="114" groups="process"/> + <syscall name="swapoff" number="115" groups="file"/> + <syscall name="sysinfo" number="116"/> + <syscall name="ipc" number="117" groups="ipc"/> + <syscall name="fsync" number="118" groups="descriptor"/> + <syscall name="sigreturn" number="119" groups="signal"/> + <syscall name="clone" number="120" groups="process"/> + <syscall name="setdomainname" number="121"/> + <syscall name="uname" number="122"/> + <syscall name="modify_ldt" number="123"/> + <syscall name="adjtimex" number="124"/> + <syscall name="mprotect" number="125" groups="memory"/> + <syscall name="sigprocmask" number="126" groups="signal"/> + <syscall name="create_module" number="127"/> + <syscall name="init_module" number="128"/> + <syscall name="delete_module" number="129"/> + <syscall name="get_kernel_syms" number="130"/> + <syscall name="quotactl" number="131" groups="file"/> + <syscall name="getpgid" number="132"/> + <syscall name="fchdir" number="133" groups="descriptor"/> + <syscall name="bdflush" number="134"/> + <syscall name="sysfs" number="135"/> + <syscall name="personality" number="136"/> + <syscall name="afs_syscall" number="137"/> + <syscall name="setfsuid" number="138"/> + <syscall name="setfsgid" number="139"/> + <syscall name="_llseek" number="140" groups="descriptor"/> + <syscall name="getdents" number="141" groups="descriptor"/> + <syscall name="_newselect" number="142" groups="descriptor"/> + <syscall name="flock" number="143" groups="descriptor"/> + <syscall name="msync" number="144" groups="memory"/> + <syscall name="readv" number="145" groups="descriptor"/> + <syscall name="writev" number="146" groups="descriptor"/> + <syscall name="getsid" number="147"/> + <syscall name="fdatasync" number="148" groups="descriptor"/> + <syscall name="_sysctl" number="149"/> + <syscall name="mlock" number="150" groups="memory"/> + <syscall name="munlock" number="151" groups="memory"/> + <syscall name="mlockall" number="152" groups="memory"/> + <syscall name="munlockall" number="153" groups="memory"/> + <syscall name="sched_setparam" number="154"/> + <syscall name="sched_getparam" number="155"/> + <syscall name="sched_setscheduler" number="156"/> + <syscall name="sched_getscheduler" number="157"/> + <syscall name="sched_yield" number="158"/> + <syscall name="sched_get_priority_max" number="159"/> + <syscall name="sched_get_priority_min" number="160"/> + <syscall name="sched_rr_get_interval" number="161"/> + <syscall name="nanosleep" number="162"/> + <syscall name="mremap" number="163" groups="memory"/> + <syscall name="setresuid" number="164"/> + <syscall name="getresuid" number="165"/> + <syscall name="query_module" number="166"/> + <syscall name="poll" number="167" groups="descriptor"/> + <syscall name="nfsservctl" number="168"/> + <syscall name="setresgid" number="169"/> + <syscall name="getresgid" number="170"/> + <syscall name="prctl" number="171"/> + <syscall name="rt_sigreturn" number="172" groups="signal"/> + <syscall name="rt_sigaction" number="173" groups="signal"/> + <syscall name="rt_sigprocmask" number="174" groups="signal"/> + <syscall name="rt_sigpending" number="175" groups="signal"/> + <syscall name="rt_sigtimedwait" number="176" groups="signal"/> + <syscall name="rt_sigqueueinfo" number="177" groups="signal"/> + <syscall name="rt_sigsuspend" number="178" groups="signal"/> + <syscall name="pread64" number="179" groups="descriptor"/> + <syscall name="pwrite64" number="180" groups="descriptor"/> + <syscall name="chown" number="181" groups="file"/> + <syscall name="getcwd" number="182" groups="file"/> + <syscall name="capget" number="183"/> + <syscall name="capset" number="184"/> + <syscall name="sigaltstack" number="185" groups="signal"/> + <syscall name="sendfile" number="186" groups="descriptor,network"/> + <syscall name="getpmsg" number="187"/> + <syscall name="putpmsg" number="188"/> + <syscall name="vfork" number="189" groups="process"/> + <syscall name="ugetrlimit" number="190"/> + <syscall name="readahead" number="191" groups="descriptor"/> + <syscall name="pciconfig_read" number="198"/> + <syscall name="pciconfig_write" number="199"/> + <syscall name="pciconfig_iobase" number="200"/> + <syscall name="multiplexer" number="201"/> + <syscall name="getdents64" number="202" groups="descriptor"/> + <syscall name="pivot_root" number="203" groups="file"/> + <syscall name="madvise" number="205" groups="memory"/> + <syscall name="mincore" number="206" groups="memory"/> + <syscall name="gettid" number="207"/> + <syscall name="tkill" number="208" groups="signal"/> + <syscall name="setxattr" number="209" groups="file"/> + <syscall name="lsetxattr" number="210" groups="file"/> + <syscall name="fsetxattr" number="211" groups="descriptor"/> + <syscall name="getxattr" number="212" groups="file"/> + <syscall name="lgetxattr" number="213" groups="file"/> + <syscall name="fgetxattr" number="214" groups="descriptor"/> + <syscall name="listxattr" number="215" groups="file"/> + <syscall name="llistxattr" number="216" groups="file"/> + <syscall name="flistxattr" number="217" groups="descriptor"/> + <syscall name="removexattr" number="218" groups="file"/> + <syscall name="lremovexattr" number="219" groups="file"/> + <syscall name="fremovexattr" number="220" groups="descriptor"/> + <syscall name="futex" number="221"/> + <syscall name="sched_setaffinity" number="222"/> + <syscall name="sched_getaffinity" number="223"/> + <syscall name="tuxcall" number="225"/> + <syscall name="io_setup" number="227"/> + <syscall name="io_destroy" number="228"/> + <syscall name="io_getevents" number="229"/> + <syscall name="io_submit" number="230"/> + <syscall name="io_cancel" number="231"/> + <syscall name="set_tid_address" number="232"/> + <syscall name="fadvise64" number="233" groups="descriptor"/> + <syscall name="exit_group" number="234" groups="process"/> + <syscall name="lookup_dcookie" number="235"/> + <syscall name="epoll_create" number="236" groups="descriptor"/> + <syscall name="epoll_ctl" number="237" groups="descriptor"/> + <syscall name="epoll_wait" number="238" groups="descriptor"/> + <syscall name="remap_file_pages" number="239" groups="memory"/> + <syscall name="timer_create" number="240"/> + <syscall name="timer_settime" number="241"/> + <syscall name="timer_gettime" number="242"/> + <syscall name="timer_getoverrun" number="243"/> + <syscall name="timer_delete" number="244"/> + <syscall name="clock_settime" number="245"/> + <syscall name="clock_gettime" number="246"/> + <syscall name="clock_getres" number="247"/> + <syscall name="clock_nanosleep" number="248"/> + <syscall name="swapcontext" number="249"/> + <syscall name="tgkill" number="250" groups="signal"/> + <syscall name="utimes" number="251" groups="file"/> + <syscall name="statfs64" number="252" groups="file"/> + <syscall name="fstatfs64" number="253" groups="descriptor"/> + <syscall name="rtas" number="255"/> + <syscall name="sys_debug_setcontext" number="256"/> + <syscall name="mbind" number="259" groups="memory"/> + <syscall name="get_mempolicy" number="260" groups="memory"/> + <syscall name="set_mempolicy" number="261" groups="memory"/> + <syscall name="mq_open" number="262"/> + <syscall name="mq_unlink" number="263"/> + <syscall name="mq_timedsend" number="264"/> + <syscall name="mq_timedreceive" number="265"/> + <syscall name="mq_notify" number="266"/> + <syscall name="mq_getsetattr" number="267"/> + <syscall name="kexec_load" number="268"/> + <syscall name="add_key" number="269"/> + <syscall name="request_key" number="270"/> + <syscall name="keyctl" number="271"/> + <syscall name="waitid" number="272" groups="process"/> + <syscall name="ioprio_set" number="273"/> + <syscall name="ioprio_get" number="274"/> + <syscall name="inotify_init" number="275" groups="descriptor"/> + <syscall name="inotify_add_watch" number="276" groups="descriptor"/> + <syscall name="inotify_rm_watch" number="277" groups="descriptor"/> + <syscall name="spu_run" number="278"/> + <syscall name="spu_create" number="279"/> + <syscall name="pselect6" number="280" groups="descriptor"/> + <syscall name="ppoll" number="281" groups="descriptor"/> + <syscall name="unshare" number="282" groups="process"/> + <syscall name="unlinkat" number="286" groups="descriptor,file"/> + <syscall name="renameat" number="287" groups="descriptor,file"/> + <syscall name="linkat" number="288" groups="descriptor,file"/> + <syscall name="symlinkat" number="289" groups="descriptor,file"/> + <syscall name="readlinkat" number="290" groups="descriptor,file"/> + <syscall name="fchmodat" number="291" groups="descriptor,file"/> + <syscall name="faccessat" number="292" groups="descriptor,file"/> +</syscalls_info> diff --git a/tools/msys/mingw32/share/gdb/syscalls/s390-linux.xml b/tools/msys/mingw32/share/gdb/syscalls/s390-linux.xml new file mode 100644 index 0000000000000000000000000000000000000000..8db0ac5c861dcd04e8028daf1ea7d4bb92c2af4e --- /dev/null +++ b/tools/msys/mingw32/share/gdb/syscalls/s390-linux.xml @@ -0,0 +1,364 @@ +<?xml version="1.0"?> +<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd"> +<!-- Copyright (C) 2009-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> +<!-- This file was generated using the following file: + + /usr/include/asm/unistd.h + + The file mentioned above belongs to the Linux Kernel. --> +<syscalls_info> + <syscall name="exit" number="1" groups="process"/> + <syscall name="fork" number="2" groups="process"/> + <syscall name="read" number="3" groups="descriptor"/> + <syscall name="write" number="4" groups="descriptor"/> + <syscall name="open" number="5" groups="descriptor,file"/> + <syscall name="close" number="6" groups="descriptor"/> + <syscall name="restart_syscall" number="7"/> + <syscall name="creat" number="8" groups="descriptor,file"/> + <syscall name="link" number="9" groups="file"/> + <syscall name="unlink" number="10" groups="file"/> + <syscall name="execve" number="11" groups="file,process"/> + <syscall name="chdir" number="12" groups="file"/> + <syscall name="time" number="13"/> + <syscall name="mknod" number="14" groups="file"/> + <syscall name="chmod" number="15" groups="file"/> + <syscall name="lchown" number="16" groups="file"/> + <syscall name="lseek" number="19" groups="descriptor"/> + <syscall name="getpid" number="20"/> + <syscall name="mount" number="21" groups="file"/> + <syscall name="umount" number="22" groups="file"/> + <syscall name="setuid" number="23"/> + <syscall name="getuid" number="24"/> + <syscall name="stime" number="25"/> + <syscall name="ptrace" number="26"/> + <syscall name="alarm" number="27"/> + <syscall name="pause" number="29" groups="signal"/> + <syscall name="utime" number="30" groups="file"/> + <syscall name="access" number="33" groups="file"/> + <syscall name="nice" number="34"/> + <syscall name="sync" number="36"/> + <syscall name="kill" number="37" groups="signal"/> + <syscall name="rename" number="38" groups="file"/> + <syscall name="mkdir" number="39" groups="file"/> + <syscall name="rmdir" number="40" groups="file"/> + <syscall name="dup" number="41" groups="descriptor"/> + <syscall name="pipe" number="42" groups="descriptor"/> + <syscall name="times" number="43"/> + <syscall name="brk" number="45" groups="memory"/> + <syscall name="setgid" number="46"/> + <syscall name="getgid" number="47"/> + <syscall name="signal" number="48" groups="signal"/> + <syscall name="geteuid" number="49"/> + <syscall name="getegid" number="50"/> + <syscall name="acct" number="51" groups="file"/> + <syscall name="umount2" number="52" groups="file"/> + <syscall name="ioctl" number="54" groups="descriptor"/> + <syscall name="fcntl" number="55" groups="descriptor"/> + <syscall name="setpgid" number="57"/> + <syscall name="umask" number="60"/> + <syscall name="chroot" number="61" groups="file"/> + <syscall name="ustat" number="62"/> + <syscall name="dup2" number="63" groups="descriptor"/> + <syscall name="getppid" number="64"/> + <syscall name="getpgrp" number="65"/> + <syscall name="setsid" number="66"/> + <syscall name="sigaction" number="67" groups="signal"/> + <syscall name="setreuid" number="70"/> + <syscall name="setregid" number="71"/> + <syscall name="sigsuspend" number="72" groups="signal"/> + <syscall name="sigpending" number="73" groups="signal"/> + <syscall name="sethostname" number="74"/> + <syscall name="setrlimit" number="75"/> + <syscall name="getrlimit" number="76"/> + <syscall name="getrusage" number="77"/> + <syscall name="gettimeofday" number="78"/> + <syscall name="settimeofday" number="79"/> + <syscall name="getgroups" number="80"/> + <syscall name="setgroups" number="81"/> + <syscall name="symlink" number="83" groups="file"/> + <syscall name="readlink" number="85" groups="file"/> + <syscall name="uselib" number="86" groups="file"/> + <syscall name="swapon" number="87" groups="file"/> + <syscall name="reboot" number="88"/> + <syscall name="readdir" number="89" groups="descriptor"/> + <syscall name="mmap" number="90" groups="descriptor,memory"/> + <syscall name="munmap" number="91" groups="memory"/> + <syscall name="truncate" number="92" groups="file"/> + <syscall name="ftruncate" number="93" groups="descriptor"/> + <syscall name="fchmod" number="94" groups="descriptor"/> + <syscall name="fchown" number="95" groups="descriptor"/> + <syscall name="getpriority" number="96"/> + <syscall name="setpriority" number="97"/> + <syscall name="statfs" number="99" groups="file"/> + <syscall name="fstatfs" number="100" groups="descriptor"/> + <syscall name="ioperm" number="101"/> + <syscall name="socketcall" number="102" groups="descriptor"/> + <syscall name="syslog" number="103"/> + <syscall name="setitimer" number="104"/> + <syscall name="getitimer" number="105"/> + <syscall name="stat" number="106" groups="file"/> + <syscall name="lstat" number="107" groups="file"/> + <syscall name="fstat" number="108" groups="descriptor"/> + <syscall name="lookup_dcookie" number="110"/> + <syscall name="vhangup" number="111"/> + <syscall name="idle" number="112"/> + <syscall name="wait4" number="114" groups="process"/> + <syscall name="swapoff" number="115" groups="file"/> + <syscall name="sysinfo" number="116"/> + <syscall name="ipc" number="117" groups="ipc"/> + <syscall name="fsync" number="118" groups="descriptor"/> + <syscall name="sigreturn" number="119" groups="signal"/> + <syscall name="clone" number="120" groups="process"/> + <syscall name="setdomainname" number="121"/> + <syscall name="uname" number="122"/> + <syscall name="adjtimex" number="124"/> + <syscall name="mprotect" number="125" groups="memory"/> + <syscall name="sigprocmask" number="126" groups="signal"/> + <syscall name="create_module" number="127"/> + <syscall name="init_module" number="128"/> + <syscall name="delete_module" number="129"/> + <syscall name="get_kernel_syms" number="130"/> + <syscall name="quotactl" number="131" groups="file"/> + <syscall name="getpgid" number="132"/> + <syscall name="fchdir" number="133" groups="descriptor"/> + <syscall name="bdflush" number="134"/> + <syscall name="sysfs" number="135"/> + <syscall name="personality" number="136"/> + <syscall name="afs_syscall" number="137"/> + <syscall name="setfsuid" number="138"/> + <syscall name="setfsgid" number="139"/> + <syscall name="_llseek" number="140" groups="descriptor"/> + <syscall name="getdents" number="141" groups="descriptor"/> + <syscall name="_newselect" number="142" groups="descriptor"/> + <syscall name="flock" number="143" groups="descriptor"/> + <syscall name="msync" number="144" groups="memory"/> + <syscall name="readv" number="145" groups="descriptor"/> + <syscall name="writev" number="146" groups="descriptor"/> + <syscall name="getsid" number="147"/> + <syscall name="fdatasync" number="148" groups="descriptor"/> + <syscall name="_sysctl" number="149"/> + <syscall name="mlock" number="150" groups="memory"/> + <syscall name="munlock" number="151" groups="memory"/> + <syscall name="mlockall" number="152" groups="memory"/> + <syscall name="munlockall" number="153" groups="memory"/> + <syscall name="sched_setparam" number="154"/> + <syscall name="sched_getparam" number="155"/> + <syscall name="sched_setscheduler" number="156"/> + <syscall name="sched_getscheduler" number="157"/> + <syscall name="sched_yield" number="158"/> + <syscall name="sched_get_priority_max" number="159"/> + <syscall name="sched_get_priority_min" number="160"/> + <syscall name="sched_rr_get_interval" number="161"/> + <syscall name="nanosleep" number="162"/> + <syscall name="mremap" number="163" groups="memory"/> + <syscall name="setresuid" number="164"/> + <syscall name="getresuid" number="165"/> + <syscall name="query_module" number="167"/> + <syscall name="poll" number="168" groups="descriptor"/> + <syscall name="nfsservctl" number="169"/> + <syscall name="setresgid" number="170"/> + <syscall name="getresgid" number="171"/> + <syscall name="prctl" number="172"/> + <syscall name="rt_sigreturn" number="173" groups="signal"/> + <syscall name="rt_sigaction" number="174" groups="signal"/> + <syscall name="rt_sigprocmask" number="175" groups="signal"/> + <syscall name="rt_sigpending" number="176" groups="signal"/> + <syscall name="rt_sigtimedwait" number="177" groups="signal"/> + <syscall name="rt_sigqueueinfo" number="178" groups="signal"/> + <syscall name="rt_sigsuspend" number="179" groups="signal"/> + <syscall name="pread64" number="180" groups="descriptor"/> + <syscall name="pwrite64" number="181" groups="descriptor"/> + <syscall name="chown" number="182" groups="file"/> + <syscall name="getcwd" number="183" groups="file"/> + <syscall name="capget" number="184"/> + <syscall name="capset" number="185"/> + <syscall name="sigaltstack" number="186" groups="signal"/> + <syscall name="sendfile" number="187" groups="descriptor,network"/> + <syscall name="getpmsg" number="188"/> + <syscall name="putpmsg" number="189"/> + <syscall name="vfork" number="190" groups="process"/> + <syscall name="ugetrlimit" number="191"/> + <syscall name="mmap2" number="192" groups="descriptor,memory"/> + <syscall name="truncate64" number="193" groups="file"/> + <syscall name="ftruncate64" number="194" groups="descriptor"/> + <syscall name="stat64" number="195" groups="file"/> + <syscall name="lstat64" number="196" groups="file"/> + <syscall name="fstat64" number="197" groups="descriptor"/> + <syscall name="lchown32" number="198" groups="file"/> + <syscall name="getuid32" number="199"/> + <syscall name="getgid32" number="200"/> + <syscall name="geteuid32" number="201"/> + <syscall name="getegid32" number="202"/> + <syscall name="setreuid32" number="203"/> + <syscall name="setregid32" number="204"/> + <syscall name="getgroups32" number="205"/> + <syscall name="setgroups32" number="206"/> + <syscall name="fchown32" number="207" groups="descriptor"/> + <syscall name="setresuid32" number="208"/> + <syscall name="getresuid32" number="209"/> + <syscall name="setresgid32" number="210"/> + <syscall name="getresgid32" number="211"/> + <syscall name="chown32" number="212" groups="file"/> + <syscall name="setuid32" number="213"/> + <syscall name="setgid32" number="214"/> + <syscall name="setfsuid32" number="215"/> + <syscall name="setfsgid32" number="216"/> + <syscall name="pivot_root" number="217" groups="file"/> + <syscall name="mincore" number="218" groups="memory"/> + <syscall name="madvise" number="219" groups="memory"/> + <syscall name="getdents64" number="220" groups="descriptor"/> + <syscall name="fcntl64" number="221" groups="descriptor"/> + <syscall name="readahead" number="222" groups="descriptor"/> + <syscall name="sendfile64" number="223" groups="descriptor,network"/> + <syscall name="setxattr" number="224" groups="file"/> + <syscall name="lsetxattr" number="225" groups="file"/> + <syscall name="fsetxattr" number="226" groups="descriptor"/> + <syscall name="getxattr" number="227" groups="file"/> + <syscall name="lgetxattr" number="228" groups="file"/> + <syscall name="fgetxattr" number="229" groups="descriptor"/> + <syscall name="listxattr" number="230" groups="file"/> + <syscall name="llistxattr" number="231" groups="file"/> + <syscall name="flistxattr" number="232" groups="descriptor"/> + <syscall name="removexattr" number="233" groups="file"/> + <syscall name="lremovexattr" number="234" groups="file"/> + <syscall name="fremovexattr" number="235" groups="descriptor"/> + <syscall name="gettid" number="236"/> + <syscall name="tkill" number="237" groups="signal"/> + <syscall name="futex" number="238"/> + <syscall name="sched_setaffinity" number="239"/> + <syscall name="sched_getaffinity" number="240"/> + <syscall name="tgkill" number="241" groups="signal"/> + <syscall name="io_setup" number="243"/> + <syscall name="io_destroy" number="244"/> + <syscall name="io_getevents" number="245"/> + <syscall name="io_submit" number="246"/> + <syscall name="io_cancel" number="247"/> + <syscall name="exit_group" number="248" groups="process"/> + <syscall name="epoll_create" number="249" groups="descriptor"/> + <syscall name="epoll_ctl" number="250" groups="descriptor"/> + <syscall name="epoll_wait" number="251" groups="descriptor"/> + <syscall name="set_tid_address" number="252"/> + <syscall name="fadvise64" number="253" groups="descriptor"/> + <syscall name="timer_create" number="254"/> + <syscall name="timer_settime" number="255"/> + <syscall name="timer_gettime" number="256"/> + <syscall name="timer_getoverrun" number="257"/> + <syscall name="timer_delete" number="258"/> + <syscall name="clock_settime" number="259"/> + <syscall name="clock_gettime" number="260"/> + <syscall name="clock_getres" number="261"/> + <syscall name="clock_nanosleep" number="262"/> + <syscall name="fadvise64_64" number="264" groups="descriptor"/> + <syscall name="statfs64" number="265" groups="file"/> + <syscall name="fstatfs64" number="266" groups="descriptor"/> + <syscall name="remap_file_pages" number="267" groups="memory"/> + <syscall name="mbind" number="268" groups="memory"/> + <syscall name="get_mempolicy" number="269" groups="memory"/> + <syscall name="set_mempolicy" number="270" groups="memory"/> + <syscall name="mq_open" number="271"/> + <syscall name="mq_unlink" number="272"/> + <syscall name="mq_timedsend" number="273"/> + <syscall name="mq_timedreceive" number="274"/> + <syscall name="mq_notify" number="275"/> + <syscall name="mq_getsetattr" number="276"/> + <syscall name="kexec_load" number="277"/> + <syscall name="add_key" number="278"/> + <syscall name="request_key" number="279"/> + <syscall name="keyctl" number="280"/> + <syscall name="waitid" number="281" groups="process"/> + <syscall name="ioprio_set" number="282"/> + <syscall name="ioprio_get" number="283"/> + <syscall name="inotify_init" number="284" groups="descriptor"/> + <syscall name="inotify_add_watch" number="285" groups="descriptor"/> + <syscall name="inotify_rm_watch" number="286" groups="descriptor"/> + <syscall name="migrate_pages" number="287" groups="memory"/> + <syscall name="openat" number="288" groups="descriptor,file"/> + <syscall name="mkdirat" number="289" groups="descriptor,file"/> + <syscall name="mknodat" number="290" groups="descriptor,file"/> + <syscall name="fchownat" number="291" groups="descriptor,file"/> + <syscall name="futimesat" number="292" groups="descriptor,file"/> + <syscall name="fstatat64" number="293" groups="descriptor,file"/> + <syscall name="unlinkat" number="294" groups="descriptor,file"/> + <syscall name="renameat" number="295" groups="descriptor,file"/> + <syscall name="linkat" number="296" groups="descriptor,file"/> + <syscall name="symlinkat" number="297" groups="descriptor,file"/> + <syscall name="readlinkat" number="298" groups="descriptor,file"/> + <syscall name="fchmodat" number="299" groups="descriptor,file"/> + <syscall name="faccessat" number="300" groups="descriptor,file"/> + <syscall name="pselect6" number="301" groups="descriptor"/> + <syscall name="ppoll" number="302" groups="descriptor"/> + <syscall name="unshare" number="303" groups="process"/> + <syscall name="set_robust_list" number="304"/> + <syscall name="get_robust_list" number="305"/> + <syscall name="splice" number="306" groups="descriptor"/> + <syscall name="sync_file_range" number="307" groups="descriptor"/> + <syscall name="tee" number="308" groups="descriptor"/> + <syscall name="vmsplice" number="309" groups="descriptor"/> + <syscall name="move_pages" number="310" groups="memory"/> + <syscall name="getcpu" number="311"/> + <syscall name="epoll_pwait" number="312" groups="descriptor"/> + <syscall name="utimes" number="313" groups="file"/> + <syscall name="fallocate" number="314" groups="descriptor"/> + <syscall name="utimensat" number="315" groups="descriptor,file"/> + <syscall name="signalfd" number="316" groups="descriptor,signal"/> + <syscall name="timerfd" number="317" groups="descriptor"/> + <syscall name="eventfd" number="318" groups="descriptor"/> + <syscall name="timerfd_create" number="319" groups="descriptor"/> + <syscall name="timerfd_settime" number="320" groups="descriptor"/> + <syscall name="timerfd_gettime" number="321" groups="descriptor"/> + <syscall name="signalfd4" number="322" groups="descriptor,signal"/> + <syscall name="eventfd2" number="323" groups="descriptor"/> + <syscall name="inotify_init1" number="324" groups="descriptor"/> + <syscall name="pipe2" number="325" groups="descriptor"/> + <syscall name="dup3" number="326" groups="descriptor"/> + <syscall name="epoll_create1" number="327" groups="descriptor"/> + <syscall name="rt_tgsigqueueinfo" number="330" groups="process,signal"/> + <syscall name="perf_event_open" number="331" groups="descriptor"/> + <syscall name="fanotify_init" number="332" groups="descriptor"/> + <syscall name="fanotify_mark" number="333" groups="descriptor,file"/> + <syscall name="prlimit64" number="334"/> + <syscall name="name_to_handle_at" number="335" groups="descriptor,file"/> + <syscall name="open_by_handle_at" number="336" groups="descriptor"/> + <syscall name="clock_adjtime" number="337"/> + <syscall name="syncfs" number="338" groups="descriptor"/> + <syscall name="setns" number="339" groups="descriptor"/> + <syscall name="process_vm_readv" number="340"/> + <syscall name="process_vm_writev" number="341"/> + <syscall name="s390_runtime_instr" number="342"/> + <syscall name="kcmp" number="343"/> + <syscall name="finit_module" number="344" groups="descriptor"/> + <syscall name="sched_setattr" number="345"/> + <syscall name="sched_getattr" number="346"/> + <syscall name="renameat2" number="347"/> + <syscall name="seccomp" number="348"/> + <syscall name="getrandom" number="349"/> + <syscall name="memfd_create" number="350"/> + <syscall name="bpf" number="351"/> + <syscall name="s390_pci_mmio_write" number="352"/> + <syscall name="s390_pci_mmio_read" number="353"/> + <syscall name="execveat" number="354"/> + <syscall name="userfaultfd" number="355"/> + <syscall name="membarrier" number="356"/> + <syscall name="recvmmsg" number="357" groups="network"/> + <syscall name="sendmmsg" number="358" groups="network"/> + <syscall name="socket" number="359" groups="network"/> + <syscall name="socketpair" number="360" groups="network"/> + <syscall name="bind" number="361" groups="network"/> + <syscall name="connect" number="362" groups="network"/> + <syscall name="listen" number="363" groups="network"/> + <syscall name="accept4" number="364" groups="network"/> + <syscall name="getsockopt" number="365" groups="network"/> + <syscall name="setsockopt" number="366" groups="network"/> + <syscall name="getsockname" number="367" groups="network"/> + <syscall name="getpeername" number="368" groups="network"/> + <syscall name="sendto" number="369" groups="network"/> + <syscall name="sendmsg" number="370" groups="network"/> + <syscall name="recvfrom" number="371" groups="network"/> + <syscall name="recvmsg" number="372" groups="network"/> + <syscall name="shutdown" number="373" groups="network"/> + <syscall name="mlock2" number="374"/> +</syscalls_info> diff --git a/tools/msys/mingw32/share/gdb/syscalls/s390x-linux.xml b/tools/msys/mingw32/share/gdb/syscalls/s390x-linux.xml new file mode 100644 index 0000000000000000000000000000000000000000..fe873e6c8a1bfe574333c001346a638667ee58d2 --- /dev/null +++ b/tools/msys/mingw32/share/gdb/syscalls/s390x-linux.xml @@ -0,0 +1,331 @@ +<?xml version="1.0"?> +<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd"> +<!-- Copyright (C) 2009-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> +<!-- This file was generated using the following file: + + /usr/include/asm/unistd.h + + The file mentioned above belongs to the Linux Kernel. --> +<syscalls_info> + <syscall name="exit" number="1" groups="process"/> + <syscall name="fork" number="2" groups="process"/> + <syscall name="read" number="3" groups="descriptor"/> + <syscall name="write" number="4" groups="descriptor"/> + <syscall name="open" number="5" groups="descriptor,file"/> + <syscall name="close" number="6" groups="descriptor"/> + <syscall name="restart_syscall" number="7"/> + <syscall name="creat" number="8" groups="descriptor,file"/> + <syscall name="link" number="9" groups="file"/> + <syscall name="unlink" number="10" groups="file"/> + <syscall name="execve" number="11" groups="file,process"/> + <syscall name="chdir" number="12" groups="file"/> + <syscall name="mknod" number="14" groups="file"/> + <syscall name="chmod" number="15" groups="file"/> + <syscall name="lseek" number="19" groups="descriptor"/> + <syscall name="getpid" number="20"/> + <syscall name="mount" number="21" groups="file"/> + <syscall name="umount" number="22" groups="file"/> + <syscall name="ptrace" number="26"/> + <syscall name="alarm" number="27"/> + <syscall name="pause" number="29" groups="signal"/> + <syscall name="utime" number="30" groups="file"/> + <syscall name="access" number="33" groups="file"/> + <syscall name="nice" number="34"/> + <syscall name="sync" number="36"/> + <syscall name="kill" number="37" groups="signal"/> + <syscall name="rename" number="38" groups="file"/> + <syscall name="mkdir" number="39" groups="file"/> + <syscall name="rmdir" number="40" groups="file"/> + <syscall name="dup" number="41" groups="descriptor"/> + <syscall name="pipe" number="42" groups="descriptor"/> + <syscall name="times" number="43"/> + <syscall name="brk" number="45" groups="memory"/> + <syscall name="signal" number="48" groups="signal"/> + <syscall name="acct" number="51" groups="file"/> + <syscall name="umount2" number="52" groups="file"/> + <syscall name="ioctl" number="54" groups="descriptor"/> + <syscall name="fcntl" number="55" groups="descriptor"/> + <syscall name="setpgid" number="57"/> + <syscall name="umask" number="60"/> + <syscall name="chroot" number="61" groups="file"/> + <syscall name="ustat" number="62"/> + <syscall name="dup2" number="63" groups="descriptor"/> + <syscall name="getppid" number="64"/> + <syscall name="getpgrp" number="65"/> + <syscall name="setsid" number="66"/> + <syscall name="sigaction" number="67" groups="signal"/> + <syscall name="sigsuspend" number="72" groups="signal"/> + <syscall name="sigpending" number="73" groups="signal"/> + <syscall name="sethostname" number="74"/> + <syscall name="setrlimit" number="75"/> + <syscall name="getrusage" number="77"/> + <syscall name="gettimeofday" number="78"/> + <syscall name="settimeofday" number="79"/> + <syscall name="symlink" number="83" groups="file"/> + <syscall name="readlink" number="85" groups="file"/> + <syscall name="uselib" number="86" groups="file"/> + <syscall name="swapon" number="87" groups="file"/> + <syscall name="reboot" number="88"/> + <syscall name="readdir" number="89" groups="descriptor"/> + <syscall name="mmap" number="90" groups="descriptor,memory"/> + <syscall name="munmap" number="91" groups="memory"/> + <syscall name="truncate" number="92" groups="file"/> + <syscall name="ftruncate" number="93" groups="descriptor"/> + <syscall name="fchmod" number="94" groups="descriptor"/> + <syscall name="getpriority" number="96"/> + <syscall name="setpriority" number="97"/> + <syscall name="statfs" number="99" groups="file"/> + <syscall name="fstatfs" number="100" groups="descriptor"/> + <syscall name="socketcall" number="102" groups="descriptor"/> + <syscall name="syslog" number="103"/> + <syscall name="setitimer" number="104"/> + <syscall name="getitimer" number="105"/> + <syscall name="stat" number="106" groups="file"/> + <syscall name="lstat" number="107" groups="file"/> + <syscall name="fstat" number="108" groups="descriptor"/> + <syscall name="lookup_dcookie" number="110"/> + <syscall name="vhangup" number="111"/> + <syscall name="idle" number="112"/> + <syscall name="wait4" number="114" groups="process"/> + <syscall name="swapoff" number="115" groups="file"/> + <syscall name="sysinfo" number="116"/> + <syscall name="ipc" number="117" groups="ipc"/> + <syscall name="fsync" number="118" groups="descriptor"/> + <syscall name="sigreturn" number="119" groups="signal"/> + <syscall name="clone" number="120" groups="process"/> + <syscall name="setdomainname" number="121"/> + <syscall name="uname" number="122"/> + <syscall name="adjtimex" number="124"/> + <syscall name="mprotect" number="125" groups="memory"/> + <syscall name="sigprocmask" number="126" groups="signal"/> + <syscall name="create_module" number="127"/> + <syscall name="init_module" number="128"/> + <syscall name="delete_module" number="129"/> + <syscall name="get_kernel_syms" number="130"/> + <syscall name="quotactl" number="131" groups="file"/> + <syscall name="getpgid" number="132"/> + <syscall name="fchdir" number="133" groups="descriptor"/> + <syscall name="bdflush" number="134"/> + <syscall name="sysfs" number="135"/> + <syscall name="personality" number="136"/> + <syscall name="afs_syscall" number="137"/> + <syscall name="getdents" number="141" groups="descriptor"/> + <syscall name="select" number="142" groups="descriptor"/> + <syscall name="flock" number="143" groups="descriptor"/> + <syscall name="msync" number="144" groups="memory"/> + <syscall name="readv" number="145" groups="descriptor"/> + <syscall name="writev" number="146" groups="descriptor"/> + <syscall name="getsid" number="147"/> + <syscall name="fdatasync" number="148" groups="descriptor"/> + <syscall name="_sysctl" number="149"/> + <syscall name="mlock" number="150" groups="memory"/> + <syscall name="munlock" number="151" groups="memory"/> + <syscall name="mlockall" number="152" groups="memory"/> + <syscall name="munlockall" number="153" groups="memory"/> + <syscall name="sched_setparam" number="154"/> + <syscall name="sched_getparam" number="155"/> + <syscall name="sched_setscheduler" number="156"/> + <syscall name="sched_getscheduler" number="157"/> + <syscall name="sched_yield" number="158"/> + <syscall name="sched_get_priority_max" number="159"/> + <syscall name="sched_get_priority_min" number="160"/> + <syscall name="sched_rr_get_interval" number="161"/> + <syscall name="nanosleep" number="162"/> + <syscall name="mremap" number="163" groups="memory"/> + <syscall name="query_module" number="167"/> + <syscall name="poll" number="168" groups="descriptor"/> + <syscall name="nfsservctl" number="169"/> + <syscall name="prctl" number="172"/> + <syscall name="rt_sigreturn" number="173" groups="signal"/> + <syscall name="rt_sigaction" number="174" groups="signal"/> + <syscall name="rt_sigprocmask" number="175" groups="signal"/> + <syscall name="rt_sigpending" number="176" groups="signal"/> + <syscall name="rt_sigtimedwait" number="177" groups="signal"/> + <syscall name="rt_sigqueueinfo" number="178" groups="signal"/> + <syscall name="rt_sigsuspend" number="179" groups="signal"/> + <syscall name="pread64" number="180" groups="descriptor"/> + <syscall name="pwrite64" number="181" groups="descriptor"/> + <syscall name="getcwd" number="183" groups="file"/> + <syscall name="capget" number="184"/> + <syscall name="capset" number="185"/> + <syscall name="sigaltstack" number="186" groups="signal"/> + <syscall name="sendfile" number="187" groups="descriptor,network"/> + <syscall name="getpmsg" number="188"/> + <syscall name="putpmsg" number="189"/> + <syscall name="vfork" number="190" groups="process"/> + <syscall name="getrlimit" number="191"/> + <syscall name="lchown" number="198" groups="file"/> + <syscall name="getuid" number="199"/> + <syscall name="getgid" number="200"/> + <syscall name="geteuid" number="201"/> + <syscall name="getegid" number="202"/> + <syscall name="setreuid" number="203"/> + <syscall name="setregid" number="204"/> + <syscall name="getgroups" number="205"/> + <syscall name="setgroups" number="206"/> + <syscall name="fchown" number="207" groups="descriptor"/> + <syscall name="setresuid" number="208"/> + <syscall name="getresuid" number="209"/> + <syscall name="setresgid" number="210"/> + <syscall name="getresgid" number="211"/> + <syscall name="chown" number="212" groups="file"/> + <syscall name="setuid" number="213"/> + <syscall name="setgid" number="214"/> + <syscall name="setfsuid" number="215"/> + <syscall name="setfsgid" number="216"/> + <syscall name="pivot_root" number="217" groups="file"/> + <syscall name="mincore" number="218" groups="memory"/> + <syscall name="madvise" number="219" groups="memory"/> + <syscall name="getdents64" number="220" groups="descriptor"/> + <syscall name="readahead" number="222" groups="descriptor"/> + <syscall name="setxattr" number="224" groups="file"/> + <syscall name="lsetxattr" number="225" groups="file"/> + <syscall name="fsetxattr" number="226" groups="descriptor"/> + <syscall name="getxattr" number="227" groups="file"/> + <syscall name="lgetxattr" number="228" groups="file"/> + <syscall name="fgetxattr" number="229" groups="descriptor"/> + <syscall name="listxattr" number="230" groups="file"/> + <syscall name="llistxattr" number="231" groups="file"/> + <syscall name="flistxattr" number="232" groups="descriptor"/> + <syscall name="removexattr" number="233" groups="file"/> + <syscall name="lremovexattr" number="234" groups="file"/> + <syscall name="fremovexattr" number="235" groups="descriptor"/> + <syscall name="gettid" number="236"/> + <syscall name="tkill" number="237" groups="signal"/> + <syscall name="futex" number="238"/> + <syscall name="sched_setaffinity" number="239"/> + <syscall name="sched_getaffinity" number="240"/> + <syscall name="tgkill" number="241" groups="signal"/> + <syscall name="io_setup" number="243"/> + <syscall name="io_destroy" number="244"/> + <syscall name="io_getevents" number="245"/> + <syscall name="io_submit" number="246"/> + <syscall name="io_cancel" number="247"/> + <syscall name="exit_group" number="248" groups="process"/> + <syscall name="epoll_create" number="249" groups="descriptor"/> + <syscall name="epoll_ctl" number="250" groups="descriptor"/> + <syscall name="epoll_wait" number="251" groups="descriptor"/> + <syscall name="set_tid_address" number="252"/> + <syscall name="fadvise64" number="253" groups="descriptor"/> + <syscall name="timer_create" number="254"/> + <syscall name="timer_settime" number="255"/> + <syscall name="timer_gettime" number="256"/> + <syscall name="timer_getoverrun" number="257"/> + <syscall name="timer_delete" number="258"/> + <syscall name="clock_settime" number="259"/> + <syscall name="clock_gettime" number="260"/> + <syscall name="clock_getres" number="261"/> + <syscall name="clock_nanosleep" number="262"/> + <syscall name="statfs64" number="265" groups="file"/> + <syscall name="fstatfs64" number="266" groups="descriptor"/> + <syscall name="remap_file_pages" number="267" groups="memory"/> + <syscall name="mbind" number="268" groups="memory"/> + <syscall name="get_mempolicy" number="269" groups="memory"/> + <syscall name="set_mempolicy" number="270" groups="memory"/> + <syscall name="mq_open" number="271"/> + <syscall name="mq_unlink" number="272"/> + <syscall name="mq_timedsend" number="273"/> + <syscall name="mq_timedreceive" number="274"/> + <syscall name="mq_notify" number="275"/> + <syscall name="mq_getsetattr" number="276"/> + <syscall name="kexec_load" number="277"/> + <syscall name="add_key" number="278"/> + <syscall name="request_key" number="279"/> + <syscall name="keyctl" number="280"/> + <syscall name="waitid" number="281" groups="process"/> + <syscall name="ioprio_set" number="282"/> + <syscall name="ioprio_get" number="283"/> + <syscall name="inotify_init" number="284" groups="descriptor"/> + <syscall name="inotify_add_watch" number="285" groups="descriptor"/> + <syscall name="inotify_rm_watch" number="286" groups="descriptor"/> + <syscall name="migrate_pages" number="287" groups="memory"/> + <syscall name="openat" number="288" groups="descriptor,file"/> + <syscall name="mkdirat" number="289" groups="descriptor,file"/> + <syscall name="mknodat" number="290" groups="descriptor,file"/> + <syscall name="fchownat" number="291" groups="descriptor,file"/> + <syscall name="futimesat" number="292" groups="descriptor,file"/> + <syscall name="newfstatat" number="293" groups="descriptor,file"/> + <syscall name="unlinkat" number="294" groups="descriptor,file"/> + <syscall name="renameat" number="295" groups="descriptor,file"/> + <syscall name="linkat" number="296" groups="descriptor,file"/> + <syscall name="symlinkat" number="297" groups="descriptor,file"/> + <syscall name="readlinkat" number="298" groups="descriptor,file"/> + <syscall name="fchmodat" number="299" groups="descriptor,file"/> + <syscall name="faccessat" number="300" groups="descriptor,file"/> + <syscall name="pselect6" number="301" groups="descriptor"/> + <syscall name="ppoll" number="302" groups="descriptor"/> + <syscall name="unshare" number="303" groups="process"/> + <syscall name="set_robust_list" number="304"/> + <syscall name="get_robust_list" number="305"/> + <syscall name="splice" number="306" groups="descriptor"/> + <syscall name="sync_file_range" number="307" groups="descriptor"/> + <syscall name="tee" number="308" groups="descriptor"/> + <syscall name="vmsplice" number="309" groups="descriptor"/> + <syscall name="move_pages" number="310" groups="memory"/> + <syscall name="getcpu" number="311"/> + <syscall name="epoll_pwait" number="312" groups="descriptor"/> + <syscall name="utimes" number="313" groups="file"/> + <syscall name="fallocate" number="314" groups="descriptor"/> + <syscall name="utimensat" number="315" groups="descriptor,file"/> + <syscall name="signalfd" number="316" groups="descriptor,signal"/> + <syscall name="timerfd" number="317" groups="descriptor"/> + <syscall name="eventfd" number="318" groups="descriptor"/> + <syscall name="timerfd_create" number="319" groups="descriptor"/> + <syscall name="timerfd_settime" number="320" groups="descriptor"/> + <syscall name="timerfd_gettime" number="321" groups="descriptor"/> + <syscall name="signalfd4" number="322" groups="descriptor,signal"/> + <syscall name="eventfd2" number="323" groups="descriptor"/> + <syscall name="inotify_init1" number="324" groups="descriptor"/> + <syscall name="pipe2" number="325" groups="descriptor"/> + <syscall name="dup3" number="326" groups="descriptor"/> + <syscall name="epoll_create1" number="327" groups="descriptor"/> + <syscall name="rt_tgsigqueueinfo" number="330" groups="process,signal"/> + <syscall name="perf_event_open" number="331" groups="descriptor"/> + <syscall name="fanotify_init" number="332" groups="descriptor"/> + <syscall name="fanotify_mark" number="333" groups="descriptor,file"/> + <syscall name="prlimit64" number="334"/> + <syscall name="name_to_handle_at" number="335" groups="descriptor,file"/> + <syscall name="open_by_handle_at" number="336" groups="descriptor"/> + <syscall name="clock_adjtime" number="337"/> + <syscall name="syncfs" number="338" groups="descriptor"/> + <syscall name="setns" number="339" groups="descriptor"/> + <syscall name="process_vm_readv" number="340"/> + <syscall name="process_vm_writev" number="341"/> + <syscall name="s390_runtime_instr" number="342"/> + <syscall name="kcmp" number="343"/> + <syscall name="finit_module" number="344" groups="descriptor"/> + <syscall name="sched_setattr" number="345"/> + <syscall name="sched_getattr" number="346"/> + <syscall name="renameat2" number="347"/> + <syscall name="seccomp" number="348"/> + <syscall name="getrandom" number="349"/> + <syscall name="memfd_create" number="350"/> + <syscall name="bpf" number="351"/> + <syscall name="s390_pci_mmio_write" number="352"/> + <syscall name="s390_pci_mmio_read" number="353"/> + <syscall name="execveat" number="354"/> + <syscall name="userfaultfd" number="355"/> + <syscall name="membarrier" number="356"/> + <syscall name="recvmmsg" number="357" groups="network"/> + <syscall name="sendmmsg" number="358" groups="network"/> + <syscall name="socket" number="359" groups="network"/> + <syscall name="socketpair" number="360" groups="network"/> + <syscall name="bind" number="361" groups="network"/> + <syscall name="connect" number="362" groups="network"/> + <syscall name="listen" number="363" groups="network"/> + <syscall name="accept4" number="364" groups="network"/> + <syscall name="getsockopt" number="365" groups="network"/> + <syscall name="setsockopt" number="366" groups="network"/> + <syscall name="getsockname" number="367" groups="network"/> + <syscall name="getpeername" number="368" groups="network"/> + <syscall name="sendto" number="369" groups="network"/> + <syscall name="sendmsg" number="370" groups="network"/> + <syscall name="recvfrom" number="371" groups="network"/> + <syscall name="recvmsg" number="372" groups="network"/> + <syscall name="shutdown" number="373" groups="network"/> + <syscall name="mlock2" number="374"/> +</syscalls_info> diff --git a/tools/msys/mingw32/share/gdb/syscalls/sparc-linux.xml b/tools/msys/mingw32/share/gdb/syscalls/sparc-linux.xml new file mode 100644 index 0000000000000000000000000000000000000000..fe833d04ed33213c713b8057602f3c885265a12e --- /dev/null +++ b/tools/msys/mingw32/share/gdb/syscalls/sparc-linux.xml @@ -0,0 +1,341 @@ +<?xml version="1.0"?> +<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd"> +<!-- Copyright (C) 2010-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> +<!-- This file was generated using the following file: + + /usr/src/linux/arch/sparc/include/asm/unistd.h + + The file mentioned above belongs to the Linux Kernel. --> +<syscalls_info> + <syscall name="restart_syscall" number="0"/> + <syscall name="exit" number="1" groups="process"/> + <syscall name="fork" number="2" groups="process"/> + <syscall name="read" number="3" groups="descriptor"/> + <syscall name="write" number="4" groups="descriptor"/> + <syscall name="open" number="5" groups="descriptor,file"/> + <syscall name="close" number="6" groups="descriptor"/> + <syscall name="wait4" number="7" groups="process"/> + <syscall name="creat" number="8" groups="descriptor,file"/> + <syscall name="link" number="9" groups="file"/> + <syscall name="unlink" number="10" groups="file"/> + <syscall name="execv" number="11" groups="file,process"/> + <syscall name="chdir" number="12" groups="file"/> + <syscall name="chown" number="13" groups="file"/> + <syscall name="mknod" number="14" groups="file"/> + <syscall name="chmod" number="15" groups="file"/> + <syscall name="lchown" number="16" groups="file"/> + <syscall name="brk" number="17" groups="memory"/> + <syscall name="perfctr" number="18"/> + <syscall name="lseek" number="19" groups="descriptor"/> + <syscall name="getpid" number="20"/> + <syscall name="capget" number="21"/> + <syscall name="capset" number="22"/> + <syscall name="setuid" number="23"/> + <syscall name="getuid" number="24"/> + <syscall name="vmsplice" number="25" groups="descriptor"/> + <syscall name="ptrace" number="26"/> + <syscall name="alarm" number="27"/> + <syscall name="sigaltstack" number="28" groups="signal"/> + <syscall name="pause" number="29" groups="signal"/> + <syscall name="utime" number="30" groups="file"/> + <syscall name="lchown32" number="31" groups="file"/> + <syscall name="fchown32" number="32" groups="descriptor"/> + <syscall name="access" number="33" groups="file"/> + <syscall name="nice" number="34"/> + <syscall name="chown32" number="35" groups="file"/> + <syscall name="sync" number="36"/> + <syscall name="kill" number="37" groups="signal"/> + <syscall name="stat" number="38" groups="file"/> + <syscall name="sendfile" number="39" groups="descriptor,network"/> + <syscall name="lstat" number="40" groups="file"/> + <syscall name="dup" number="41" groups="descriptor"/> + <syscall name="pipe" number="42" groups="descriptor"/> + <syscall name="times" number="43"/> + <syscall name="getuid32" number="44"/> + <syscall name="umount2" number="45" groups="file"/> + <syscall name="setgid" number="46"/> + <syscall name="getgid" number="47"/> + <syscall name="signal" number="48" groups="signal"/> + <syscall name="geteuid" number="49"/> + <syscall name="getegid" number="50"/> + <syscall name="acct" number="51" groups="file"/> + <syscall name="getgid32" number="53"/> + <syscall name="ioctl" number="54" groups="descriptor"/> + <syscall name="reboot" number="55"/> + <syscall name="mmap2" number="56" groups="descriptor,memory"/> + <syscall name="symlink" number="57" groups="file"/> + <syscall name="readlink" number="58" groups="file"/> + <syscall name="execve" number="59" groups="file,process"/> + <syscall name="umask" number="60"/> + <syscall name="chroot" number="61" groups="file"/> + <syscall name="fstat" number="62" groups="descriptor"/> + <syscall name="fstat64" number="63" groups="descriptor"/> + <syscall name="getpagesize" number="64"/> + <syscall name="msync" number="65" groups="memory"/> + <syscall name="vfork" number="66" groups="process"/> + <syscall name="pread64" number="67" groups="descriptor"/> + <syscall name="pwrite64" number="68" groups="descriptor"/> + <syscall name="geteuid32" number="69"/> + <syscall name="getegid32" number="70"/> + <syscall name="mmap" number="71" groups="descriptor,memory"/> + <syscall name="setreuid32" number="72"/> + <syscall name="munmap" number="73" groups="memory"/> + <syscall name="mprotect" number="74" groups="memory"/> + <syscall name="madvise" number="75" groups="memory"/> + <syscall name="vhangup" number="76"/> + <syscall name="truncate64" number="77" groups="file"/> + <syscall name="mincore" number="78" groups="memory"/> + <syscall name="getgroups" number="79"/> + <syscall name="setgroups" number="80"/> + <syscall name="getpgrp" number="81"/> + <syscall name="setgroups32" number="82"/> + <syscall name="setitimer" number="83"/> + <syscall name="ftruncate64" number="84" groups="descriptor"/> + <syscall name="swapon" number="85" groups="file"/> + <syscall name="getitimer" number="86"/> + <syscall name="setuid32" number="87"/> + <syscall name="sethostname" number="88"/> + <syscall name="setgid32" number="89"/> + <syscall name="dup2" number="90" groups="descriptor"/> + <syscall name="setfsuid32" number="91"/> + <syscall name="fcntl" number="92" groups="descriptor"/> + <syscall name="select" number="93" groups="descriptor"/> + <syscall name="setfsgid32" number="94"/> + <syscall name="fsync" number="95" groups="descriptor"/> + <syscall name="setpriority" number="96"/> + <syscall name="socket" number="97" groups="network"/> + <syscall name="connect" number="98" groups="network"/> + <syscall name="accept" number="99" groups="network"/> + <syscall name="getpriority" number="100"/> + <syscall name="rt_sigreturn" number="101" groups="signal"/> + <syscall name="rt_sigaction" number="102" groups="signal"/> + <syscall name="rt_sigprocmask" number="103" groups="signal"/> + <syscall name="rt_sigpending" number="104" groups="signal"/> + <syscall name="rt_sigtimedwait" number="105" groups="signal"/> + <syscall name="rt_sigqueueinfo" number="106" groups="signal"/> + <syscall name="rt_sigsuspend" number="107" groups="signal"/> + <syscall name="setresuid32" number="108"/> + <syscall name="getresuid32" number="109"/> + <syscall name="setresgid32" number="110"/> + <syscall name="getresgid32" number="111"/> + <syscall name="setregid32" number="112"/> + <syscall name="recvmsg" number="113" groups="network"/> + <syscall name="sendmsg" number="114" groups="network"/> + <syscall name="getgroups32" number="115"/> + <syscall name="gettimeofday" number="116"/> + <syscall name="getrusage" number="117"/> + <syscall name="getsockopt" number="118" groups="network"/> + <syscall name="getcwd" number="119" groups="file"/> + <syscall name="readv" number="120" groups="descriptor"/> + <syscall name="writev" number="121" groups="descriptor"/> + <syscall name="settimeofday" number="122"/> + <syscall name="fchown" number="123" groups="descriptor"/> + <syscall name="fchmod" number="124" groups="descriptor"/> + <syscall name="recvfrom" number="125" groups="network"/> + <syscall name="setreuid" number="126"/> + <syscall name="setregid" number="127"/> + <syscall name="rename" number="128" groups="file"/> + <syscall name="truncate" number="129" groups="file"/> + <syscall name="ftruncate" number="130" groups="descriptor"/> + <syscall name="flock" number="131" groups="descriptor"/> + <syscall name="lstat64" number="132" groups="file"/> + <syscall name="sendto" number="133" groups="network"/> + <syscall name="shutdown" number="134" groups="network"/> + <syscall name="socketpair" number="135" groups="network"/> + <syscall name="mkdir" number="136" groups="file"/> + <syscall name="rmdir" number="137" groups="file"/> + <syscall name="utimes" number="138" groups="file"/> + <syscall name="stat64" number="139" groups="file"/> + <syscall name="sendfile64" number="140" groups="descriptor,network"/> + <syscall name="getpeername" number="141" groups="network"/> + <syscall name="futex" number="142"/> + <syscall name="gettid" number="143"/> + <syscall name="getrlimit" number="144"/> + <syscall name="setrlimit" number="145"/> + <syscall name="pivot_root" number="146" groups="file"/> + <syscall name="prctl" number="147"/> + <syscall name="pciconfig_read" number="148"/> + <syscall name="pciconfig_write" number="149"/> + <syscall name="getsockname" number="150" groups="network"/> + <syscall name="inotify_init" number="151" groups="descriptor"/> + <syscall name="inotify_add_watch" number="152" groups="descriptor"/> + <syscall name="poll" number="153" groups="descriptor"/> + <syscall name="getdents64" number="154" groups="descriptor"/> + <syscall name="fcntl64" number="155" groups="descriptor"/> + <syscall name="inotify_rm_watch" number="156" groups="descriptor"/> + <syscall name="statfs" number="157" groups="file"/> + <syscall name="fstatfs" number="158" groups="descriptor"/> + <syscall name="umount" number="159" groups="file"/> + <syscall name="sched_set_affinity" number="160"/> + <syscall name="sched_get_affinity" number="161"/> + <syscall name="getdomainname" number="162"/> + <syscall name="setdomainname" number="163"/> + <syscall name="quotactl" number="165" groups="file"/> + <syscall name="set_tid_address" number="166"/> + <syscall name="mount" number="167" groups="file"/> + <syscall name="ustat" number="168"/> + <syscall name="setxattr" number="169" groups="file"/> + <syscall name="lsetxattr" number="170" groups="file"/> + <syscall name="fsetxattr" number="171" groups="descriptor"/> + <syscall name="getxattr" number="172" groups="file"/> + <syscall name="lgetxattr" number="173" groups="file"/> + <syscall name="getdents" number="174" groups="descriptor"/> + <syscall name="setsid" number="175"/> + <syscall name="fchdir" number="176" groups="descriptor"/> + <syscall name="fgetxattr" number="177" groups="descriptor"/> + <syscall name="listxattr" number="178" groups="file"/> + <syscall name="llistxattr" number="179" groups="file"/> + <syscall name="flistxattr" number="180" groups="descriptor"/> + <syscall name="removexattr" number="181" groups="file"/> + <syscall name="lremovexattr" number="182" groups="file"/> + <syscall name="sigpending" number="183" groups="signal"/> + <syscall name="query_module" number="184"/> + <syscall name="setpgid" number="185"/> + <syscall name="fremovexattr" number="186" groups="descriptor"/> + <syscall name="tkill" number="187" groups="signal"/> + <syscall name="exit_group" number="188" groups="process"/> + <syscall name="uname" number="189"/> + <syscall name="init_module" number="190"/> + <syscall name="personality" number="191"/> + <syscall name="remap_file_pages" number="192" groups="memory"/> + <syscall name="epoll_create" number="193" groups="descriptor"/> + <syscall name="epoll_ctl" number="194" groups="descriptor"/> + <syscall name="epoll_wait" number="195" groups="descriptor"/> + <syscall name="ioprio_set" number="196"/> + <syscall name="getppid" number="197"/> + <syscall name="sigaction" number="198" groups="signal"/> + <syscall name="sgetmask" number="199" groups="signal"/> + <syscall name="ssetmask" number="200" groups="signal"/> + <syscall name="sigsuspend" number="201" groups="signal"/> + <syscall name="oldlstat" number="202" groups="file"/> + <syscall name="uselib" number="203" groups="file"/> + <syscall name="readdir" number="204" groups="descriptor"/> + <syscall name="readahead" number="205" groups="descriptor"/> + <syscall name="socketcall" number="206" groups="descriptor"/> + <syscall name="syslog" number="207"/> + <syscall name="lookup_dcookie" number="208"/> + <syscall name="fadvise64" number="209" groups="descriptor"/> + <syscall name="fadvise64_64" number="210" groups="descriptor"/> + <syscall name="tgkill" number="211" groups="signal"/> + <syscall name="waitpid" number="212" groups="process"/> + <syscall name="swapoff" number="213" groups="file"/> + <syscall name="sysinfo" number="214"/> + <syscall name="ipc" number="215" groups="ipc"/> + <syscall name="sigreturn" number="216" groups="signal"/> + <syscall name="clone" number="217" groups="process"/> + <syscall name="ioprio_get" number="218"/> + <syscall name="adjtimex" number="219"/> + <syscall name="sigprocmask" number="220" groups="signal"/> + <syscall name="create_module" number="221"/> + <syscall name="delete_module" number="222"/> + <syscall name="get_kernel_syms" number="223"/> + <syscall name="getpgid" number="224"/> + <syscall name="bdflush" number="225"/> + <syscall name="sysfs" number="226"/> + <syscall name="afs_syscall" number="227"/> + <syscall name="setfsuid" number="228"/> + <syscall name="setfsgid" number="229"/> + <syscall name="_newselect" number="230" groups="descriptor"/> + <syscall name="time" number="231"/> + <syscall name="splice" number="232" groups="descriptor"/> + <syscall name="stime" number="233"/> + <syscall name="statfs64" number="234" groups="file"/> + <syscall name="fstatfs64" number="235" groups="descriptor"/> + <syscall name="_llseek" number="236" groups="descriptor"/> + <syscall name="mlock" number="237" groups="memory"/> + <syscall name="munlock" number="238" groups="memory"/> + <syscall name="mlockall" number="239" groups="memory"/> + <syscall name="munlockall" number="240" groups="memory"/> + <syscall name="sched_setparam" number="241"/> + <syscall name="sched_getparam" number="242"/> + <syscall name="sched_setscheduler" number="243"/> + <syscall name="sched_getscheduler" number="244"/> + <syscall name="sched_yield" number="245"/> + <syscall name="sched_get_priority_max" number="246"/> + <syscall name="sched_get_priority_min" number="247"/> + <syscall name="sched_rr_get_interval" number="248"/> + <syscall name="nanosleep" number="249"/> + <syscall name="mremap" number="250" groups="memory"/> + <syscall name="_sysctl" number="251"/> + <syscall name="getsid" number="252"/> + <syscall name="fdatasync" number="253" groups="descriptor"/> + <syscall name="nfsservctl" number="254"/> + <syscall name="sync_file_range" number="255" groups="descriptor"/> + <syscall name="clock_settime" number="256"/> + <syscall name="clock_gettime" number="257"/> + <syscall name="clock_getres" number="258"/> + <syscall name="clock_nanosleep" number="259"/> + <syscall name="sched_getaffinity" number="260"/> + <syscall name="sched_setaffinity" number="261"/> + <syscall name="timer_settime" number="262"/> + <syscall name="timer_gettime" number="263"/> + <syscall name="timer_getoverrun" number="264"/> + <syscall name="timer_delete" number="265"/> + <syscall name="timer_create" number="266"/> + <syscall name="vserver" number="267"/> + <syscall name="io_setup" number="268"/> + <syscall name="io_destroy" number="269"/> + <syscall name="io_submit" number="270"/> + <syscall name="io_cancel" number="271"/> + <syscall name="io_getevents" number="272"/> + <syscall name="mq_open" number="273"/> + <syscall name="mq_unlink" number="274"/> + <syscall name="mq_timedsend" number="275"/> + <syscall name="mq_timedreceive" number="276"/> + <syscall name="mq_notify" number="277"/> + <syscall name="mq_getsetattr" number="278"/> + <syscall name="waitid" number="279" groups="process"/> + <syscall name="tee" number="280" groups="descriptor"/> + <syscall name="add_key" number="281"/> + <syscall name="request_key" number="282"/> + <syscall name="keyctl" number="283"/> + <syscall name="openat" number="284" groups="descriptor,file"/> + <syscall name="mkdirat" number="285" groups="descriptor,file"/> + <syscall name="mknodat" number="286" groups="descriptor,file"/> + <syscall name="fchownat" number="287" groups="descriptor,file"/> + <syscall name="futimesat" number="288" groups="descriptor,file"/> + <syscall name="fstatat64" number="289" groups="descriptor,file"/> + <syscall name="unlinkat" number="290" groups="descriptor,file"/> + <syscall name="renameat" number="291" groups="descriptor,file"/> + <syscall name="linkat" number="292" groups="descriptor,file"/> + <syscall name="symlinkat" number="293" groups="descriptor,file"/> + <syscall name="readlinkat" number="294" groups="descriptor,file"/> + <syscall name="fchmodat" number="295" groups="descriptor,file"/> + <syscall name="faccessat" number="296" groups="descriptor,file"/> + <syscall name="pselect6" number="297" groups="descriptor"/> + <syscall name="ppoll" number="298" groups="descriptor"/> + <syscall name="unshare" number="299" groups="process"/> + <syscall name="set_robust_list" number="300"/> + <syscall name="get_robust_list" number="301"/> + <syscall name="migrate_pages" number="302" groups="memory"/> + <syscall name="mbind" number="303" groups="memory"/> + <syscall name="get_mempolicy" number="304" groups="memory"/> + <syscall name="set_mempolicy" number="305" groups="memory"/> + <syscall name="kexec_load" number="306"/> + <syscall name="move_pages" number="307" groups="memory"/> + <syscall name="getcpu" number="308"/> + <syscall name="epoll_pwait" number="309" groups="descriptor"/> + <syscall name="utimensat" number="310" groups="descriptor,file"/> + <syscall name="signalfd" number="311" groups="descriptor,signal"/> + <syscall name="timerfd_create" number="312" groups="descriptor"/> + <syscall name="eventfd" number="313" groups="descriptor"/> + <syscall name="fallocate" number="314" groups="descriptor"/> + <syscall name="timerfd_settime" number="315" groups="descriptor"/> + <syscall name="timerfd_gettime" number="316" groups="descriptor"/> + <syscall name="signalfd4" number="317" groups="descriptor,signal"/> + <syscall name="eventfd2" number="318" groups="descriptor"/> + <syscall name="epoll_create1" number="319" groups="descriptor"/> + <syscall name="dup3" number="320" groups="descriptor"/> + <syscall name="pipe2" number="321" groups="descriptor"/> + <syscall name="inotify_init1" number="322" groups="descriptor"/> + <syscall name="accept4" number="323" groups="network"/> + <syscall name="preadv" number="324" groups="descriptor"/> + <syscall name="pwritev" number="325" groups="descriptor"/> + <syscall name="rt_tgsigqueueinfo" number="326" groups="process,signal"/> + <syscall name="perf_event_open" number="327" groups="descriptor"/> + <syscall name="recvmmsg" number="328" groups="network"/> +</syscalls_info> diff --git a/tools/msys/mingw32/share/gdb/syscalls/sparc64-linux.xml b/tools/msys/mingw32/share/gdb/syscalls/sparc64-linux.xml new file mode 100644 index 0000000000000000000000000000000000000000..7339dc4dfc5801361085cbeb4479c5738f0413ed --- /dev/null +++ b/tools/msys/mingw32/share/gdb/syscalls/sparc64-linux.xml @@ -0,0 +1,323 @@ +<?xml version="1.0"?> +<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd"> +<!-- Copyright (C) 2010-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> +<!-- This file was generated using the following file: + + /usr/src/linux/arch/sparc/include/asm/unistd.h + + The file mentioned above belongs to the Linux Kernel. --> +<syscalls_info> + <syscall name="restart_syscall" number="0"/> + <syscall name="exit" number="1" groups="process"/> + <syscall name="fork" number="2" groups="process"/> + <syscall name="read" number="3" groups="descriptor"/> + <syscall name="write" number="4" groups="descriptor"/> + <syscall name="open" number="5" groups="descriptor,file"/> + <syscall name="close" number="6" groups="descriptor"/> + <syscall name="wait4" number="7" groups="process"/> + <syscall name="creat" number="8" groups="descriptor,file"/> + <syscall name="link" number="9" groups="file"/> + <syscall name="unlink" number="10" groups="file"/> + <syscall name="execv" number="11" groups="file,process"/> + <syscall name="chdir" number="12" groups="file"/> + <syscall name="chown" number="13" groups="file"/> + <syscall name="mknod" number="14" groups="file"/> + <syscall name="chmod" number="15" groups="file"/> + <syscall name="lchown" number="16" groups="file"/> + <syscall name="brk" number="17" groups="memory"/> + <syscall name="perfctr" number="18"/> + <syscall name="lseek" number="19" groups="descriptor"/> + <syscall name="getpid" number="20"/> + <syscall name="capget" number="21"/> + <syscall name="capset" number="22"/> + <syscall name="setuid" number="23"/> + <syscall name="getuid" number="24"/> + <syscall name="vmsplice" number="25" groups="descriptor"/> + <syscall name="ptrace" number="26"/> + <syscall name="alarm" number="27"/> + <syscall name="sigaltstack" number="28" groups="signal"/> + <syscall name="pause" number="29" groups="signal"/> + <syscall name="utime" number="30" groups="file"/> + <syscall name="access" number="33" groups="file"/> + <syscall name="nice" number="34"/> + <syscall name="sync" number="36"/> + <syscall name="kill" number="37" groups="signal"/> + <syscall name="stat" number="38" groups="file"/> + <syscall name="sendfile" number="39" groups="descriptor,network"/> + <syscall name="lstat" number="40" groups="file"/> + <syscall name="dup" number="41" groups="descriptor"/> + <syscall name="pipe" number="42" groups="descriptor"/> + <syscall name="times" number="43"/> + <syscall name="umount2" number="45" groups="file"/> + <syscall name="setgid" number="46"/> + <syscall name="getgid" number="47"/> + <syscall name="signal" number="48" groups="signal"/> + <syscall name="geteuid" number="49"/> + <syscall name="getegid" number="50"/> + <syscall name="acct" number="51" groups="file"/> + <syscall name="memory_ordering" number="52"/> + <syscall name="ioctl" number="54" groups="descriptor"/> + <syscall name="reboot" number="55"/> + <syscall name="symlink" number="57" groups="file"/> + <syscall name="readlink" number="58" groups="file"/> + <syscall name="execve" number="59" groups="file,process"/> + <syscall name="umask" number="60"/> + <syscall name="chroot" number="61" groups="file"/> + <syscall name="fstat" number="62" groups="descriptor"/> + <syscall name="fstat64" number="63" groups="descriptor"/> + <syscall name="getpagesize" number="64"/> + <syscall name="msync" number="65" groups="memory"/> + <syscall name="vfork" number="66" groups="process"/> + <syscall name="pread64" number="67" groups="descriptor"/> + <syscall name="pwrite64" number="68" groups="descriptor"/> + <syscall name="mmap" number="71" groups="descriptor,memory"/> + <syscall name="munmap" number="73" groups="memory"/> + <syscall name="mprotect" number="74" groups="memory"/> + <syscall name="madvise" number="75" groups="memory"/> + <syscall name="vhangup" number="76"/> + <syscall name="mincore" number="78" groups="memory"/> + <syscall name="getgroups" number="79"/> + <syscall name="setgroups" number="80"/> + <syscall name="getpgrp" number="81"/> + <syscall name="setitimer" number="83"/> + <syscall name="swapon" number="85" groups="file"/> + <syscall name="getitimer" number="86"/> + <syscall name="sethostname" number="88"/> + <syscall name="dup2" number="90" groups="descriptor"/> + <syscall name="fcntl" number="92" groups="descriptor"/> + <syscall name="select" number="93" groups="descriptor"/> + <syscall name="fsync" number="95" groups="descriptor"/> + <syscall name="setpriority" number="96"/> + <syscall name="socket" number="97" groups="network"/> + <syscall name="connect" number="98" groups="network"/> + <syscall name="accept" number="99" groups="network"/> + <syscall name="getpriority" number="100"/> + <syscall name="rt_sigreturn" number="101" groups="signal"/> + <syscall name="rt_sigaction" number="102" groups="signal"/> + <syscall name="rt_sigprocmask" number="103" groups="signal"/> + <syscall name="rt_sigpending" number="104" groups="signal"/> + <syscall name="rt_sigtimedwait" number="105" groups="signal"/> + <syscall name="rt_sigqueueinfo" number="106" groups="signal"/> + <syscall name="rt_sigsuspend" number="107" groups="signal"/> + <syscall name="setresuid" number="108"/> + <syscall name="getresuid" number="109"/> + <syscall name="setresgid" number="110"/> + <syscall name="getresgid" number="111"/> + <syscall name="recvmsg" number="113" groups="network"/> + <syscall name="sendmsg" number="114" groups="network"/> + <syscall name="gettimeofday" number="116"/> + <syscall name="getrusage" number="117"/> + <syscall name="getsockopt" number="118" groups="network"/> + <syscall name="getcwd" number="119" groups="file"/> + <syscall name="readv" number="120" groups="descriptor"/> + <syscall name="writev" number="121" groups="descriptor"/> + <syscall name="settimeofday" number="122"/> + <syscall name="fchown" number="123" groups="descriptor"/> + <syscall name="fchmod" number="124" groups="descriptor"/> + <syscall name="recvfrom" number="125" groups="network"/> + <syscall name="setreuid" number="126"/> + <syscall name="setregid" number="127"/> + <syscall name="rename" number="128" groups="file"/> + <syscall name="truncate" number="129" groups="file"/> + <syscall name="ftruncate" number="130" groups="descriptor"/> + <syscall name="flock" number="131" groups="descriptor"/> + <syscall name="lstat64" number="132" groups="file"/> + <syscall name="sendto" number="133" groups="network"/> + <syscall name="shutdown" number="134" groups="network"/> + <syscall name="socketpair" number="135" groups="network"/> + <syscall name="mkdir" number="136" groups="file"/> + <syscall name="rmdir" number="137" groups="file"/> + <syscall name="utimes" number="138" groups="file"/> + <syscall name="stat64" number="139" groups="file"/> + <syscall name="sendfile64" number="140" groups="descriptor,network"/> + <syscall name="getpeername" number="141" groups="network"/> + <syscall name="futex" number="142"/> + <syscall name="gettid" number="143"/> + <syscall name="getrlimit" number="144"/> + <syscall name="setrlimit" number="145"/> + <syscall name="pivot_root" number="146" groups="file"/> + <syscall name="prctl" number="147"/> + <syscall name="pciconfig_read" number="148"/> + <syscall name="pciconfig_write" number="149"/> + <syscall name="getsockname" number="150" groups="network"/> + <syscall name="inotify_init" number="151" groups="descriptor"/> + <syscall name="inotify_add_watch" number="152" groups="descriptor"/> + <syscall name="poll" number="153" groups="descriptor"/> + <syscall name="getdents64" number="154" groups="descriptor"/> + <syscall name="inotify_rm_watch" number="156" groups="descriptor"/> + <syscall name="statfs" number="157" groups="file"/> + <syscall name="fstatfs" number="158" groups="descriptor"/> + <syscall name="umount" number="159" groups="file"/> + <syscall name="sched_set_affinity" number="160"/> + <syscall name="sched_get_affinity" number="161"/> + <syscall name="getdomainname" number="162"/> + <syscall name="setdomainname" number="163"/> + <syscall name="utrap_install" number="164"/> + <syscall name="quotactl" number="165" groups="file"/> + <syscall name="set_tid_address" number="166"/> + <syscall name="mount" number="167" groups="file"/> + <syscall name="ustat" number="168"/> + <syscall name="setxattr" number="169" groups="file"/> + <syscall name="lsetxattr" number="170" groups="file"/> + <syscall name="fsetxattr" number="171" groups="descriptor"/> + <syscall name="getxattr" number="172" groups="file"/> + <syscall name="lgetxattr" number="173" groups="file"/> + <syscall name="getdents" number="174" groups="descriptor"/> + <syscall name="setsid" number="175"/> + <syscall name="fchdir" number="176" groups="descriptor"/> + <syscall name="fgetxattr" number="177" groups="descriptor"/> + <syscall name="listxattr" number="178" groups="file"/> + <syscall name="llistxattr" number="179" groups="file"/> + <syscall name="flistxattr" number="180" groups="descriptor"/> + <syscall name="removexattr" number="181" groups="file"/> + <syscall name="lremovexattr" number="182" groups="file"/> + <syscall name="sigpending" number="183" groups="signal"/> + <syscall name="query_module" number="184"/> + <syscall name="setpgid" number="185"/> + <syscall name="fremovexattr" number="186" groups="descriptor"/> + <syscall name="tkill" number="187" groups="signal"/> + <syscall name="exit_group" number="188" groups="process"/> + <syscall name="uname" number="189"/> + <syscall name="init_module" number="190"/> + <syscall name="personality" number="191"/> + <syscall name="remap_file_pages" number="192" groups="memory"/> + <syscall name="epoll_create" number="193" groups="descriptor"/> + <syscall name="epoll_ctl" number="194" groups="descriptor"/> + <syscall name="epoll_wait" number="195" groups="descriptor"/> + <syscall name="ioprio_set" number="196"/> + <syscall name="getppid" number="197"/> + <syscall name="sigaction" number="198" groups="signal"/> + <syscall name="sgetmask" number="199" groups="signal"/> + <syscall name="ssetmask" number="200" groups="signal"/> + <syscall name="sigsuspend" number="201" groups="signal"/> + <syscall name="oldlstat" number="202" groups="file"/> + <syscall name="uselib" number="203" groups="file"/> + <syscall name="readdir" number="204" groups="descriptor"/> + <syscall name="readahead" number="205" groups="descriptor"/> + <syscall name="socketcall" number="206" groups="descriptor"/> + <syscall name="syslog" number="207"/> + <syscall name="lookup_dcookie" number="208"/> + <syscall name="fadvise64" number="209" groups="descriptor"/> + <syscall name="fadvise64_64" number="210" groups="descriptor"/> + <syscall name="tgkill" number="211" groups="signal"/> + <syscall name="waitpid" number="212" groups="process"/> + <syscall name="swapoff" number="213" groups="file"/> + <syscall name="sysinfo" number="214"/> + <syscall name="ipc" number="215" groups="ipc"/> + <syscall name="sigreturn" number="216" groups="signal"/> + <syscall name="clone" number="217" groups="process"/> + <syscall name="ioprio_get" number="218"/> + <syscall name="adjtimex" number="219"/> + <syscall name="sigprocmask" number="220" groups="signal"/> + <syscall name="create_module" number="221"/> + <syscall name="delete_module" number="222"/> + <syscall name="get_kernel_syms" number="223"/> + <syscall name="getpgid" number="224"/> + <syscall name="bdflush" number="225"/> + <syscall name="sysfs" number="226"/> + <syscall name="afs_syscall" number="227"/> + <syscall name="setfsuid" number="228"/> + <syscall name="setfsgid" number="229"/> + <syscall name="_newselect" number="230" groups="descriptor"/> + <syscall name="splice" number="232" groups="descriptor"/> + <syscall name="stime" number="233"/> + <syscall name="statfs64" number="234" groups="file"/> + <syscall name="fstatfs64" number="235" groups="descriptor"/> + <syscall name="_llseek" number="236" groups="descriptor"/> + <syscall name="mlock" number="237" groups="memory"/> + <syscall name="munlock" number="238" groups="memory"/> + <syscall name="mlockall" number="239" groups="memory"/> + <syscall name="munlockall" number="240" groups="memory"/> + <syscall name="sched_setparam" number="241"/> + <syscall name="sched_getparam" number="242"/> + <syscall name="sched_setscheduler" number="243"/> + <syscall name="sched_getscheduler" number="244"/> + <syscall name="sched_yield" number="245"/> + <syscall name="sched_get_priority_max" number="246"/> + <syscall name="sched_get_priority_min" number="247"/> + <syscall name="sched_rr_get_interval" number="248"/> + <syscall name="nanosleep" number="249"/> + <syscall name="mremap" number="250" groups="memory"/> + <syscall name="_sysctl" number="251"/> + <syscall name="getsid" number="252"/> + <syscall name="fdatasync" number="253" groups="descriptor"/> + <syscall name="nfsservctl" number="254"/> + <syscall name="sync_file_range" number="255" groups="descriptor"/> + <syscall name="clock_settime" number="256"/> + <syscall name="clock_gettime" number="257"/> + <syscall name="clock_getres" number="258"/> + <syscall name="clock_nanosleep" number="259"/> + <syscall name="sched_getaffinity" number="260"/> + <syscall name="sched_setaffinity" number="261"/> + <syscall name="timer_settime" number="262"/> + <syscall name="timer_gettime" number="263"/> + <syscall name="timer_getoverrun" number="264"/> + <syscall name="timer_delete" number="265"/> + <syscall name="timer_create" number="266"/> + <syscall name="vserver" number="267"/> + <syscall name="io_setup" number="268"/> + <syscall name="io_destroy" number="269"/> + <syscall name="io_submit" number="270"/> + <syscall name="io_cancel" number="271"/> + <syscall name="io_getevents" number="272"/> + <syscall name="mq_open" number="273"/> + <syscall name="mq_unlink" number="274"/> + <syscall name="mq_timedsend" number="275"/> + <syscall name="mq_timedreceive" number="276"/> + <syscall name="mq_notify" number="277"/> + <syscall name="mq_getsetattr" number="278"/> + <syscall name="waitid" number="279" groups="process"/> + <syscall name="tee" number="280" groups="descriptor"/> + <syscall name="add_key" number="281"/> + <syscall name="request_key" number="282"/> + <syscall name="keyctl" number="283"/> + <syscall name="openat" number="284" groups="descriptor,file"/> + <syscall name="mkdirat" number="285" groups="descriptor,file"/> + <syscall name="mknodat" number="286" groups="descriptor,file"/> + <syscall name="fchownat" number="287" groups="descriptor,file"/> + <syscall name="futimesat" number="288" groups="descriptor,file"/> + <syscall name="fstatat64" number="289" groups="descriptor,file"/> + <syscall name="unlinkat" number="290" groups="descriptor,file"/> + <syscall name="renameat" number="291" groups="descriptor,file"/> + <syscall name="linkat" number="292" groups="descriptor,file"/> + <syscall name="symlinkat" number="293" groups="descriptor,file"/> + <syscall name="readlinkat" number="294" groups="descriptor,file"/> + <syscall name="fchmodat" number="295" groups="descriptor,file"/> + <syscall name="faccessat" number="296" groups="descriptor,file"/> + <syscall name="pselect6" number="297" groups="descriptor"/> + <syscall name="ppoll" number="298" groups="descriptor"/> + <syscall name="unshare" number="299" groups="process"/> + <syscall name="set_robust_list" number="300"/> + <syscall name="get_robust_list" number="301"/> + <syscall name="migrate_pages" number="302" groups="memory"/> + <syscall name="mbind" number="303" groups="memory"/> + <syscall name="get_mempolicy" number="304" groups="memory"/> + <syscall name="set_mempolicy" number="305" groups="memory"/> + <syscall name="kexec_load" number="306"/> + <syscall name="move_pages" number="307" groups="memory"/> + <syscall name="getcpu" number="308"/> + <syscall name="epoll_pwait" number="309" groups="descriptor"/> + <syscall name="utimensat" number="310" groups="descriptor,file"/> + <syscall name="signalfd" number="311" groups="descriptor,signal"/> + <syscall name="timerfd_create" number="312" groups="descriptor"/> + <syscall name="eventfd" number="313" groups="descriptor"/> + <syscall name="fallocate" number="314" groups="descriptor"/> + <syscall name="timerfd_settime" number="315" groups="descriptor"/> + <syscall name="timerfd_gettime" number="316" groups="descriptor"/> + <syscall name="signalfd4" number="317" groups="descriptor,signal"/> + <syscall name="eventfd2" number="318" groups="descriptor"/> + <syscall name="epoll_create1" number="319" groups="descriptor"/> + <syscall name="dup3" number="320" groups="descriptor"/> + <syscall name="pipe2" number="321" groups="descriptor"/> + <syscall name="inotify_init1" number="322" groups="descriptor"/> + <syscall name="accept4" number="323" groups="network"/> + <syscall name="preadv" number="324" groups="descriptor"/> + <syscall name="pwritev" number="325" groups="descriptor"/> + <syscall name="rt_tgsigqueueinfo" number="326" groups="process,signal"/> + <syscall name="perf_event_open" number="327" groups="descriptor"/> + <syscall name="recvmmsg" number="328" groups="network"/> +</syscalls_info> diff --git a/tools/msys/mingw32/share/gdb/system-gdbinit/elinos.py b/tools/msys/mingw32/share/gdb/system-gdbinit/elinos.py new file mode 100644 index 0000000000000000000000000000000000000000..c2b351c6ef5fb2e818ad27d90a3bf5aa72c1a11a --- /dev/null +++ b/tools/msys/mingw32/share/gdb/system-gdbinit/elinos.py @@ -0,0 +1,91 @@ +# Copyright (C) 2011-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""Configure GDB using the ELinOS environment.""" + +import os +import glob +import gdb + + +def warn(msg): + print "warning: %s" % msg + + +def get_elinos_environment(): + """Return the ELinOS environment. + + If the ELinOS environment is properly set up, return a dictionary + which contains: + * The path to the ELinOS project at key 'project'; + * The path to the ELinOS CDK at key 'cdk'; + * The ELinOS target name at key 'target' (Eg. 'i486-linux'); + * A list of Xenomai install prefixes (which could be empty, if + the ELinOS project does not include Xenomai) at key 'xenomai'. + + If one of these cannot be found, print a warning; the corresponding + value in the returned dictionary will be None. + """ + result = {} + for key in ("project", "cdk", "target"): + var = "ELINOS_" + key.upper() + if var in os.environ: + result[key] = os.environ[var] + else: + warn("%s not set" % var) + result[key] = None + + if result["project"] is not None: + result["xenomai"] = glob.glob(result["project"] + "/xenomai-[0-9.]*") + else: + result["xenomai"] = [] + + return result + + +def elinos_init(): + """Initialize debugger environment for ELinOS. + + Let the debugger know where to find the ELinOS libraries on host. This + assumes that an ELinOS environment is properly set up. If some environment + variables are missing, warn about which library may be missing. + """ + elinos_env = get_elinos_environment() + + solib_dirs = [] + + # System libraries + if None in (elinos_env[key] for key in ("cdk", "target")): + warn("ELinOS system libraries will not be loaded") + else: + solib_prefix = "%s/%s" % (elinos_env["cdk"], elinos_env["target"]) + solib_dirs += ["%s/%s" % (solib_prefix, "lib")] + gdb.execute("set solib-absolute-prefix %s" % solib_prefix) + + # Xenomai libraries. Those are optional, so have a lighter warning + # if they cannot be located. + if elinos_env["project"] is None: + warn("Xenomai libraries may not be loaded") + else: + for dir in elinos_env['xenomai']: + solib_dirs += ["%s/%s" + % (dir, "xenomai-build/usr/realtime/lib")] + + if len(solib_dirs) != 0: + gdb.execute("set solib-search-path %s" % ":".join(solib_dirs)) + + +if __name__ == "__main__": + elinos_init() diff --git a/tools/msys/mingw32/share/gdb/system-gdbinit/wrs-linux.py b/tools/msys/mingw32/share/gdb/system-gdbinit/wrs-linux.py new file mode 100644 index 0000000000000000000000000000000000000000..be56e8d1f257d0755e01bb9bcbd982dd55e4d49f --- /dev/null +++ b/tools/msys/mingw32/share/gdb/system-gdbinit/wrs-linux.py @@ -0,0 +1,25 @@ +# Copyright (C) 2011-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""Configure GDB using the WRS/Linux environment.""" + +import os + +if 'ENV_PREFIX' in os.environ: + gdb.execute('set sysroot %s' % os.environ['ENV_PREFIX']) + +else: + print "warning: ENV_PREFIX environment variable missing." + print "The debugger will probably be unable to find the correct system libraries" diff --git a/tools/msys/mingw32/share/locale/da/LC_MESSAGES/bfd.mo b/tools/msys/mingw32/share/locale/da/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..ca9e50c80efbadfd1ca90169ed04492a8db1a8f6 Binary files /dev/null and b/tools/msys/mingw32/share/locale/da/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw32/share/locale/da/LC_MESSAGES/opcodes.mo b/tools/msys/mingw32/share/locale/da/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..a2fae8ba6dd42b6a970cca4cc30a6006e3376082 Binary files /dev/null and b/tools/msys/mingw32/share/locale/da/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw32/share/locale/de/LC_MESSAGES/opcodes.mo b/tools/msys/mingw32/share/locale/de/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..2e71a14bc0fddae9e3e3a41f46c78b99611f4e3e Binary files /dev/null and b/tools/msys/mingw32/share/locale/de/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw32/share/locale/es/LC_MESSAGES/bfd.mo b/tools/msys/mingw32/share/locale/es/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..b667be50934126a9ecd35d0e6c14b560a01ee9ae Binary files /dev/null and b/tools/msys/mingw32/share/locale/es/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw32/share/locale/es/LC_MESSAGES/opcodes.mo b/tools/msys/mingw32/share/locale/es/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..99390ecac76fb7be9a539eb1f260c4c5573b5c16 Binary files /dev/null and b/tools/msys/mingw32/share/locale/es/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw32/share/locale/fi/LC_MESSAGES/bfd.mo b/tools/msys/mingw32/share/locale/fi/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..ded62c4608232870612a65c200ec869ade93c0dc Binary files /dev/null and b/tools/msys/mingw32/share/locale/fi/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw32/share/locale/fi/LC_MESSAGES/opcodes.mo b/tools/msys/mingw32/share/locale/fi/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..8c9f5d4a91749f9e1c2d4bc7d2431530291ebc4e Binary files /dev/null and b/tools/msys/mingw32/share/locale/fi/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw32/share/locale/fr/LC_MESSAGES/bfd.mo b/tools/msys/mingw32/share/locale/fr/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..74b002c31be6c3166651fe89f4dda3db9959f617 Binary files /dev/null and b/tools/msys/mingw32/share/locale/fr/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw32/share/locale/fr/LC_MESSAGES/opcodes.mo b/tools/msys/mingw32/share/locale/fr/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..f86ad78c75b1adfebcfb96f14c8dfd5ec6796475 Binary files /dev/null and b/tools/msys/mingw32/share/locale/fr/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw32/share/locale/ga/LC_MESSAGES/opcodes.mo b/tools/msys/mingw32/share/locale/ga/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..d1468449ac30fbd69a5273439f3ac816f82cf165 Binary files /dev/null and b/tools/msys/mingw32/share/locale/ga/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw32/share/locale/hr/LC_MESSAGES/bfd.mo b/tools/msys/mingw32/share/locale/hr/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..a29732ff51ca9f58f0c0647f9ffbfbd189b15482 Binary files /dev/null and b/tools/msys/mingw32/share/locale/hr/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw32/share/locale/id/LC_MESSAGES/bfd.mo b/tools/msys/mingw32/share/locale/id/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..957b28b17bfb696d9ef78154aa498336e662413b Binary files /dev/null and b/tools/msys/mingw32/share/locale/id/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw32/share/locale/id/LC_MESSAGES/opcodes.mo b/tools/msys/mingw32/share/locale/id/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..84ad41447246ac082d6bf52d808ccb6c7a04808e Binary files /dev/null and b/tools/msys/mingw32/share/locale/id/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw32/share/locale/it/LC_MESSAGES/opcodes.mo b/tools/msys/mingw32/share/locale/it/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..5fd99126405632c704b2fedcc669579601f75411 Binary files /dev/null and b/tools/msys/mingw32/share/locale/it/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw32/share/locale/ja/LC_MESSAGES/bfd.mo b/tools/msys/mingw32/share/locale/ja/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..108faf71e34da570b560aabafc2d6f6eb86d7055 Binary files /dev/null and b/tools/msys/mingw32/share/locale/ja/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw32/share/locale/nl/LC_MESSAGES/opcodes.mo b/tools/msys/mingw32/share/locale/nl/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..4d181ff82b793259d4e5cef2a1e0a7a49b42f9d9 Binary files /dev/null and b/tools/msys/mingw32/share/locale/nl/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw32/share/locale/pt/LC_MESSAGES/bfd.mo b/tools/msys/mingw32/share/locale/pt/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..f30a640bcdba8c890994c4796961947975d97585 Binary files /dev/null and b/tools/msys/mingw32/share/locale/pt/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw32/share/locale/pt_BR/LC_MESSAGES/opcodes.mo b/tools/msys/mingw32/share/locale/pt_BR/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..83106a4f38b1541bd995fd80c6f90bbbdd493c1d Binary files /dev/null and b/tools/msys/mingw32/share/locale/pt_BR/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw32/share/locale/ro/LC_MESSAGES/bfd.mo b/tools/msys/mingw32/share/locale/ro/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..2706ea70f97e2a347090342182320c3bb879201f Binary files /dev/null and b/tools/msys/mingw32/share/locale/ro/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw32/share/locale/ro/LC_MESSAGES/opcodes.mo b/tools/msys/mingw32/share/locale/ro/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..0aa0bd0a0582f782f2d8911f697962cebc2e2b9a Binary files /dev/null and b/tools/msys/mingw32/share/locale/ro/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw32/share/locale/ru/LC_MESSAGES/bfd.mo b/tools/msys/mingw32/share/locale/ru/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..52d11f5035d07cd8239a575d7d17d371aed4e9a5 Binary files /dev/null and b/tools/msys/mingw32/share/locale/ru/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw32/share/locale/rw/LC_MESSAGES/bfd.mo b/tools/msys/mingw32/share/locale/rw/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..a24c3be14db7f028dc80269dd11893fd81098cbb Binary files /dev/null and b/tools/msys/mingw32/share/locale/rw/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw32/share/locale/sr/LC_MESSAGES/bfd.mo b/tools/msys/mingw32/share/locale/sr/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..c0b7db079e4d5931fa295c5afdf73e169f17b32f Binary files /dev/null and b/tools/msys/mingw32/share/locale/sr/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw32/share/locale/sr/LC_MESSAGES/opcodes.mo b/tools/msys/mingw32/share/locale/sr/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..49551889070fa4c8c0c2358a5da79ff411bc3a94 Binary files /dev/null and b/tools/msys/mingw32/share/locale/sr/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw32/share/locale/sv/LC_MESSAGES/bfd.mo b/tools/msys/mingw32/share/locale/sv/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..8a97087ac37d5c530d5b174e9d53304e0c63a99b Binary files /dev/null and b/tools/msys/mingw32/share/locale/sv/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw32/share/locale/sv/LC_MESSAGES/opcodes.mo b/tools/msys/mingw32/share/locale/sv/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..8905f173cbf0a3dca214e0811ad65e2b00585e91 Binary files /dev/null and b/tools/msys/mingw32/share/locale/sv/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw32/share/locale/tr/LC_MESSAGES/bfd.mo b/tools/msys/mingw32/share/locale/tr/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..3a0480589789b92142e0d0e1bf874d5f22256e9a Binary files /dev/null and b/tools/msys/mingw32/share/locale/tr/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw32/share/locale/tr/LC_MESSAGES/opcodes.mo b/tools/msys/mingw32/share/locale/tr/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..9578276fc907bd8d7d7c5673600f4a1209d96546 Binary files /dev/null and b/tools/msys/mingw32/share/locale/tr/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw32/share/locale/uk/LC_MESSAGES/bfd.mo b/tools/msys/mingw32/share/locale/uk/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..048400a85b9e5f6a6d27a02084ecff43833ac922 Binary files /dev/null and b/tools/msys/mingw32/share/locale/uk/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw32/share/locale/uk/LC_MESSAGES/opcodes.mo b/tools/msys/mingw32/share/locale/uk/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..c2dba6e93d92aafb61a640a018f00f37da0605f6 Binary files /dev/null and b/tools/msys/mingw32/share/locale/uk/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw32/share/locale/vi/LC_MESSAGES/bfd.mo b/tools/msys/mingw32/share/locale/vi/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..315d95d9b6e8afd6344d50590e111add67cb89be Binary files /dev/null and b/tools/msys/mingw32/share/locale/vi/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw32/share/locale/vi/LC_MESSAGES/opcodes.mo b/tools/msys/mingw32/share/locale/vi/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..f8520c515e1b4d329d7fb2d25b604358ed1e9cfa Binary files /dev/null and b/tools/msys/mingw32/share/locale/vi/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw32/share/locale/zh_CN/LC_MESSAGES/bfd.mo b/tools/msys/mingw32/share/locale/zh_CN/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..f6e4119f16f471d669155830022e118f37519d11 Binary files /dev/null and b/tools/msys/mingw32/share/locale/zh_CN/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw32/share/locale/zh_CN/LC_MESSAGES/opcodes.mo b/tools/msys/mingw32/share/locale/zh_CN/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..05114f2e14ca514077796d8a5c15f3c380b7e71b Binary files /dev/null and b/tools/msys/mingw32/share/locale/zh_CN/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw32/share/man/man1/xxhsum.1.gz b/tools/msys/mingw32/share/man/man1/xxhsum.1.gz new file mode 100644 index 0000000000000000000000000000000000000000..691077a170988b6bb5a8289c6939a25d783692ac Binary files /dev/null and b/tools/msys/mingw32/share/man/man1/xxhsum.1.gz differ diff --git a/tools/msys/mingw64/bin/gdb-add-index b/tools/msys/mingw64/bin/gdb-add-index new file mode 100644 index 0000000000000000000000000000000000000000..b8324f1b21e98bd231dc93e3431f4ce71e53e5ec --- /dev/null +++ b/tools/msys/mingw64/bin/gdb-add-index @@ -0,0 +1,160 @@ +#! /bin/sh + +# Add a .gdb_index section to a file. + +# Copyright (C) 2010-2020 Free Software Foundation, Inc. +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# This program assumes gdb and objcopy are in $PATH. +# If not, or you want others, pass the following in the environment +GDB=${GDB:=gdb} +OBJCOPY=${OBJCOPY:=objcopy} +READELF=${READELF:=readelf} + +myname="${0##*/}" + +dwarf5="" +if [ "$1" = "-dwarf-5" ]; then + dwarf5="$1" + shift +fi + +if test $# != 1; then + echo "usage: $myname [-dwarf-5] FILE" 1>&2 + exit 1 +fi + +file="$1" + +if test ! -r "$file"; then + echo "$myname: unable to access: $file" 1>&2 + exit 1 +fi + +dir="${file%/*}" +test "$dir" = "$file" && dir="." + +dwz_file="" +if $READELF -S "$file" | grep -q " \.gnu_debugaltlink "; then + dwz_file=$($READELF --string-dump=.gnu_debugaltlink "$file" \ + | grep -A1 "'\.gnu_debugaltlink':" \ + | tail -n +2 \ + | sed 's/.*]//') + dwz_file=$(echo $dwz_file) + if $READELF -S "$dwz_file" | grep -E -q " \.(gdb_index|debug_names) "; then + # Already has an index, skip it. + dwz_file="" + fi +fi + +set_files () +{ + local file="$1" + + index4="${file}.gdb-index" + index5="${file}.debug_names" + debugstr="${file}.debug_str" + debugstrmerge="${file}.debug_str.merge" + debugstrerr="${file}.debug_str.err" +} + +tmp_files= +for f in "$file" "$dwz_file"; do + if [ "$f" = "" ]; then + continue + fi + set_files "$f" + tmp_files="$tmp_files $index4 $index5 $debugstr $debugstrmerge $debugstrerr" +done + +rm -f $tmp_files + +# Ensure intermediate index file is removed when we exit. +trap "rm -f $tmp_files" 0 + +$GDB --batch -nx -iex 'set auto-load no' \ + -ex "file $file" -ex "save gdb-index $dwarf5 $dir" || { + # Just in case. + status=$? + echo "$myname: gdb error generating index for $file" 1>&2 + exit $status +} + +# In some situations gdb can exit without creating an index. This is +# not an error. +# E.g., if $file is stripped. This behaviour is akin to stripping an +# already stripped binary, it's a no-op. +status=0 + +handle_file () +{ + local file + file="$1" + + set_files "$file" + + if test -f "$index4" -a -f "$index5"; then + echo "$myname: Both index types were created for $file" 1>&2 + status=1 + elif test -f "$index4" -o -f "$index5"; then + if test -f "$index4"; then + index="$index4" + section=".gdb_index" + else + index="$index5" + section=".debug_names" + fi + debugstradd=false + debugstrupdate=false + if test -s "$debugstr"; then + if ! $OBJCOPY --dump-section .debug_str="$debugstrmerge" "$file" \ + /dev/null 2>$debugstrerr; then + cat >&2 $debugstrerr + exit 1 + fi + if grep -q "can't dump section '.debug_str' - it does not exist" \ + $debugstrerr; then + debugstradd=true + else + debugstrupdate=true + cat >&2 $debugstrerr + fi + cat "$debugstr" >>"$debugstrmerge" + fi + + $OBJCOPY --add-section $section="$index" \ + --set-section-flags $section=readonly \ + $(if $debugstradd; then \ + echo --add-section .debug_str="$debugstrmerge"; \ + echo --set-section-flags .debug_str=readonly; \ + fi; \ + if $debugstrupdate; then \ + echo --update-section .debug_str="$debugstrmerge"; \ + fi) \ + "$file" "$file" + + status=$? + else + echo "$myname: No index was created for $file" 1>&2 + echo "$myname: [Was there no debuginfo? Was there already an index?]" \ + 1>&2 + fi +} + +handle_file "$file" +if [ "$dwz_file" != "" ]; then + handle_file "$dwz_file" +fi + +exit $status diff --git a/tools/msys/mingw64/bin/gdb.exe b/tools/msys/mingw64/bin/gdb.exe new file mode 100644 index 0000000000000000000000000000000000000000..f9d180fd882cf5f1a54ae0d77bfdfd68ac15495e Binary files /dev/null and b/tools/msys/mingw64/bin/gdb.exe differ diff --git a/tools/msys/mingw64/bin/gdbserver.exe b/tools/msys/mingw64/bin/gdbserver.exe new file mode 100644 index 0000000000000000000000000000000000000000..a6a5d784c29ca191fb701dca88d16c1e9ab7f698 Binary files /dev/null and b/tools/msys/mingw64/bin/gdbserver.exe differ diff --git a/tools/msys/mingw64/bin/libxxhash.dll b/tools/msys/mingw64/bin/libxxhash.dll new file mode 100644 index 0000000000000000000000000000000000000000..d33d429bca2352c9d8e0c2876549971e58d51dad Binary files /dev/null and b/tools/msys/mingw64/bin/libxxhash.dll differ diff --git a/tools/msys/mingw64/bin/xxhsum.exe b/tools/msys/mingw64/bin/xxhsum.exe new file mode 100644 index 0000000000000000000000000000000000000000..585cd20a2a31a9b2e228921499700fbad0ee139f Binary files /dev/null and b/tools/msys/mingw64/bin/xxhsum.exe differ diff --git a/tools/msys/mingw64/include/gdb/jit-reader.h b/tools/msys/mingw64/include/gdb/jit-reader.h new file mode 100644 index 0000000000000000000000000000000000000000..a51031f06ff89bcb52b47aa37de58fd68f4cf39c --- /dev/null +++ b/tools/msys/mingw64/include/gdb/jit-reader.h @@ -0,0 +1,346 @@ +/* JIT declarations for GDB, the GNU Debugger. + + Copyright (C) 2011-2020 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#ifndef GDB_JIT_READER_H +#define GDB_JIT_READER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Versioning information. See gdb_reader_funcs. */ + +#define GDB_READER_INTERFACE_VERSION 1 + +/* Readers must be released under a GPL compatible license. To + declare that the reader is indeed released under a GPL compatible + license, invoke the macro GDB_DECLARE_GPL_COMPATIBLE in a source + file. */ + +#ifdef __cplusplus +#define GDB_DECLARE_GPL_COMPATIBLE_READER \ + extern "C" { \ + extern int plugin_is_GPL_compatible (void); \ + extern int plugin_is_GPL_compatible (void) \ + { \ + return 0; \ + } \ + } + +#else + +#define GDB_DECLARE_GPL_COMPATIBLE_READER \ + extern int plugin_is_GPL_compatible (void); \ + extern int plugin_is_GPL_compatible (void) \ + { \ + return 0; \ + } + +#endif + +/* Represents an address on the target system. */ + +typedef unsigned long long GDB_CORE_ADDR; + +/* Return status codes. */ + +enum gdb_status { + GDB_FAIL = 0, + GDB_SUCCESS = 1 +}; + +struct gdb_object; +struct gdb_symtab; +struct gdb_block; +struct gdb_symbol_callbacks; + +/* An array of these are used to represent a map from code addresses to line + numbers in the source file. */ + +struct gdb_line_mapping +{ + int line; + GDB_CORE_ADDR pc; +}; + +/* Create a new GDB code object. Each code object can have one or + more symbol tables, each representing a compiled source file. */ + +typedef struct gdb_object *(gdb_object_open) (struct gdb_symbol_callbacks *cb); + +/* The callback used to create new symbol table. CB is the + gdb_symbol_callbacks which the structure is part of. FILE_NAME is + an (optionally NULL) file name to associate with this new symbol + table. + + Returns a new instance to gdb_symtab that can later be passed to + gdb_block_new, gdb_symtab_add_line_mapping and gdb_symtab_close. */ + +typedef struct gdb_symtab *(gdb_symtab_open) (struct gdb_symbol_callbacks *cb, + struct gdb_object *obj, + const char *file_name); + +/* Creates a new block in a given symbol table. A symbol table is a + forest of blocks, each block representing an code address range and + a corresponding (optionally NULL) NAME. In case the block + corresponds to a function, the NAME passed should be the name of + the function. + + If the new block to be created is a child of (i.e. is nested in) + another block, the parent block can be passed in PARENT. SYMTAB is + the symbol table the new block is to belong in. BEGIN, END is the + code address range the block corresponds to. + + Returns a new instance of gdb_block, which, as of now, has no use. + Note that the gdb_block returned must not be freed by the + caller. */ + +typedef struct gdb_block *(gdb_block_open) (struct gdb_symbol_callbacks *cb, + struct gdb_symtab *symtab, + struct gdb_block *parent, + GDB_CORE_ADDR begin, + GDB_CORE_ADDR end, + const char *name); + +/* Adds a PC to line number mapping for the symbol table SYMTAB. + NLINES is the number of elements in LINES, each element + corresponding to one (PC, line) pair. */ + +typedef void (gdb_symtab_add_line_mapping) (struct gdb_symbol_callbacks *cb, + struct gdb_symtab *symtab, + int nlines, + struct gdb_line_mapping *lines); + +/* Close the symtab SYMTAB. This signals to GDB that no more blocks + will be opened on this symtab. */ + +typedef void (gdb_symtab_close) (struct gdb_symbol_callbacks *cb, + struct gdb_symtab *symtab); + + +/* Closes the gdb_object OBJ and adds the emitted information into + GDB's internal structures. Once this is done, the debug + information will be picked up and used; this will usually be the + last operation in gdb_read_debug_info. */ + +typedef void (gdb_object_close) (struct gdb_symbol_callbacks *cb, + struct gdb_object *obj); + +/* Reads LEN bytes from TARGET_MEM in the target's virtual address + space into GDB_BUF. + + Returns GDB_FAIL on failure, and GDB_SUCCESS on success. */ + +typedef enum gdb_status (gdb_target_read) (GDB_CORE_ADDR target_mem, + void *gdb_buf, int len); + +/* The list of callbacks that are passed to read. These callbacks are + to be used to construct the symbol table. The functions have been + described above. */ + +struct gdb_symbol_callbacks +{ + gdb_object_open *object_open; + gdb_symtab_open *symtab_open; + gdb_block_open *block_open; + gdb_symtab_close *symtab_close; + gdb_object_close *object_close; + + gdb_symtab_add_line_mapping *line_mapping_add; + gdb_target_read *target_read; + + /* For internal use by GDB. */ + void *priv_data; +}; + +/* Forward declaration. */ + +struct gdb_reg_value; + +/* A function of this type is used to free a gdb_reg_value. See the + comment on `free' in struct gdb_reg_value. */ + +typedef void (gdb_reg_value_free) (struct gdb_reg_value *); + +/* Denotes the value of a register. */ + +struct gdb_reg_value +{ + /* The size of the register in bytes. The reader need not set this + field. This will be set for (defined) register values being read + from GDB using reg_get. */ + int size; + + /* Set to non-zero if the value for the register is known. The + registers for which the reader does not call reg_set are also + assumed to be undefined */ + int defined; + + /* Since gdb_reg_value is a variable sized structure, it will + usually be allocated on the heap. This function is expected to + contain the corresponding "free" function. + + When a pointer to gdb_reg_value is being sent from GDB to the + reader (via gdb_unwind_reg_get), the reader is expected to call + this function (with the same gdb_reg_value as argument) once it + is done with the value. + + When the function sends the a gdb_reg_value to GDB (via + gdb_unwind_reg_set), it is expected to set this field to point to + an appropriate cleanup routine (or to NULL if no cleanup is + required). */ + gdb_reg_value_free *free; + + /* The value of the register. */ + unsigned char value[1]; +}; + +/* get_frame_id in gdb_reader_funcs is to return a gdb_frame_id + corresponding to the current frame. The registers corresponding to + the current frame can be read using reg_get. Calling get_frame_id + on a particular frame should return the same gdb_frame_id + throughout its lifetime (i.e. till before it gets unwound). One + way to do this is by having the CODE_ADDRESS point to the + function's first instruction and STACK_ADDRESS point to the value + of the stack pointer when entering the function. */ + +struct gdb_frame_id +{ + GDB_CORE_ADDR code_address; + GDB_CORE_ADDR stack_address; +}; + +/* Forward declaration. */ + +struct gdb_unwind_callbacks; + +/* Returns the value of a particular register in the current frame. + The current frame is the frame that needs to be unwound into the + outer (earlier) frame. + + CB is the struct gdb_unwind_callbacks * the callback belongs to. + REGNUM is the DWARF register number of the register that needs to + be unwound. + + Returns the gdb_reg_value corresponding to the register requested. + In case the value of the register has been optimized away or + otherwise unavailable, the defined flag in the returned + gdb_reg_value will be zero. */ + +typedef struct gdb_reg_value *(gdb_unwind_reg_get) + (struct gdb_unwind_callbacks *cb, int regnum); + +/* Sets the previous value of a particular register. REGNUM is the + (DWARF) register number whose value is to be set. VAL is the value + the register is to be set to. + + VAL is *not* copied, so the memory allocated to it cannot be + reused. Once GDB no longer needs the value, it is deallocated + using the FREE function (see gdb_reg_value). + + A register can also be "set" to an undefined value by setting the + defined in VAL to zero. */ + +typedef void (gdb_unwind_reg_set) (struct gdb_unwind_callbacks *cb, int regnum, + struct gdb_reg_value *val); + +/* This struct is passed to unwind in gdb_reader_funcs, and is to be + used to unwind the current frame (current being the frame whose + registers can be read using reg_get) into the earlier frame. The + functions have been described above. */ + +struct gdb_unwind_callbacks +{ + gdb_unwind_reg_get *reg_get; + gdb_unwind_reg_set *reg_set; + gdb_target_read *target_read; + + /* For internal use by GDB. */ + void *priv_data; +}; + +/* Forward declaration. */ + +struct gdb_reader_funcs; + +/* Parse the debug info off a block of memory, pointed to by MEMORY + (already copied to GDB's address space) and MEMORY_SZ bytes long. + The implementation has to use the functions in CB to actually emit + the parsed data into GDB. SELF is the same structure returned by + gdb_init_reader. + + Return GDB_FAIL on failure and GDB_SUCCESS on success. */ + +typedef enum gdb_status (gdb_read_debug_info) (struct gdb_reader_funcs *self, + struct gdb_symbol_callbacks *cb, + void *memory, long memory_sz); + +/* Unwind the current frame, CB is the set of unwind callbacks that + are to be used to do this. + + Return GDB_FAIL on failure and GDB_SUCCESS on success. */ + +typedef enum gdb_status (gdb_unwind_frame) (struct gdb_reader_funcs *self, + struct gdb_unwind_callbacks *cb); + +/* Return the frame ID corresponding to the current frame, using C to + read the current register values. See the comment on struct + gdb_frame_id. */ + +typedef struct gdb_frame_id (gdb_get_frame_id) (struct gdb_reader_funcs *self, + struct gdb_unwind_callbacks *c); + +/* Called when a reader is being unloaded. This function should also + free SELF, if required. */ + +typedef void (gdb_destroy_reader) (struct gdb_reader_funcs *self); + +/* Called when the reader is loaded. Must either return a properly + populated gdb_reader_funcs or NULL. The memory allocated for the + gdb_reader_funcs is to be managed by the reader itself (i.e. if it + is allocated from the heap, it must also be freed in + gdb_destroy_reader). */ + +extern struct gdb_reader_funcs *gdb_init_reader (void); + +/* Pointer to the functions which implement the reader's + functionality. The individual functions have been documented + above. + + None of the fields are optional. */ + +struct gdb_reader_funcs +{ + /* Must be set to GDB_READER_INTERFACE_VERSION. */ + int reader_version; + + /* For use by the reader. */ + void *priv_data; + + gdb_read_debug_info *read; + gdb_unwind_frame *unwind; + gdb_get_frame_id *get_frame_id; + gdb_destroy_reader *destroy; +}; + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/tools/msys/mingw64/include/xxh3.h b/tools/msys/mingw64/include/xxh3.h new file mode 100644 index 0000000000000000000000000000000000000000..7e83e6418af2c01312ef8b1308bf45b9f3ae6ac2 --- /dev/null +++ b/tools/msys/mingw64/include/xxh3.h @@ -0,0 +1,55 @@ +/* + * xxHash - Extremely Fast Hash algorithm + * Development source file for `xxh3` + * Copyright (C) 2019-2020 Yann Collet + * + * BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * You can contact the author at: + * - xxHash homepage: https://www.xxhash.com + * - xxHash source repository: https://github.com/Cyan4973/xxHash + */ + +/* + * Note: This file used to host the source code of XXH3_* variants. + * during the development period. + * The source code is now properly integrated within xxhash.h. + * + * xxh3.h is no longer useful, + * but it is still provided for compatibility with source code + * which used to include it directly. + * + * Programs are now highly discourage to include xxh3.h. + * Include `xxhash.h` instead, which is the officially supported interface. + * + * In the future, xxh3.h will start to generate warnings, then errors, + * then it will be removed from source package and from include directory. + */ + +/* Simulate the same impact as including the old xxh3.h source file */ + +#define XXH_INLINE_ALL +#include "xxhash.h" diff --git a/tools/msys/mingw64/include/xxhash.h b/tools/msys/mingw64/include/xxhash.h new file mode 100644 index 0000000000000000000000000000000000000000..2d56d23c5d0beac4c1a4cab22da660674d0e0080 --- /dev/null +++ b/tools/msys/mingw64/include/xxhash.h @@ -0,0 +1,4766 @@ +/* + * xxHash - Extremely Fast Hash algorithm + * Header File + * Copyright (C) 2012-2020 Yann Collet + * + * BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * You can contact the author at: + * - xxHash homepage: https://www.xxhash.com + * - xxHash source repository: https://github.com/Cyan4973/xxHash + */ + +/* TODO: update */ +/* Notice extracted from xxHash homepage: + +xxHash is an extremely fast hash algorithm, running at RAM speed limits. +It also successfully passes all tests from the SMHasher suite. + +Comparison (single thread, Windows Seven 32 bits, using SMHasher on a Core 2 Duo @3GHz) + +Name Speed Q.Score Author +xxHash 5.4 GB/s 10 +CrapWow 3.2 GB/s 2 Andrew +MumurHash 3a 2.7 GB/s 10 Austin Appleby +SpookyHash 2.0 GB/s 10 Bob Jenkins +SBox 1.4 GB/s 9 Bret Mulvey +Lookup3 1.2 GB/s 9 Bob Jenkins +SuperFastHash 1.2 GB/s 1 Paul Hsieh +CityHash64 1.05 GB/s 10 Pike & Alakuijala +FNV 0.55 GB/s 5 Fowler, Noll, Vo +CRC32 0.43 GB/s 9 +MD5-32 0.33 GB/s 10 Ronald L. Rivest +SHA1-32 0.28 GB/s 10 + +Q.Score is a measure of quality of the hash function. +It depends on successfully passing SMHasher test set. +10 is a perfect score. + +Note: SMHasher's CRC32 implementation is not the fastest one. +Other speed-oriented implementations can be faster, +especially in combination with PCLMUL instruction: +https://fastcompression.blogspot.com/2019/03/presenting-xxh3.html?showComment=1552696407071#c3490092340461170735 + +A 64-bit version, named XXH64, is available since r35. +It offers much better speed, but for 64-bit applications only. +Name Speed on 64 bits Speed on 32 bits +XXH64 13.8 GB/s 1.9 GB/s +XXH32 6.8 GB/s 6.0 GB/s +*/ + +#if defined (__cplusplus) +extern "C" { +#endif + +/* **************************** + * INLINE mode + ******************************/ +/*! + * XXH_INLINE_ALL (and XXH_PRIVATE_API) + * Use these build macros to inline xxhash into the target unit. + * Inlining improves performance on small inputs, especially when the length is + * expressed as a compile-time constant: + * + * https://fastcompression.blogspot.com/2018/03/xxhash-for-small-keys-impressive-power.html + * + * It also keeps xxHash symbols private to the unit, so they are not exported. + * + * Usage: + * #define XXH_INLINE_ALL + * #include "xxhash.h" + * + * Do not compile and link xxhash.o as a separate object, as it is not useful. + */ +#if (defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API)) \ + && !defined(XXH_INLINE_ALL_31684351384) + /* this section should be traversed only once */ +# define XXH_INLINE_ALL_31684351384 + /* give access to the advanced API, required to compile implementations */ +# undef XXH_STATIC_LINKING_ONLY /* avoid macro redef */ +# define XXH_STATIC_LINKING_ONLY + /* make all functions private */ +# undef XXH_PUBLIC_API +# if defined(__GNUC__) +# define XXH_PUBLIC_API static __inline __attribute__((unused)) +# elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) +# define XXH_PUBLIC_API static inline +# elif defined(_MSC_VER) +# define XXH_PUBLIC_API static __inline +# else + /* note: this version may generate warnings for unused static functions */ +# define XXH_PUBLIC_API static +# endif + + /* + * This part deals with the special case where a unit wants to inline xxHash, + * but "xxhash.h" has previously been included without XXH_INLINE_ALL, such + * as part of some previously included *.h header file. + * Without further action, the new include would just be ignored, + * and functions would effectively _not_ be inlined (silent failure). + * The following macros solve this situation by prefixing all inlined names, + * avoiding naming collision with previous inclusions. + */ +# ifdef XXH_NAMESPACE +# error "XXH_INLINE_ALL with XXH_NAMESPACE is not supported" + /* + * Note: Alternative: #undef all symbols (it's a pretty large list). + * Without #error: it compiles, but functions are actually not inlined. + */ +# endif +# define XXH_NAMESPACE XXH_INLINE_ + /* + * Some identifiers (enums, type names) are not symbols, but they must + * still be renamed to avoid redeclaration. + * Alternative solution: do not redeclare them. + * However, this requires some #ifdefs, and is a more dispersed action. + * Meanwhile, renaming can be achieved in a single block + */ +# define XXH_IPREF(Id) XXH_INLINE_ ## Id +# define XXH_OK XXH_IPREF(XXH_OK) +# define XXH_ERROR XXH_IPREF(XXH_ERROR) +# define XXH_errorcode XXH_IPREF(XXH_errorcode) +# define XXH32_canonical_t XXH_IPREF(XXH32_canonical_t) +# define XXH64_canonical_t XXH_IPREF(XXH64_canonical_t) +# define XXH128_canonical_t XXH_IPREF(XXH128_canonical_t) +# define XXH32_state_s XXH_IPREF(XXH32_state_s) +# define XXH32_state_t XXH_IPREF(XXH32_state_t) +# define XXH64_state_s XXH_IPREF(XXH64_state_s) +# define XXH64_state_t XXH_IPREF(XXH64_state_t) +# define XXH3_state_s XXH_IPREF(XXH3_state_s) +# define XXH3_state_t XXH_IPREF(XXH3_state_t) +# define XXH128_hash_t XXH_IPREF(XXH128_hash_t) + /* Ensure the header is parsed again, even if it was previously included */ +# undef XXHASH_H_5627135585666179 +# undef XXHASH_H_STATIC_13879238742 +#endif /* XXH_INLINE_ALL || XXH_PRIVATE_API */ + + + +/* **************************************************************** + * Stable API + *****************************************************************/ +#ifndef XXHASH_H_5627135585666179 +#define XXHASH_H_5627135585666179 1 + +/* specific declaration modes for Windows */ +#if !defined(XXH_INLINE_ALL) && !defined(XXH_PRIVATE_API) +# if defined(WIN32) && defined(_MSC_VER) && (defined(XXH_IMPORT) || defined(XXH_EXPORT)) +# ifdef XXH_EXPORT +# define XXH_PUBLIC_API __declspec(dllexport) +# elif XXH_IMPORT +# define XXH_PUBLIC_API __declspec(dllimport) +# endif +# else +# define XXH_PUBLIC_API /* do nothing */ +# endif +#endif + +/*! + * XXH_NAMESPACE, aka Namespace Emulation: + * + * If you want to include _and expose_ xxHash functions from within your own + * library, but also want to avoid symbol collisions with other libraries which + * may also include xxHash, you can use XXH_NAMESPACE to automatically prefix + * any public symbol from xxhash library with the value of XXH_NAMESPACE + * (therefore, avoid empty or numeric values). + * + * Note that no change is required within the calling program as long as it + * includes `xxhash.h`: Regular symbol names will be automatically translated + * by this header. + */ +#ifdef XXH_NAMESPACE +# define XXH_CAT(A,B) A##B +# define XXH_NAME2(A,B) XXH_CAT(A,B) +# define XXH_versionNumber XXH_NAME2(XXH_NAMESPACE, XXH_versionNumber) +/* XXH32 */ +# define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32) +# define XXH32_createState XXH_NAME2(XXH_NAMESPACE, XXH32_createState) +# define XXH32_freeState XXH_NAME2(XXH_NAMESPACE, XXH32_freeState) +# define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset) +# define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update) +# define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest) +# define XXH32_copyState XXH_NAME2(XXH_NAMESPACE, XXH32_copyState) +# define XXH32_canonicalFromHash XXH_NAME2(XXH_NAMESPACE, XXH32_canonicalFromHash) +# define XXH32_hashFromCanonical XXH_NAME2(XXH_NAMESPACE, XXH32_hashFromCanonical) +/* XXH64 */ +# define XXH64 XXH_NAME2(XXH_NAMESPACE, XXH64) +# define XXH64_createState XXH_NAME2(XXH_NAMESPACE, XXH64_createState) +# define XXH64_freeState XXH_NAME2(XXH_NAMESPACE, XXH64_freeState) +# define XXH64_reset XXH_NAME2(XXH_NAMESPACE, XXH64_reset) +# define XXH64_update XXH_NAME2(XXH_NAMESPACE, XXH64_update) +# define XXH64_digest XXH_NAME2(XXH_NAMESPACE, XXH64_digest) +# define XXH64_copyState XXH_NAME2(XXH_NAMESPACE, XXH64_copyState) +# define XXH64_canonicalFromHash XXH_NAME2(XXH_NAMESPACE, XXH64_canonicalFromHash) +# define XXH64_hashFromCanonical XXH_NAME2(XXH_NAMESPACE, XXH64_hashFromCanonical) +/* XXH3_64bits */ +# define XXH3_64bits XXH_NAME2(XXH_NAMESPACE, XXH3_64bits) +# define XXH3_64bits_withSecret XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_withSecret) +# define XXH3_64bits_withSeed XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_withSeed) +# define XXH3_createState XXH_NAME2(XXH_NAMESPACE, XXH3_createState) +# define XXH3_freeState XXH_NAME2(XXH_NAMESPACE, XXH3_freeState) +# define XXH3_copyState XXH_NAME2(XXH_NAMESPACE, XXH3_copyState) +# define XXH3_64bits_reset XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_reset) +# define XXH3_64bits_reset_withSeed XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_reset_withSeed) +# define XXH3_64bits_reset_withSecret XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_reset_withSecret) +# define XXH3_64bits_update XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_update) +# define XXH3_64bits_digest XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_digest) +# define XXH3_generateSecret XXH_NAME2(XXH_NAMESPACE, XXH3_generateSecret) +/* XXH3_128bits */ +# define XXH128 XXH_NAME2(XXH_NAMESPACE, XXH128) +# define XXH3_128bits XXH_NAME2(XXH_NAMESPACE, XXH3_128bits) +# define XXH3_128bits_withSeed XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_withSeed) +# define XXH3_128bits_withSecret XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_withSecret) +# define XXH3_128bits_reset XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_reset) +# define XXH3_128bits_reset_withSeed XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_reset_withSeed) +# define XXH3_128bits_reset_withSecret XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_reset_withSecret) +# define XXH3_128bits_update XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_update) +# define XXH3_128bits_digest XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_digest) +# define XXH128_isEqual XXH_NAME2(XXH_NAMESPACE, XXH128_isEqual) +# define XXH128_cmp XXH_NAME2(XXH_NAMESPACE, XXH128_cmp) +# define XXH128_canonicalFromHash XXH_NAME2(XXH_NAMESPACE, XXH128_canonicalFromHash) +# define XXH128_hashFromCanonical XXH_NAME2(XXH_NAMESPACE, XXH128_hashFromCanonical) +#endif + + +/* ************************************* +* Version +***************************************/ +#define XXH_VERSION_MAJOR 0 +#define XXH_VERSION_MINOR 8 +#define XXH_VERSION_RELEASE 0 +#define XXH_VERSION_NUMBER (XXH_VERSION_MAJOR *100*100 + XXH_VERSION_MINOR *100 + XXH_VERSION_RELEASE) +XXH_PUBLIC_API unsigned XXH_versionNumber (void); + + +/* **************************** +* Definitions +******************************/ +#include <stddef.h> /* size_t */ +typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode; + + +/*-********************************************************************** +* 32-bit hash +************************************************************************/ +#if !defined (__VMS) \ + && (defined (__cplusplus) \ + || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) +# include <stdint.h> + typedef uint32_t XXH32_hash_t; +#else +# include <limits.h> +# if UINT_MAX == 0xFFFFFFFFUL + typedef unsigned int XXH32_hash_t; +# else +# if ULONG_MAX == 0xFFFFFFFFUL + typedef unsigned long XXH32_hash_t; +# else +# error "unsupported platform: need a 32-bit type" +# endif +# endif +#endif + +/*! + * XXH32(): + * Calculate the 32-bit hash of sequence "length" bytes stored at memory address "input". + * The memory between input & input+length must be valid (allocated and read-accessible). + * "seed" can be used to alter the result predictably. + * Speed on Core 2 Duo @ 3 GHz (single thread, SMHasher benchmark): 5.4 GB/s + * + * Note: XXH3 provides competitive speed for both 32-bit and 64-bit systems, + * and offers true 64/128 bit hash results. It provides a superior level of + * dispersion, and greatly reduces the risks of collisions. + */ +XXH_PUBLIC_API XXH32_hash_t XXH32 (const void* input, size_t length, XXH32_hash_t seed); + +/******* Streaming *******/ + +/* + * Streaming functions generate the xxHash value from an incrememtal input. + * This method is slower than single-call functions, due to state management. + * For small inputs, prefer `XXH32()` and `XXH64()`, which are better optimized. + * + * An XXH state must first be allocated using `XXH*_createState()`. + * + * Start a new hash by initializing the state with a seed using `XXH*_reset()`. + * + * Then, feed the hash state by calling `XXH*_update()` as many times as necessary. + * + * The function returns an error code, with 0 meaning OK, and any other value + * meaning there is an error. + * + * Finally, a hash value can be produced anytime, by using `XXH*_digest()`. + * This function returns the nn-bits hash as an int or long long. + * + * It's still possible to continue inserting input into the hash state after a + * digest, and generate new hash values later on by invoking `XXH*_digest()`. + * + * When done, release the state using `XXH*_freeState()`. + */ + +typedef struct XXH32_state_s XXH32_state_t; /* incomplete type */ +XXH_PUBLIC_API XXH32_state_t* XXH32_createState(void); +XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr); +XXH_PUBLIC_API void XXH32_copyState(XXH32_state_t* dst_state, const XXH32_state_t* src_state); + +XXH_PUBLIC_API XXH_errorcode XXH32_reset (XXH32_state_t* statePtr, XXH32_hash_t seed); +XXH_PUBLIC_API XXH_errorcode XXH32_update (XXH32_state_t* statePtr, const void* input, size_t length); +XXH_PUBLIC_API XXH32_hash_t XXH32_digest (const XXH32_state_t* statePtr); + +/******* Canonical representation *******/ + +/* + * The default return values from XXH functions are unsigned 32 and 64 bit + * integers. + * This the simplest and fastest format for further post-processing. + * + * However, this leaves open the question of what is the order on the byte level, + * since little and big endian conventions will store the same number differently. + * + * The canonical representation settles this issue by mandating big-endian + * convention, the same convention as human-readable numbers (large digits first). + * + * When writing hash values to storage, sending them over a network, or printing + * them, it's highly recommended to use the canonical representation to ensure + * portability across a wider range of systems, present and future. + * + * The following functions allow transformation of hash values to and from + * canonical format. + */ + +typedef struct { unsigned char digest[4]; } XXH32_canonical_t; +XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash); +XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src); + + +#ifndef XXH_NO_LONG_LONG +/*-********************************************************************** +* 64-bit hash +************************************************************************/ +#if !defined (__VMS) \ + && (defined (__cplusplus) \ + || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) +# include <stdint.h> + typedef uint64_t XXH64_hash_t; +#else + /* the following type must have a width of 64-bit */ + typedef unsigned long long XXH64_hash_t; +#endif + +/*! + * XXH64(): + * Returns the 64-bit hash of sequence of length @length stored at memory + * address @input. + * @seed can be used to alter the result predictably. + * + * This function usually runs faster on 64-bit systems, but slower on 32-bit + * systems (see benchmark). + * + * Note: XXH3 provides competitive speed for both 32-bit and 64-bit systems, + * and offers true 64/128 bit hash results. It provides a superior level of + * dispersion, and greatly reduces the risks of collisions. + */ +XXH_PUBLIC_API XXH64_hash_t XXH64 (const void* input, size_t length, XXH64_hash_t seed); + +/******* Streaming *******/ +typedef struct XXH64_state_s XXH64_state_t; /* incomplete type */ +XXH_PUBLIC_API XXH64_state_t* XXH64_createState(void); +XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr); +XXH_PUBLIC_API void XXH64_copyState(XXH64_state_t* dst_state, const XXH64_state_t* src_state); + +XXH_PUBLIC_API XXH_errorcode XXH64_reset (XXH64_state_t* statePtr, XXH64_hash_t seed); +XXH_PUBLIC_API XXH_errorcode XXH64_update (XXH64_state_t* statePtr, const void* input, size_t length); +XXH_PUBLIC_API XXH64_hash_t XXH64_digest (const XXH64_state_t* statePtr); + +/******* Canonical representation *******/ +typedef struct { unsigned char digest[sizeof(XXH64_hash_t)]; } XXH64_canonical_t; +XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash); +XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src); + + +/*-********************************************************************** +* XXH3 64-bit variant +************************************************************************/ + +/* ************************************************************************ + * XXH3 is a new hash algorithm featuring: + * - Improved speed for both small and large inputs + * - True 64-bit and 128-bit outputs + * - SIMD acceleration + * - Improved 32-bit viability + * + * Speed analysis methodology is explained here: + * + * https://fastcompression.blogspot.com/2019/03/presenting-xxh3.html + * + * In general, expect XXH3 to run about ~2x faster on large inputs and >3x + * faster on small ones compared to XXH64, though exact differences depend on + * the platform. + * + * The algorithm is portable: Like XXH32 and XXH64, it generates the same hash + * on all platforms. + * + * It benefits greatly from SIMD and 64-bit arithmetic, but does not require it. + * + * Almost all 32-bit and 64-bit targets that can run XXH32 smoothly can run + * XXH3 at competitive speeds, even if XXH64 runs slowly. Further details are + * explained in the implementation. + * + * Optimized implementations are provided for AVX512, AVX2, SSE2, NEON, POWER8, + * ZVector and scalar targets. This can be controlled with the XXH_VECTOR macro. + * + * XXH3 offers 2 variants, _64bits and _128bits. + * When only 64 bits are needed, prefer calling the _64bits variant, as it + * reduces the amount of mixing, resulting in faster speed on small inputs. + * + * It's also generally simpler to manipulate a scalar return type than a struct. + * + * The 128-bit version adds additional strength, but it is slightly slower. + * + * The XXH3 algorithm is still in development. + * The results it produces may still change in future versions. + * + * Results produced by v0.7.x are not comparable with results from v0.7.y. + * However, the API is completely stable, and it can safely be used for + * ephemeral data (local sessions). + * + * Avoid storing values in long-term storage until the algorithm is finalized. + * XXH3's return values will be officially finalized upon reaching v0.8.0. + * + * After which, return values of XXH3 and XXH128 will no longer change in + * future versions. + * + * The API supports one-shot hashing, streaming mode, and custom secrets. + */ + +/* XXH3_64bits(): + * default 64-bit variant, using default secret and default seed of 0. + * It's the fastest variant. */ +XXH_PUBLIC_API XXH64_hash_t XXH3_64bits(const void* data, size_t len); + +/* + * XXH3_64bits_withSeed(): + * This variant generates a custom secret on the fly + * based on default secret altered using the `seed` value. + * While this operation is decently fast, note that it's not completely free. + * Note: seed==0 produces the same results as XXH3_64bits(). + */ +XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSeed(const void* data, size_t len, XXH64_hash_t seed); + +/* + * XXH3_64bits_withSecret(): + * It's possible to provide any blob of bytes as a "secret" to generate the hash. + * This makes it more difficult for an external actor to prepare an intentional collision. + * The main condition is that secretSize *must* be large enough (>= XXH3_SECRET_SIZE_MIN). + * However, the quality of produced hash values depends on secret's entropy. + * Technically, the secret must look like a bunch of random bytes. + * Avoid "trivial" or structured data such as repeated sequences or a text document. + * Whenever unsure about the "randomness" of the blob of bytes, + * consider relabelling it as a "custom seed" instead, + * and employ "XXH3_generateSecret()" (see below) + * to generate a high entropy secret derived from the custom seed. + */ +#define XXH3_SECRET_SIZE_MIN 136 +XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSecret(const void* data, size_t len, const void* secret, size_t secretSize); + + +/******* Streaming *******/ +/* + * Streaming requires state maintenance. + * This operation costs memory and CPU. + * As a consequence, streaming is slower than one-shot hashing. + * For better performance, prefer one-shot functions whenever applicable. + */ +typedef struct XXH3_state_s XXH3_state_t; +XXH_PUBLIC_API XXH3_state_t* XXH3_createState(void); +XXH_PUBLIC_API XXH_errorcode XXH3_freeState(XXH3_state_t* statePtr); +XXH_PUBLIC_API void XXH3_copyState(XXH3_state_t* dst_state, const XXH3_state_t* src_state); + +/* + * XXH3_64bits_reset(): + * Initialize with default parameters. + * digest will be equivalent to `XXH3_64bits()`. + */ +XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset(XXH3_state_t* statePtr); +/* + * XXH3_64bits_reset_withSeed(): + * Generate a custom secret from `seed`, and store it into `statePtr`. + * digest will be equivalent to `XXH3_64bits_withSeed()`. + */ +XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed); +/* + * XXH3_64bits_reset_withSecret(): + * `secret` is referenced, it _must outlive_ the hash streaming session. + * Similar to one-shot API, `secretSize` must be >= `XXH3_SECRET_SIZE_MIN`, + * and the quality of produced hash values depends on secret's entropy + * (secret's content should look like a bunch of random bytes). + * When in doubt about the randomness of a candidate `secret`, + * consider employing `XXH3_generateSecret()` instead (see below). + */ +XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t secretSize); + +XXH_PUBLIC_API XXH_errorcode XXH3_64bits_update (XXH3_state_t* statePtr, const void* input, size_t length); +XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_digest (const XXH3_state_t* statePtr); + +/* note : canonical representation of XXH3 is the same as XXH64 + * since they both produce XXH64_hash_t values */ + + +/*-********************************************************************** +* XXH3 128-bit variant +************************************************************************/ + +typedef struct { + XXH64_hash_t low64; + XXH64_hash_t high64; +} XXH128_hash_t; + +XXH_PUBLIC_API XXH128_hash_t XXH3_128bits(const void* data, size_t len); +XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_withSeed(const void* data, size_t len, XXH64_hash_t seed); +XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_withSecret(const void* data, size_t len, const void* secret, size_t secretSize); + +/******* Streaming *******/ +/* + * Streaming requires state maintenance. + * This operation costs memory and CPU. + * As a consequence, streaming is slower than one-shot hashing. + * For better performance, prefer one-shot functions whenever applicable. + * + * XXH3_128bits uses the same XXH3_state_t as XXH3_64bits(). + * Use already declared XXH3_createState() and XXH3_freeState(). + * + * All reset and streaming functions have same meaning as their 64-bit counterpart. + */ + +XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset(XXH3_state_t* statePtr); +XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed); +XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t secretSize); + +XXH_PUBLIC_API XXH_errorcode XXH3_128bits_update (XXH3_state_t* statePtr, const void* input, size_t length); +XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_digest (const XXH3_state_t* statePtr); + +/* Following helper functions make it possible to compare XXH128_hast_t values. + * Since XXH128_hash_t is a structure, this capability is not offered by the language. + * Note: For better performance, these functions can be inlined using XXH_INLINE_ALL */ + +/*! + * XXH128_isEqual(): + * Return: 1 if `h1` and `h2` are equal, 0 if they are not. + */ +XXH_PUBLIC_API int XXH128_isEqual(XXH128_hash_t h1, XXH128_hash_t h2); + +/*! + * XXH128_cmp(): + * + * This comparator is compatible with stdlib's `qsort()`/`bsearch()`. + * + * return: >0 if *h128_1 > *h128_2 + * =0 if *h128_1 == *h128_2 + * <0 if *h128_1 < *h128_2 + */ +XXH_PUBLIC_API int XXH128_cmp(const void* h128_1, const void* h128_2); + + +/******* Canonical representation *******/ +typedef struct { unsigned char digest[sizeof(XXH128_hash_t)]; } XXH128_canonical_t; +XXH_PUBLIC_API void XXH128_canonicalFromHash(XXH128_canonical_t* dst, XXH128_hash_t hash); +XXH_PUBLIC_API XXH128_hash_t XXH128_hashFromCanonical(const XXH128_canonical_t* src); + + +#endif /* XXH_NO_LONG_LONG */ + +#endif /* XXHASH_H_5627135585666179 */ + + + +#if defined(XXH_STATIC_LINKING_ONLY) && !defined(XXHASH_H_STATIC_13879238742) +#define XXHASH_H_STATIC_13879238742 +/* **************************************************************************** + * This section contains declarations which are not guaranteed to remain stable. + * They may change in future versions, becoming incompatible with a different + * version of the library. + * These declarations should only be used with static linking. + * Never use them in association with dynamic linking! + ***************************************************************************** */ + +/* + * These definitions are only present to allow static allocation + * of XXH states, on stack or in a struct, for example. + * Never **ever** access their members directly. + */ + +struct XXH32_state_s { + XXH32_hash_t total_len_32; + XXH32_hash_t large_len; + XXH32_hash_t v1; + XXH32_hash_t v2; + XXH32_hash_t v3; + XXH32_hash_t v4; + XXH32_hash_t mem32[4]; + XXH32_hash_t memsize; + XXH32_hash_t reserved; /* never read nor write, might be removed in a future version */ +}; /* typedef'd to XXH32_state_t */ + + +#ifndef XXH_NO_LONG_LONG /* defined when there is no 64-bit support */ + +struct XXH64_state_s { + XXH64_hash_t total_len; + XXH64_hash_t v1; + XXH64_hash_t v2; + XXH64_hash_t v3; + XXH64_hash_t v4; + XXH64_hash_t mem64[4]; + XXH32_hash_t memsize; + XXH32_hash_t reserved32; /* required for padding anyway */ + XXH64_hash_t reserved64; /* never read nor write, might be removed in a future version */ +}; /* typedef'd to XXH64_state_t */ + +#if defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11+ */ +# include <stdalign.h> +# define XXH_ALIGN(n) alignas(n) +#elif defined(__GNUC__) +# define XXH_ALIGN(n) __attribute__ ((aligned(n))) +#elif defined(_MSC_VER) +# define XXH_ALIGN(n) __declspec(align(n)) +#else +# define XXH_ALIGN(n) /* disabled */ +#endif + +/* Old GCC versions only accept the attribute after the type in structures. */ +#if !(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) /* C11+ */ \ + && defined(__GNUC__) +# define XXH_ALIGN_MEMBER(align, type) type XXH_ALIGN(align) +#else +# define XXH_ALIGN_MEMBER(align, type) XXH_ALIGN(align) type +#endif + +#define XXH3_INTERNALBUFFER_SIZE 256 +#define XXH3_SECRET_DEFAULT_SIZE 192 +struct XXH3_state_s { + XXH_ALIGN_MEMBER(64, XXH64_hash_t acc[8]); + /* used to store a custom secret generated from a seed */ + XXH_ALIGN_MEMBER(64, unsigned char customSecret[XXH3_SECRET_DEFAULT_SIZE]); + XXH_ALIGN_MEMBER(64, unsigned char buffer[XXH3_INTERNALBUFFER_SIZE]); + XXH32_hash_t bufferedSize; + XXH32_hash_t reserved32; + size_t nbStripesSoFar; + XXH64_hash_t totalLen; + size_t nbStripesPerBlock; + size_t secretLimit; + XXH64_hash_t seed; + XXH64_hash_t reserved64; + const unsigned char* extSecret; /* reference to external secret; + * if == NULL, use .customSecret instead */ + /* note: there may be some padding at the end due to alignment on 64 bytes */ +}; /* typedef'd to XXH3_state_t */ + +#undef XXH_ALIGN_MEMBER + +/* When the XXH3_state_t structure is merely emplaced on stack, + * it should be initialized with XXH3_INITSTATE() or a memset() + * in case its first reset uses XXH3_NNbits_reset_withSeed(). + * This init can be omitted if the first reset uses default or _withSecret mode. + * This operation isn't necessary when the state is created with XXH3_createState(). + * Note that this doesn't prepare the state for a streaming operation, + * it's still necessary to use XXH3_NNbits_reset*() afterwards. + */ +#define XXH3_INITSTATE(XXH3_state_ptr) { (XXH3_state_ptr)->seed = 0; } + + +/* === Experimental API === */ +/* Symbols defined below must be considered tied to a specific library version. */ + +/* + * XXH3_generateSecret(): + * + * Derive a high-entropy secret from any user-defined content, named customSeed. + * The generated secret can be used in combination with `*_withSecret()` functions. + * The `_withSecret()` variants are useful to provide a higher level of protection than 64-bit seed, + * as it becomes much more difficult for an external actor to guess how to impact the calculation logic. + * + * The function accepts as input a custom seed of any length and any content, + * and derives from it a high-entropy secret of length XXH3_SECRET_DEFAULT_SIZE + * into an already allocated buffer secretBuffer. + * The generated secret is _always_ XXH_SECRET_DEFAULT_SIZE bytes long. + * + * The generated secret can then be used with any `*_withSecret()` variant. + * Functions `XXH3_128bits_withSecret()`, `XXH3_64bits_withSecret()`, + * `XXH3_128bits_reset_withSecret()` and `XXH3_64bits_reset_withSecret()` + * are part of this list. They all accept a `secret` parameter + * which must be very long for implementation reasons (>= XXH3_SECRET_SIZE_MIN) + * _and_ feature very high entropy (consist of random-looking bytes). + * These conditions can be a high bar to meet, so + * this function can be used to generate a secret of proper quality. + * + * customSeed can be anything. It can have any size, even small ones, + * and its content can be anything, even stupidly "low entropy" source such as a bunch of zeroes. + * The resulting `secret` will nonetheless provide all expected qualities. + * + * Supplying NULL as the customSeed copies the default secret into `secretBuffer`. + * When customSeedSize > 0, supplying NULL as customSeed is undefined behavior. + */ +XXH_PUBLIC_API void XXH3_generateSecret(void* secretBuffer, const void* customSeed, size_t customSeedSize); + + +/* simple short-cut to pre-selected XXH3_128bits variant */ +XXH_PUBLIC_API XXH128_hash_t XXH128(const void* data, size_t len, XXH64_hash_t seed); + + +#endif /* XXH_NO_LONG_LONG */ + + +#if defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API) +# define XXH_IMPLEMENTATION +#endif + +#endif /* defined(XXH_STATIC_LINKING_ONLY) && !defined(XXHASH_H_STATIC_13879238742) */ + + +/* ======================================================================== */ +/* ======================================================================== */ +/* ======================================================================== */ + + +/*-********************************************************************** + * xxHash implementation + *-********************************************************************** + * xxHash's implementation used to be hosted inside xxhash.c. + * + * However, inlining requires implementation to be visible to the compiler, + * hence be included alongside the header. + * Previously, implementation was hosted inside xxhash.c, + * which was then #included when inlining was activated. + * This construction created issues with a few build and install systems, + * as it required xxhash.c to be stored in /include directory. + * + * xxHash implementation is now directly integrated within xxhash.h. + * As a consequence, xxhash.c is no longer needed in /include. + * + * xxhash.c is still available and is still useful. + * In a "normal" setup, when xxhash is not inlined, + * xxhash.h only exposes the prototypes and public symbols, + * while xxhash.c can be built into an object file xxhash.o + * which can then be linked into the final binary. + ************************************************************************/ + +#if ( defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API) \ + || defined(XXH_IMPLEMENTATION) ) && !defined(XXH_IMPLEM_13a8737387) +# define XXH_IMPLEM_13a8737387 + +/* ************************************* +* Tuning parameters +***************************************/ +/*! + * XXH_FORCE_MEMORY_ACCESS: + * By default, access to unaligned memory is controlled by `memcpy()`, which is + * safe and portable. + * + * Unfortunately, on some target/compiler combinations, the generated assembly + * is sub-optimal. + * + * The below switch allow selection of a different access method + * in the search for improved performance. + * Method 0 (default): + * Use `memcpy()`. Safe and portable. Default. + * Method 1: + * `__attribute__((packed))` statement. It depends on compiler extensions + * and is therefore not portable. + * This method is safe if your compiler supports it, and *generally* as + * fast or faster than `memcpy`. + * Method 2: + * Direct access via cast. This method doesn't depend on the compiler but + * violates the C standard. + * It can generate buggy code on targets which do not support unaligned + * memory accesses. + * But in some circumstances, it's the only known way to get the most + * performance (example: GCC + ARMv6) + * Method 3: + * Byteshift. This can generate the best code on old compilers which don't + * inline small `memcpy()` calls, and it might also be faster on big-endian + * systems which lack a native byteswap instruction. + * See https://stackoverflow.com/a/32095106/646947 for details. + * Prefer these methods in priority order (0 > 1 > 2 > 3) + */ +#ifndef XXH_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */ +# if !defined(__clang__) && defined(__GNUC__) && defined(__ARM_FEATURE_UNALIGNED) && defined(__ARM_ARCH) && (__ARM_ARCH == 6) +# define XXH_FORCE_MEMORY_ACCESS 2 +# elif !defined(__clang__) && ((defined(__INTEL_COMPILER) && !defined(_WIN32)) || \ + (defined(__GNUC__) && (defined(__ARM_ARCH) && __ARM_ARCH >= 7))) +# define XXH_FORCE_MEMORY_ACCESS 1 +# endif +#endif + +/*! + * XXH_ACCEPT_NULL_INPUT_POINTER: + * If the input pointer is NULL, xxHash's default behavior is to dereference it, + * triggering a segfault. + * When this macro is enabled, xxHash actively checks the input for a null pointer. + * If it is, the result for null input pointers is the same as a zero-length input. + */ +#ifndef XXH_ACCEPT_NULL_INPUT_POINTER /* can be defined externally */ +# define XXH_ACCEPT_NULL_INPUT_POINTER 0 +#endif + +/*! + * XXH_FORCE_ALIGN_CHECK: + * This is an important performance trick + * for architectures without decent unaligned memory access performance. + * It checks for input alignment, and when conditions are met, + * uses a "fast path" employing direct 32-bit/64-bit read, + * resulting in _dramatically faster_ read speed. + * + * The check costs one initial branch per hash, which is generally negligible, but not zero. + * Moreover, it's not useful to generate binary for an additional code path + * if memory access uses same instruction for both aligned and unaligned adresses. + * + * In these cases, the alignment check can be removed by setting this macro to 0. + * Then the code will always use unaligned memory access. + * Align check is automatically disabled on x86, x64 & arm64, + * which are platforms known to offer good unaligned memory accesses performance. + * + * This option does not affect XXH3 (only XXH32 and XXH64). + */ +#ifndef XXH_FORCE_ALIGN_CHECK /* can be defined externally */ +# if defined(__i386) || defined(__x86_64__) || defined(__aarch64__) \ + || defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM64) /* visual */ +# define XXH_FORCE_ALIGN_CHECK 0 +# else +# define XXH_FORCE_ALIGN_CHECK 1 +# endif +#endif + +/*! + * XXH_NO_INLINE_HINTS: + * + * By default, xxHash tries to force the compiler to inline almost all internal + * functions. + * + * This can usually improve performance due to reduced jumping and improved + * constant folding, but significantly increases the size of the binary which + * might not be favorable. + * + * Additionally, sometimes the forced inlining can be detrimental to performance, + * depending on the architecture. + * + * XXH_NO_INLINE_HINTS marks all internal functions as static, giving the + * compiler full control on whether to inline or not. + * + * When not optimizing (-O0), optimizing for size (-Os, -Oz), or using + * -fno-inline with GCC or Clang, this will automatically be defined. + */ +#ifndef XXH_NO_INLINE_HINTS +# if defined(__OPTIMIZE_SIZE__) /* -Os, -Oz */ \ + || defined(__NO_INLINE__) /* -O0, -fno-inline */ +# define XXH_NO_INLINE_HINTS 1 +# else +# define XXH_NO_INLINE_HINTS 0 +# endif +#endif + +/*! + * XXH_REROLL: + * Whether to reroll XXH32_finalize, and XXH64_finalize, + * instead of using an unrolled jump table/if statement loop. + * + * This is automatically defined on -Os/-Oz on GCC and Clang. + */ +#ifndef XXH_REROLL +# if defined(__OPTIMIZE_SIZE__) +# define XXH_REROLL 1 +# else +# define XXH_REROLL 0 +# endif +#endif + + +/* ************************************* +* Includes & Memory related functions +***************************************/ +/*! + * Modify the local functions below should you wish to use + * different memory routines for malloc() and free() + */ +#include <stdlib.h> + +static void* XXH_malloc(size_t s) { return malloc(s); } +static void XXH_free(void* p) { free(p); } + +/*! and for memcpy() */ +#include <string.h> +static void* XXH_memcpy(void* dest, const void* src, size_t size) +{ + return memcpy(dest,src,size); +} + +#include <limits.h> /* ULLONG_MAX */ + + +/* ************************************* +* Compiler Specific Options +***************************************/ +#ifdef _MSC_VER /* Visual Studio warning fix */ +# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ +#endif + +#if XXH_NO_INLINE_HINTS /* disable inlining hints */ +# if defined(__GNUC__) +# define XXH_FORCE_INLINE static __attribute__((unused)) +# else +# define XXH_FORCE_INLINE static +# endif +# define XXH_NO_INLINE static +/* enable inlining hints */ +#elif defined(_MSC_VER) /* Visual Studio */ +# define XXH_FORCE_INLINE static __forceinline +# define XXH_NO_INLINE static __declspec(noinline) +#elif defined(__GNUC__) +# define XXH_FORCE_INLINE static __inline__ __attribute__((always_inline, unused)) +# define XXH_NO_INLINE static __attribute__((noinline)) +#elif defined (__cplusplus) \ + || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) /* C99 */ +# define XXH_FORCE_INLINE static inline +# define XXH_NO_INLINE static +#else +# define XXH_FORCE_INLINE static +# define XXH_NO_INLINE static +#endif + + + +/* ************************************* +* Debug +***************************************/ +/* + * XXH_DEBUGLEVEL is expected to be defined externally, typically via the + * compiler's command line options. The value must be a number. + */ +#ifndef XXH_DEBUGLEVEL +# ifdef DEBUGLEVEL /* backwards compat */ +# define XXH_DEBUGLEVEL DEBUGLEVEL +# else +# define XXH_DEBUGLEVEL 0 +# endif +#endif + +#if (XXH_DEBUGLEVEL>=1) +# include <assert.h> /* note: can still be disabled with NDEBUG */ +# define XXH_ASSERT(c) assert(c) +#else +# define XXH_ASSERT(c) ((void)0) +#endif + +/* note: use after variable declarations */ +#define XXH_STATIC_ASSERT(c) do { enum { XXH_sa = 1/(int)(!!(c)) }; } while (0) + + +/* ************************************* +* Basic Types +***************************************/ +#if !defined (__VMS) \ + && (defined (__cplusplus) \ + || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) +# include <stdint.h> + typedef uint8_t xxh_u8; +#else + typedef unsigned char xxh_u8; +#endif +typedef XXH32_hash_t xxh_u32; + +#ifdef XXH_OLD_NAMES +# define BYTE xxh_u8 +# define U8 xxh_u8 +# define U32 xxh_u32 +#endif + +/* *** Memory access *** */ + +#if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==3)) +/* + * Manual byteshift. Best for old compilers which don't inline memcpy. + * We actually directly use XXH_readLE32 and XXH_readBE32. + */ +#elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==2)) + +/* + * Force direct memory access. Only works on CPU which support unaligned memory + * access in hardware. + */ +static xxh_u32 XXH_read32(const void* memPtr) { return *(const xxh_u32*) memPtr; } + +#elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==1)) + +/* + * __pack instructions are safer but compiler specific, hence potentially + * problematic for some compilers. + * + * Currently only defined for GCC and ICC. + */ +#ifdef XXH_OLD_NAMES +typedef union { xxh_u32 u32; } __attribute__((packed)) unalign; +#endif +static xxh_u32 XXH_read32(const void* ptr) +{ + typedef union { xxh_u32 u32; } __attribute__((packed)) xxh_unalign; + return ((const xxh_unalign*)ptr)->u32; +} + +#else + +/* + * Portable and safe solution. Generally efficient. + * see: https://stackoverflow.com/a/32095106/646947 + */ +static xxh_u32 XXH_read32(const void* memPtr) +{ + xxh_u32 val; + memcpy(&val, memPtr, sizeof(val)); + return val; +} + +#endif /* XXH_FORCE_DIRECT_MEMORY_ACCESS */ + + +/* *** Endianess *** */ +typedef enum { XXH_bigEndian=0, XXH_littleEndian=1 } XXH_endianess; + +/*! + * XXH_CPU_LITTLE_ENDIAN: + * Defined to 1 if the target is little endian, or 0 if it is big endian. + * It can be defined externally, for example on the compiler command line. + * + * If it is not defined, a runtime check (which is usually constant folded) + * is used instead. + */ +#ifndef XXH_CPU_LITTLE_ENDIAN +/* + * Try to detect endianness automatically, to avoid the nonstandard behavior + * in `XXH_isLittleEndian()` + */ +# if defined(_WIN32) /* Windows is always little endian */ \ + || defined(__LITTLE_ENDIAN__) \ + || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) +# define XXH_CPU_LITTLE_ENDIAN 1 +# elif defined(__BIG_ENDIAN__) \ + || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) +# define XXH_CPU_LITTLE_ENDIAN 0 +# else +/* + * runtime test, presumed to simplify to a constant by compiler + */ +static int XXH_isLittleEndian(void) +{ + /* + * Portable and well-defined behavior. + * Don't use static: it is detrimental to performance. + */ + const union { xxh_u32 u; xxh_u8 c[4]; } one = { 1 }; + return one.c[0]; +} +# define XXH_CPU_LITTLE_ENDIAN XXH_isLittleEndian() +# endif +#endif + + + + +/* **************************************** +* Compiler-specific Functions and Macros +******************************************/ +#define XXH_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) + +#ifdef __has_builtin +# define XXH_HAS_BUILTIN(x) __has_builtin(x) +#else +# define XXH_HAS_BUILTIN(x) 0 +#endif + +#if !defined(NO_CLANG_BUILTIN) && XXH_HAS_BUILTIN(__builtin_rotateleft32) \ + && XXH_HAS_BUILTIN(__builtin_rotateleft64) +# define XXH_rotl32 __builtin_rotateleft32 +# define XXH_rotl64 __builtin_rotateleft64 +/* Note: although _rotl exists for minGW (GCC under windows), performance seems poor */ +#elif defined(_MSC_VER) +# define XXH_rotl32(x,r) _rotl(x,r) +# define XXH_rotl64(x,r) _rotl64(x,r) +#else +# define XXH_rotl32(x,r) (((x) << (r)) | ((x) >> (32 - (r)))) +# define XXH_rotl64(x,r) (((x) << (r)) | ((x) >> (64 - (r)))) +#endif + +#if defined(_MSC_VER) /* Visual Studio */ +# define XXH_swap32 _byteswap_ulong +#elif XXH_GCC_VERSION >= 403 +# define XXH_swap32 __builtin_bswap32 +#else +static xxh_u32 XXH_swap32 (xxh_u32 x) +{ + return ((x << 24) & 0xff000000 ) | + ((x << 8) & 0x00ff0000 ) | + ((x >> 8) & 0x0000ff00 ) | + ((x >> 24) & 0x000000ff ); +} +#endif + + +/* *************************** +* Memory reads +*****************************/ +typedef enum { XXH_aligned, XXH_unaligned } XXH_alignment; + +/* + * XXH_FORCE_MEMORY_ACCESS==3 is an endian-independent byteshift load. + * + * This is ideal for older compilers which don't inline memcpy. + */ +#if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==3)) + +XXH_FORCE_INLINE xxh_u32 XXH_readLE32(const void* memPtr) +{ + const xxh_u8* bytePtr = (const xxh_u8 *)memPtr; + return bytePtr[0] + | ((xxh_u32)bytePtr[1] << 8) + | ((xxh_u32)bytePtr[2] << 16) + | ((xxh_u32)bytePtr[3] << 24); +} + +XXH_FORCE_INLINE xxh_u32 XXH_readBE32(const void* memPtr) +{ + const xxh_u8* bytePtr = (const xxh_u8 *)memPtr; + return bytePtr[3] + | ((xxh_u32)bytePtr[2] << 8) + | ((xxh_u32)bytePtr[1] << 16) + | ((xxh_u32)bytePtr[0] << 24); +} + +#else +XXH_FORCE_INLINE xxh_u32 XXH_readLE32(const void* ptr) +{ + return XXH_CPU_LITTLE_ENDIAN ? XXH_read32(ptr) : XXH_swap32(XXH_read32(ptr)); +} + +static xxh_u32 XXH_readBE32(const void* ptr) +{ + return XXH_CPU_LITTLE_ENDIAN ? XXH_swap32(XXH_read32(ptr)) : XXH_read32(ptr); +} +#endif + +XXH_FORCE_INLINE xxh_u32 +XXH_readLE32_align(const void* ptr, XXH_alignment align) +{ + if (align==XXH_unaligned) { + return XXH_readLE32(ptr); + } else { + return XXH_CPU_LITTLE_ENDIAN ? *(const xxh_u32*)ptr : XXH_swap32(*(const xxh_u32*)ptr); + } +} + + +/* ************************************* +* Misc +***************************************/ +XXH_PUBLIC_API unsigned XXH_versionNumber (void) { return XXH_VERSION_NUMBER; } + + +/* ******************************************************************* +* 32-bit hash functions +*********************************************************************/ +static const xxh_u32 XXH_PRIME32_1 = 0x9E3779B1U; /* 0b10011110001101110111100110110001 */ +static const xxh_u32 XXH_PRIME32_2 = 0x85EBCA77U; /* 0b10000101111010111100101001110111 */ +static const xxh_u32 XXH_PRIME32_3 = 0xC2B2AE3DU; /* 0b11000010101100101010111000111101 */ +static const xxh_u32 XXH_PRIME32_4 = 0x27D4EB2FU; /* 0b00100111110101001110101100101111 */ +static const xxh_u32 XXH_PRIME32_5 = 0x165667B1U; /* 0b00010110010101100110011110110001 */ + +#ifdef XXH_OLD_NAMES +# define PRIME32_1 XXH_PRIME32_1 +# define PRIME32_2 XXH_PRIME32_2 +# define PRIME32_3 XXH_PRIME32_3 +# define PRIME32_4 XXH_PRIME32_4 +# define PRIME32_5 XXH_PRIME32_5 +#endif + +static xxh_u32 XXH32_round(xxh_u32 acc, xxh_u32 input) +{ + acc += input * XXH_PRIME32_2; + acc = XXH_rotl32(acc, 13); + acc *= XXH_PRIME32_1; +#if defined(__GNUC__) && defined(__SSE4_1__) && !defined(XXH_ENABLE_AUTOVECTORIZE) + /* + * UGLY HACK: + * This inline assembly hack forces acc into a normal register. This is the + * only thing that prevents GCC and Clang from autovectorizing the XXH32 + * loop (pragmas and attributes don't work for some resason) without globally + * disabling SSE4.1. + * + * The reason we want to avoid vectorization is because despite working on + * 4 integers at a time, there are multiple factors slowing XXH32 down on + * SSE4: + * - There's a ridiculous amount of lag from pmulld (10 cycles of latency on + * newer chips!) making it slightly slower to multiply four integers at + * once compared to four integers independently. Even when pmulld was + * fastest, Sandy/Ivy Bridge, it is still not worth it to go into SSE + * just to multiply unless doing a long operation. + * + * - Four instructions are required to rotate, + * movqda tmp, v // not required with VEX encoding + * pslld tmp, 13 // tmp <<= 13 + * psrld v, 19 // x >>= 19 + * por v, tmp // x |= tmp + * compared to one for scalar: + * roll v, 13 // reliably fast across the board + * shldl v, v, 13 // Sandy Bridge and later prefer this for some reason + * + * - Instruction level parallelism is actually more beneficial here because + * the SIMD actually serializes this operation: While v1 is rotating, v2 + * can load data, while v3 can multiply. SSE forces them to operate + * together. + * + * How this hack works: + * __asm__("" // Declare an assembly block but don't declare any instructions + * : // However, as an Input/Output Operand, + * "+r" // constrain a read/write operand (+) as a general purpose register (r). + * (acc) // and set acc as the operand + * ); + * + * Because of the 'r', the compiler has promised that seed will be in a + * general purpose register and the '+' says that it will be 'read/write', + * so it has to assume it has changed. It is like volatile without all the + * loads and stores. + * + * Since the argument has to be in a normal register (not an SSE register), + * each time XXH32_round is called, it is impossible to vectorize. + */ + __asm__("" : "+r" (acc)); +#endif + return acc; +} + +/* mix all bits */ +static xxh_u32 XXH32_avalanche(xxh_u32 h32) +{ + h32 ^= h32 >> 15; + h32 *= XXH_PRIME32_2; + h32 ^= h32 >> 13; + h32 *= XXH_PRIME32_3; + h32 ^= h32 >> 16; + return(h32); +} + +#define XXH_get32bits(p) XXH_readLE32_align(p, align) + +static xxh_u32 +XXH32_finalize(xxh_u32 h32, const xxh_u8* ptr, size_t len, XXH_alignment align) +{ +#define XXH_PROCESS1 do { \ + h32 += (*ptr++) * XXH_PRIME32_5; \ + h32 = XXH_rotl32(h32, 11) * XXH_PRIME32_1; \ +} while (0) + +#define XXH_PROCESS4 do { \ + h32 += XXH_get32bits(ptr) * XXH_PRIME32_3; \ + ptr += 4; \ + h32 = XXH_rotl32(h32, 17) * XXH_PRIME32_4; \ +} while (0) + + /* Compact rerolled version */ + if (XXH_REROLL) { + len &= 15; + while (len >= 4) { + XXH_PROCESS4; + len -= 4; + } + while (len > 0) { + XXH_PROCESS1; + --len; + } + return XXH32_avalanche(h32); + } else { + switch(len&15) /* or switch(bEnd - p) */ { + case 12: XXH_PROCESS4; + /* fallthrough */ + case 8: XXH_PROCESS4; + /* fallthrough */ + case 4: XXH_PROCESS4; + return XXH32_avalanche(h32); + + case 13: XXH_PROCESS4; + /* fallthrough */ + case 9: XXH_PROCESS4; + /* fallthrough */ + case 5: XXH_PROCESS4; + XXH_PROCESS1; + return XXH32_avalanche(h32); + + case 14: XXH_PROCESS4; + /* fallthrough */ + case 10: XXH_PROCESS4; + /* fallthrough */ + case 6: XXH_PROCESS4; + XXH_PROCESS1; + XXH_PROCESS1; + return XXH32_avalanche(h32); + + case 15: XXH_PROCESS4; + /* fallthrough */ + case 11: XXH_PROCESS4; + /* fallthrough */ + case 7: XXH_PROCESS4; + /* fallthrough */ + case 3: XXH_PROCESS1; + /* fallthrough */ + case 2: XXH_PROCESS1; + /* fallthrough */ + case 1: XXH_PROCESS1; + /* fallthrough */ + case 0: return XXH32_avalanche(h32); + } + XXH_ASSERT(0); + return h32; /* reaching this point is deemed impossible */ + } +} + +#ifdef XXH_OLD_NAMES +# define PROCESS1 XXH_PROCESS1 +# define PROCESS4 XXH_PROCESS4 +#else +# undef XXH_PROCESS1 +# undef XXH_PROCESS4 +#endif + +XXH_FORCE_INLINE xxh_u32 +XXH32_endian_align(const xxh_u8* input, size_t len, xxh_u32 seed, XXH_alignment align) +{ + const xxh_u8* bEnd = input + len; + xxh_u32 h32; + +#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) && (XXH_ACCEPT_NULL_INPUT_POINTER>=1) + if (input==NULL) { + len=0; + bEnd=input=(const xxh_u8*)(size_t)16; + } +#endif + + if (len>=16) { + const xxh_u8* const limit = bEnd - 15; + xxh_u32 v1 = seed + XXH_PRIME32_1 + XXH_PRIME32_2; + xxh_u32 v2 = seed + XXH_PRIME32_2; + xxh_u32 v3 = seed + 0; + xxh_u32 v4 = seed - XXH_PRIME32_1; + + do { + v1 = XXH32_round(v1, XXH_get32bits(input)); input += 4; + v2 = XXH32_round(v2, XXH_get32bits(input)); input += 4; + v3 = XXH32_round(v3, XXH_get32bits(input)); input += 4; + v4 = XXH32_round(v4, XXH_get32bits(input)); input += 4; + } while (input < limit); + + h32 = XXH_rotl32(v1, 1) + XXH_rotl32(v2, 7) + + XXH_rotl32(v3, 12) + XXH_rotl32(v4, 18); + } else { + h32 = seed + XXH_PRIME32_5; + } + + h32 += (xxh_u32)len; + + return XXH32_finalize(h32, input, len&15, align); +} + + +XXH_PUBLIC_API XXH32_hash_t XXH32 (const void* input, size_t len, XXH32_hash_t seed) +{ +#if 0 + /* Simple version, good for code maintenance, but unfortunately slow for small inputs */ + XXH32_state_t state; + XXH32_reset(&state, seed); + XXH32_update(&state, (const xxh_u8*)input, len); + return XXH32_digest(&state); + +#else + + if (XXH_FORCE_ALIGN_CHECK) { + if ((((size_t)input) & 3) == 0) { /* Input is 4-bytes aligned, leverage the speed benefit */ + return XXH32_endian_align((const xxh_u8*)input, len, seed, XXH_aligned); + } } + + return XXH32_endian_align((const xxh_u8*)input, len, seed, XXH_unaligned); +#endif +} + + + +/******* Hash streaming *******/ + +XXH_PUBLIC_API XXH32_state_t* XXH32_createState(void) +{ + return (XXH32_state_t*)XXH_malloc(sizeof(XXH32_state_t)); +} +XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr) +{ + XXH_free(statePtr); + return XXH_OK; +} + +XXH_PUBLIC_API void XXH32_copyState(XXH32_state_t* dstState, const XXH32_state_t* srcState) +{ + memcpy(dstState, srcState, sizeof(*dstState)); +} + +XXH_PUBLIC_API XXH_errorcode XXH32_reset(XXH32_state_t* statePtr, XXH32_hash_t seed) +{ + XXH32_state_t state; /* using a local state to memcpy() in order to avoid strict-aliasing warnings */ + memset(&state, 0, sizeof(state)); + state.v1 = seed + XXH_PRIME32_1 + XXH_PRIME32_2; + state.v2 = seed + XXH_PRIME32_2; + state.v3 = seed + 0; + state.v4 = seed - XXH_PRIME32_1; + /* do not write into reserved, planned to be removed in a future version */ + memcpy(statePtr, &state, sizeof(state) - sizeof(state.reserved)); + return XXH_OK; +} + + +XXH_PUBLIC_API XXH_errorcode +XXH32_update(XXH32_state_t* state, const void* input, size_t len) +{ + if (input==NULL) +#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) && (XXH_ACCEPT_NULL_INPUT_POINTER>=1) + return XXH_OK; +#else + return XXH_ERROR; +#endif + + { const xxh_u8* p = (const xxh_u8*)input; + const xxh_u8* const bEnd = p + len; + + state->total_len_32 += (XXH32_hash_t)len; + state->large_len |= (XXH32_hash_t)((len>=16) | (state->total_len_32>=16)); + + if (state->memsize + len < 16) { /* fill in tmp buffer */ + XXH_memcpy((xxh_u8*)(state->mem32) + state->memsize, input, len); + state->memsize += (XXH32_hash_t)len; + return XXH_OK; + } + + if (state->memsize) { /* some data left from previous update */ + XXH_memcpy((xxh_u8*)(state->mem32) + state->memsize, input, 16-state->memsize); + { const xxh_u32* p32 = state->mem32; + state->v1 = XXH32_round(state->v1, XXH_readLE32(p32)); p32++; + state->v2 = XXH32_round(state->v2, XXH_readLE32(p32)); p32++; + state->v3 = XXH32_round(state->v3, XXH_readLE32(p32)); p32++; + state->v4 = XXH32_round(state->v4, XXH_readLE32(p32)); + } + p += 16-state->memsize; + state->memsize = 0; + } + + if (p <= bEnd-16) { + const xxh_u8* const limit = bEnd - 16; + xxh_u32 v1 = state->v1; + xxh_u32 v2 = state->v2; + xxh_u32 v3 = state->v3; + xxh_u32 v4 = state->v4; + + do { + v1 = XXH32_round(v1, XXH_readLE32(p)); p+=4; + v2 = XXH32_round(v2, XXH_readLE32(p)); p+=4; + v3 = XXH32_round(v3, XXH_readLE32(p)); p+=4; + v4 = XXH32_round(v4, XXH_readLE32(p)); p+=4; + } while (p<=limit); + + state->v1 = v1; + state->v2 = v2; + state->v3 = v3; + state->v4 = v4; + } + + if (p < bEnd) { + XXH_memcpy(state->mem32, p, (size_t)(bEnd-p)); + state->memsize = (unsigned)(bEnd-p); + } + } + + return XXH_OK; +} + + +XXH_PUBLIC_API XXH32_hash_t XXH32_digest (const XXH32_state_t* state) +{ + xxh_u32 h32; + + if (state->large_len) { + h32 = XXH_rotl32(state->v1, 1) + + XXH_rotl32(state->v2, 7) + + XXH_rotl32(state->v3, 12) + + XXH_rotl32(state->v4, 18); + } else { + h32 = state->v3 /* == seed */ + XXH_PRIME32_5; + } + + h32 += state->total_len_32; + + return XXH32_finalize(h32, (const xxh_u8*)state->mem32, state->memsize, XXH_aligned); +} + + +/******* Canonical representation *******/ + +/* + * The default return values from XXH functions are unsigned 32 and 64 bit + * integers. + * + * The canonical representation uses big endian convention, the same convention + * as human-readable numbers (large digits first). + * + * This way, hash values can be written into a file or buffer, remaining + * comparable across different systems. + * + * The following functions allow transformation of hash values to and from their + * canonical format. + */ +XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash) +{ + XXH_STATIC_ASSERT(sizeof(XXH32_canonical_t) == sizeof(XXH32_hash_t)); + if (XXH_CPU_LITTLE_ENDIAN) hash = XXH_swap32(hash); + memcpy(dst, &hash, sizeof(*dst)); +} + +XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src) +{ + return XXH_readBE32(src); +} + + +#ifndef XXH_NO_LONG_LONG + +/* ******************************************************************* +* 64-bit hash functions +*********************************************************************/ + +/******* Memory access *******/ + +typedef XXH64_hash_t xxh_u64; + +#ifdef XXH_OLD_NAMES +# define U64 xxh_u64 +#endif + +/*! + * XXH_REROLL_XXH64: + * Whether to reroll the XXH64_finalize() loop. + * + * Just like XXH32, we can unroll the XXH64_finalize() loop. This can be a + * performance gain on 64-bit hosts, as only one jump is required. + * + * However, on 32-bit hosts, because arithmetic needs to be done with two 32-bit + * registers, and 64-bit arithmetic needs to be simulated, it isn't beneficial + * to unroll. The code becomes ridiculously large (the largest function in the + * binary on i386!), and rerolling it saves anywhere from 3kB to 20kB. It is + * also slightly faster because it fits into cache better and is more likely + * to be inlined by the compiler. + * + * If XXH_REROLL is defined, this is ignored and the loop is always rerolled. + */ +#ifndef XXH_REROLL_XXH64 +# if (defined(__ILP32__) || defined(_ILP32)) /* ILP32 is often defined on 32-bit GCC family */ \ + || !(defined(__x86_64__) || defined(_M_X64) || defined(_M_AMD64) /* x86-64 */ \ + || defined(_M_ARM64) || defined(__aarch64__) || defined(__arm64__) /* aarch64 */ \ + || defined(__PPC64__) || defined(__PPC64LE__) || defined(__ppc64__) || defined(__powerpc64__) /* ppc64 */ \ + || defined(__mips64__) || defined(__mips64)) /* mips64 */ \ + || (!defined(SIZE_MAX) || SIZE_MAX < ULLONG_MAX) /* check limits */ +# define XXH_REROLL_XXH64 1 +# else +# define XXH_REROLL_XXH64 0 +# endif +#endif /* !defined(XXH_REROLL_XXH64) */ + +#if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==3)) +/* + * Manual byteshift. Best for old compilers which don't inline memcpy. + * We actually directly use XXH_readLE64 and XXH_readBE64. + */ +#elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==2)) + +/* Force direct memory access. Only works on CPU which support unaligned memory access in hardware */ +static xxh_u64 XXH_read64(const void* memPtr) { return *(const xxh_u64*) memPtr; } + +#elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==1)) + +/* + * __pack instructions are safer, but compiler specific, hence potentially + * problematic for some compilers. + * + * Currently only defined for GCC and ICC. + */ +#ifdef XXH_OLD_NAMES +typedef union { xxh_u32 u32; xxh_u64 u64; } __attribute__((packed)) unalign64; +#endif +static xxh_u64 XXH_read64(const void* ptr) +{ + typedef union { xxh_u32 u32; xxh_u64 u64; } __attribute__((packed)) xxh_unalign64; + return ((const xxh_unalign64*)ptr)->u64; +} + +#else + +/* + * Portable and safe solution. Generally efficient. + * see: https://stackoverflow.com/a/32095106/646947 + */ +static xxh_u64 XXH_read64(const void* memPtr) +{ + xxh_u64 val; + memcpy(&val, memPtr, sizeof(val)); + return val; +} + +#endif /* XXH_FORCE_DIRECT_MEMORY_ACCESS */ + +#if defined(_MSC_VER) /* Visual Studio */ +# define XXH_swap64 _byteswap_uint64 +#elif XXH_GCC_VERSION >= 403 +# define XXH_swap64 __builtin_bswap64 +#else +static xxh_u64 XXH_swap64 (xxh_u64 x) +{ + return ((x << 56) & 0xff00000000000000ULL) | + ((x << 40) & 0x00ff000000000000ULL) | + ((x << 24) & 0x0000ff0000000000ULL) | + ((x << 8) & 0x000000ff00000000ULL) | + ((x >> 8) & 0x00000000ff000000ULL) | + ((x >> 24) & 0x0000000000ff0000ULL) | + ((x >> 40) & 0x000000000000ff00ULL) | + ((x >> 56) & 0x00000000000000ffULL); +} +#endif + + +/* XXH_FORCE_MEMORY_ACCESS==3 is an endian-independent byteshift load. */ +#if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==3)) + +XXH_FORCE_INLINE xxh_u64 XXH_readLE64(const void* memPtr) +{ + const xxh_u8* bytePtr = (const xxh_u8 *)memPtr; + return bytePtr[0] + | ((xxh_u64)bytePtr[1] << 8) + | ((xxh_u64)bytePtr[2] << 16) + | ((xxh_u64)bytePtr[3] << 24) + | ((xxh_u64)bytePtr[4] << 32) + | ((xxh_u64)bytePtr[5] << 40) + | ((xxh_u64)bytePtr[6] << 48) + | ((xxh_u64)bytePtr[7] << 56); +} + +XXH_FORCE_INLINE xxh_u64 XXH_readBE64(const void* memPtr) +{ + const xxh_u8* bytePtr = (const xxh_u8 *)memPtr; + return bytePtr[7] + | ((xxh_u64)bytePtr[6] << 8) + | ((xxh_u64)bytePtr[5] << 16) + | ((xxh_u64)bytePtr[4] << 24) + | ((xxh_u64)bytePtr[3] << 32) + | ((xxh_u64)bytePtr[2] << 40) + | ((xxh_u64)bytePtr[1] << 48) + | ((xxh_u64)bytePtr[0] << 56); +} + +#else +XXH_FORCE_INLINE xxh_u64 XXH_readLE64(const void* ptr) +{ + return XXH_CPU_LITTLE_ENDIAN ? XXH_read64(ptr) : XXH_swap64(XXH_read64(ptr)); +} + +static xxh_u64 XXH_readBE64(const void* ptr) +{ + return XXH_CPU_LITTLE_ENDIAN ? XXH_swap64(XXH_read64(ptr)) : XXH_read64(ptr); +} +#endif + +XXH_FORCE_INLINE xxh_u64 +XXH_readLE64_align(const void* ptr, XXH_alignment align) +{ + if (align==XXH_unaligned) + return XXH_readLE64(ptr); + else + return XXH_CPU_LITTLE_ENDIAN ? *(const xxh_u64*)ptr : XXH_swap64(*(const xxh_u64*)ptr); +} + + +/******* xxh64 *******/ + +static const xxh_u64 XXH_PRIME64_1 = 0x9E3779B185EBCA87ULL; /* 0b1001111000110111011110011011000110000101111010111100101010000111 */ +static const xxh_u64 XXH_PRIME64_2 = 0xC2B2AE3D27D4EB4FULL; /* 0b1100001010110010101011100011110100100111110101001110101101001111 */ +static const xxh_u64 XXH_PRIME64_3 = 0x165667B19E3779F9ULL; /* 0b0001011001010110011001111011000110011110001101110111100111111001 */ +static const xxh_u64 XXH_PRIME64_4 = 0x85EBCA77C2B2AE63ULL; /* 0b1000010111101011110010100111011111000010101100101010111001100011 */ +static const xxh_u64 XXH_PRIME64_5 = 0x27D4EB2F165667C5ULL; /* 0b0010011111010100111010110010111100010110010101100110011111000101 */ + +#ifdef XXH_OLD_NAMES +# define PRIME64_1 XXH_PRIME64_1 +# define PRIME64_2 XXH_PRIME64_2 +# define PRIME64_3 XXH_PRIME64_3 +# define PRIME64_4 XXH_PRIME64_4 +# define PRIME64_5 XXH_PRIME64_5 +#endif + +static xxh_u64 XXH64_round(xxh_u64 acc, xxh_u64 input) +{ + acc += input * XXH_PRIME64_2; + acc = XXH_rotl64(acc, 31); + acc *= XXH_PRIME64_1; + return acc; +} + +static xxh_u64 XXH64_mergeRound(xxh_u64 acc, xxh_u64 val) +{ + val = XXH64_round(0, val); + acc ^= val; + acc = acc * XXH_PRIME64_1 + XXH_PRIME64_4; + return acc; +} + +static xxh_u64 XXH64_avalanche(xxh_u64 h64) +{ + h64 ^= h64 >> 33; + h64 *= XXH_PRIME64_2; + h64 ^= h64 >> 29; + h64 *= XXH_PRIME64_3; + h64 ^= h64 >> 32; + return h64; +} + + +#define XXH_get64bits(p) XXH_readLE64_align(p, align) + +static xxh_u64 +XXH64_finalize(xxh_u64 h64, const xxh_u8* ptr, size_t len, XXH_alignment align) +{ +#define XXH_PROCESS1_64 do { \ + h64 ^= (*ptr++) * XXH_PRIME64_5; \ + h64 = XXH_rotl64(h64, 11) * XXH_PRIME64_1; \ +} while (0) + +#define XXH_PROCESS4_64 do { \ + h64 ^= (xxh_u64)(XXH_get32bits(ptr)) * XXH_PRIME64_1; \ + ptr += 4; \ + h64 = XXH_rotl64(h64, 23) * XXH_PRIME64_2 + XXH_PRIME64_3; \ +} while (0) + +#define XXH_PROCESS8_64 do { \ + xxh_u64 const k1 = XXH64_round(0, XXH_get64bits(ptr)); \ + ptr += 8; \ + h64 ^= k1; \ + h64 = XXH_rotl64(h64,27) * XXH_PRIME64_1 + XXH_PRIME64_4; \ +} while (0) + + /* Rerolled version for 32-bit targets is faster and much smaller. */ + if (XXH_REROLL || XXH_REROLL_XXH64) { + len &= 31; + while (len >= 8) { + XXH_PROCESS8_64; + len -= 8; + } + if (len >= 4) { + XXH_PROCESS4_64; + len -= 4; + } + while (len > 0) { + XXH_PROCESS1_64; + --len; + } + return XXH64_avalanche(h64); + } else { + switch(len & 31) { + case 24: XXH_PROCESS8_64; + /* fallthrough */ + case 16: XXH_PROCESS8_64; + /* fallthrough */ + case 8: XXH_PROCESS8_64; + return XXH64_avalanche(h64); + + case 28: XXH_PROCESS8_64; + /* fallthrough */ + case 20: XXH_PROCESS8_64; + /* fallthrough */ + case 12: XXH_PROCESS8_64; + /* fallthrough */ + case 4: XXH_PROCESS4_64; + return XXH64_avalanche(h64); + + case 25: XXH_PROCESS8_64; + /* fallthrough */ + case 17: XXH_PROCESS8_64; + /* fallthrough */ + case 9: XXH_PROCESS8_64; + XXH_PROCESS1_64; + return XXH64_avalanche(h64); + + case 29: XXH_PROCESS8_64; + /* fallthrough */ + case 21: XXH_PROCESS8_64; + /* fallthrough */ + case 13: XXH_PROCESS8_64; + /* fallthrough */ + case 5: XXH_PROCESS4_64; + XXH_PROCESS1_64; + return XXH64_avalanche(h64); + + case 26: XXH_PROCESS8_64; + /* fallthrough */ + case 18: XXH_PROCESS8_64; + /* fallthrough */ + case 10: XXH_PROCESS8_64; + XXH_PROCESS1_64; + XXH_PROCESS1_64; + return XXH64_avalanche(h64); + + case 30: XXH_PROCESS8_64; + /* fallthrough */ + case 22: XXH_PROCESS8_64; + /* fallthrough */ + case 14: XXH_PROCESS8_64; + /* fallthrough */ + case 6: XXH_PROCESS4_64; + XXH_PROCESS1_64; + XXH_PROCESS1_64; + return XXH64_avalanche(h64); + + case 27: XXH_PROCESS8_64; + /* fallthrough */ + case 19: XXH_PROCESS8_64; + /* fallthrough */ + case 11: XXH_PROCESS8_64; + XXH_PROCESS1_64; + XXH_PROCESS1_64; + XXH_PROCESS1_64; + return XXH64_avalanche(h64); + + case 31: XXH_PROCESS8_64; + /* fallthrough */ + case 23: XXH_PROCESS8_64; + /* fallthrough */ + case 15: XXH_PROCESS8_64; + /* fallthrough */ + case 7: XXH_PROCESS4_64; + /* fallthrough */ + case 3: XXH_PROCESS1_64; + /* fallthrough */ + case 2: XXH_PROCESS1_64; + /* fallthrough */ + case 1: XXH_PROCESS1_64; + /* fallthrough */ + case 0: return XXH64_avalanche(h64); + } + } + /* impossible to reach */ + XXH_ASSERT(0); + return 0; /* unreachable, but some compilers complain without it */ +} + +#ifdef XXH_OLD_NAMES +# define PROCESS1_64 XXH_PROCESS1_64 +# define PROCESS4_64 XXH_PROCESS4_64 +# define PROCESS8_64 XXH_PROCESS8_64 +#else +# undef XXH_PROCESS1_64 +# undef XXH_PROCESS4_64 +# undef XXH_PROCESS8_64 +#endif + +XXH_FORCE_INLINE xxh_u64 +XXH64_endian_align(const xxh_u8* input, size_t len, xxh_u64 seed, XXH_alignment align) +{ + const xxh_u8* bEnd = input + len; + xxh_u64 h64; + +#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) && (XXH_ACCEPT_NULL_INPUT_POINTER>=1) + if (input==NULL) { + len=0; + bEnd=input=(const xxh_u8*)(size_t)32; + } +#endif + + if (len>=32) { + const xxh_u8* const limit = bEnd - 32; + xxh_u64 v1 = seed + XXH_PRIME64_1 + XXH_PRIME64_2; + xxh_u64 v2 = seed + XXH_PRIME64_2; + xxh_u64 v3 = seed + 0; + xxh_u64 v4 = seed - XXH_PRIME64_1; + + do { + v1 = XXH64_round(v1, XXH_get64bits(input)); input+=8; + v2 = XXH64_round(v2, XXH_get64bits(input)); input+=8; + v3 = XXH64_round(v3, XXH_get64bits(input)); input+=8; + v4 = XXH64_round(v4, XXH_get64bits(input)); input+=8; + } while (input<=limit); + + h64 = XXH_rotl64(v1, 1) + XXH_rotl64(v2, 7) + XXH_rotl64(v3, 12) + XXH_rotl64(v4, 18); + h64 = XXH64_mergeRound(h64, v1); + h64 = XXH64_mergeRound(h64, v2); + h64 = XXH64_mergeRound(h64, v3); + h64 = XXH64_mergeRound(h64, v4); + + } else { + h64 = seed + XXH_PRIME64_5; + } + + h64 += (xxh_u64) len; + + return XXH64_finalize(h64, input, len, align); +} + + +XXH_PUBLIC_API XXH64_hash_t XXH64 (const void* input, size_t len, XXH64_hash_t seed) +{ +#if 0 + /* Simple version, good for code maintenance, but unfortunately slow for small inputs */ + XXH64_state_t state; + XXH64_reset(&state, seed); + XXH64_update(&state, (const xxh_u8*)input, len); + return XXH64_digest(&state); + +#else + + if (XXH_FORCE_ALIGN_CHECK) { + if ((((size_t)input) & 7)==0) { /* Input is aligned, let's leverage the speed advantage */ + return XXH64_endian_align((const xxh_u8*)input, len, seed, XXH_aligned); + } } + + return XXH64_endian_align((const xxh_u8*)input, len, seed, XXH_unaligned); + +#endif +} + +/******* Hash Streaming *******/ + +XXH_PUBLIC_API XXH64_state_t* XXH64_createState(void) +{ + return (XXH64_state_t*)XXH_malloc(sizeof(XXH64_state_t)); +} +XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr) +{ + XXH_free(statePtr); + return XXH_OK; +} + +XXH_PUBLIC_API void XXH64_copyState(XXH64_state_t* dstState, const XXH64_state_t* srcState) +{ + memcpy(dstState, srcState, sizeof(*dstState)); +} + +XXH_PUBLIC_API XXH_errorcode XXH64_reset(XXH64_state_t* statePtr, XXH64_hash_t seed) +{ + XXH64_state_t state; /* use a local state to memcpy() in order to avoid strict-aliasing warnings */ + memset(&state, 0, sizeof(state)); + state.v1 = seed + XXH_PRIME64_1 + XXH_PRIME64_2; + state.v2 = seed + XXH_PRIME64_2; + state.v3 = seed + 0; + state.v4 = seed - XXH_PRIME64_1; + /* do not write into reserved64, might be removed in a future version */ + memcpy(statePtr, &state, sizeof(state) - sizeof(state.reserved64)); + return XXH_OK; +} + +XXH_PUBLIC_API XXH_errorcode +XXH64_update (XXH64_state_t* state, const void* input, size_t len) +{ + if (input==NULL) +#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) && (XXH_ACCEPT_NULL_INPUT_POINTER>=1) + return XXH_OK; +#else + return XXH_ERROR; +#endif + + { const xxh_u8* p = (const xxh_u8*)input; + const xxh_u8* const bEnd = p + len; + + state->total_len += len; + + if (state->memsize + len < 32) { /* fill in tmp buffer */ + XXH_memcpy(((xxh_u8*)state->mem64) + state->memsize, input, len); + state->memsize += (xxh_u32)len; + return XXH_OK; + } + + if (state->memsize) { /* tmp buffer is full */ + XXH_memcpy(((xxh_u8*)state->mem64) + state->memsize, input, 32-state->memsize); + state->v1 = XXH64_round(state->v1, XXH_readLE64(state->mem64+0)); + state->v2 = XXH64_round(state->v2, XXH_readLE64(state->mem64+1)); + state->v3 = XXH64_round(state->v3, XXH_readLE64(state->mem64+2)); + state->v4 = XXH64_round(state->v4, XXH_readLE64(state->mem64+3)); + p += 32-state->memsize; + state->memsize = 0; + } + + if (p+32 <= bEnd) { + const xxh_u8* const limit = bEnd - 32; + xxh_u64 v1 = state->v1; + xxh_u64 v2 = state->v2; + xxh_u64 v3 = state->v3; + xxh_u64 v4 = state->v4; + + do { + v1 = XXH64_round(v1, XXH_readLE64(p)); p+=8; + v2 = XXH64_round(v2, XXH_readLE64(p)); p+=8; + v3 = XXH64_round(v3, XXH_readLE64(p)); p+=8; + v4 = XXH64_round(v4, XXH_readLE64(p)); p+=8; + } while (p<=limit); + + state->v1 = v1; + state->v2 = v2; + state->v3 = v3; + state->v4 = v4; + } + + if (p < bEnd) { + XXH_memcpy(state->mem64, p, (size_t)(bEnd-p)); + state->memsize = (unsigned)(bEnd-p); + } + } + + return XXH_OK; +} + + +XXH_PUBLIC_API XXH64_hash_t XXH64_digest (const XXH64_state_t* state) +{ + xxh_u64 h64; + + if (state->total_len >= 32) { + xxh_u64 const v1 = state->v1; + xxh_u64 const v2 = state->v2; + xxh_u64 const v3 = state->v3; + xxh_u64 const v4 = state->v4; + + h64 = XXH_rotl64(v1, 1) + XXH_rotl64(v2, 7) + XXH_rotl64(v3, 12) + XXH_rotl64(v4, 18); + h64 = XXH64_mergeRound(h64, v1); + h64 = XXH64_mergeRound(h64, v2); + h64 = XXH64_mergeRound(h64, v3); + h64 = XXH64_mergeRound(h64, v4); + } else { + h64 = state->v3 /*seed*/ + XXH_PRIME64_5; + } + + h64 += (xxh_u64) state->total_len; + + return XXH64_finalize(h64, (const xxh_u8*)state->mem64, (size_t)state->total_len, XXH_aligned); +} + + +/******* Canonical representation *******/ + +XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash) +{ + XXH_STATIC_ASSERT(sizeof(XXH64_canonical_t) == sizeof(XXH64_hash_t)); + if (XXH_CPU_LITTLE_ENDIAN) hash = XXH_swap64(hash); + memcpy(dst, &hash, sizeof(*dst)); +} + +XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src) +{ + return XXH_readBE64(src); +} + + + +/* ********************************************************************* +* XXH3 +* New generation hash designed for speed on small keys and vectorization +************************************************************************ */ + +/* === Compiler specifics === */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* >= C99 */ +# define XXH_RESTRICT restrict +#else +/* Note: it might be useful to define __restrict or __restrict__ for some C++ compilers */ +# define XXH_RESTRICT /* disable */ +#endif + +#if (defined(__GNUC__) && (__GNUC__ >= 3)) \ + || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800)) \ + || defined(__clang__) +# define XXH_likely(x) __builtin_expect(x, 1) +# define XXH_unlikely(x) __builtin_expect(x, 0) +#else +# define XXH_likely(x) (x) +# define XXH_unlikely(x) (x) +#endif + +#if defined(__GNUC__) +# if defined(__AVX2__) +# include <immintrin.h> +# elif defined(__SSE2__) +# include <emmintrin.h> +# elif defined(__ARM_NEON__) || defined(__ARM_NEON) +# define inline __inline__ /* circumvent a clang bug */ +# include <arm_neon.h> +# undef inline +# endif +#elif defined(_MSC_VER) +# include <intrin.h> +#endif + +/* + * One goal of XXH3 is to make it fast on both 32-bit and 64-bit, while + * remaining a true 64-bit/128-bit hash function. + * + * This is done by prioritizing a subset of 64-bit operations that can be + * emulated without too many steps on the average 32-bit machine. + * + * For example, these two lines seem similar, and run equally fast on 64-bit: + * + * xxh_u64 x; + * x ^= (x >> 47); // good + * x ^= (x >> 13); // bad + * + * However, to a 32-bit machine, there is a major difference. + * + * x ^= (x >> 47) looks like this: + * + * x.lo ^= (x.hi >> (47 - 32)); + * + * while x ^= (x >> 13) looks like this: + * + * // note: funnel shifts are not usually cheap. + * x.lo ^= (x.lo >> 13) | (x.hi << (32 - 13)); + * x.hi ^= (x.hi >> 13); + * + * The first one is significantly faster than the second, simply because the + * shift is larger than 32. This means: + * - All the bits we need are in the upper 32 bits, so we can ignore the lower + * 32 bits in the shift. + * - The shift result will always fit in the lower 32 bits, and therefore, + * we can ignore the upper 32 bits in the xor. + * + * Thanks to this optimization, XXH3 only requires these features to be efficient: + * + * - Usable unaligned access + * - A 32-bit or 64-bit ALU + * - If 32-bit, a decent ADC instruction + * - A 32 or 64-bit multiply with a 64-bit result + * - For the 128-bit variant, a decent byteswap helps short inputs. + * + * The first two are already required by XXH32, and almost all 32-bit and 64-bit + * platforms which can run XXH32 can run XXH3 efficiently. + * + * Thumb-1, the classic 16-bit only subset of ARM's instruction set, is one + * notable exception. + * + * First of all, Thumb-1 lacks support for the UMULL instruction which + * performs the important long multiply. This means numerous __aeabi_lmul + * calls. + * + * Second of all, the 8 functional registers are just not enough. + * Setup for __aeabi_lmul, byteshift loads, pointers, and all arithmetic need + * Lo registers, and this shuffling results in thousands more MOVs than A32. + * + * A32 and T32 don't have this limitation. They can access all 14 registers, + * do a 32->64 multiply with UMULL, and the flexible operand allowing free + * shifts is helpful, too. + * + * Therefore, we do a quick sanity check. + * + * If compiling Thumb-1 for a target which supports ARM instructions, we will + * emit a warning, as it is not a "sane" platform to compile for. + * + * Usually, if this happens, it is because of an accident and you probably need + * to specify -march, as you likely meant to compile for a newer architecture. + * + * Credit: large sections of the vectorial and asm source code paths + * have been contributed by @easyaspi314 + */ +#if defined(__thumb__) && !defined(__thumb2__) && defined(__ARM_ARCH_ISA_ARM) +# warning "XXH3 is highly inefficient without ARM or Thumb-2." +#endif + +/* ========================================== + * Vectorization detection + * ========================================== */ +#define XXH_SCALAR 0 /* Portable scalar version */ +#define XXH_SSE2 1 /* SSE2 for Pentium 4 and all x86_64 */ +#define XXH_AVX2 2 /* AVX2 for Haswell and Bulldozer */ +#define XXH_AVX512 3 /* AVX512 for Skylake and Icelake */ +#define XXH_NEON 4 /* NEON for most ARMv7-A and all AArch64 */ +#define XXH_VSX 5 /* VSX and ZVector for POWER8/z13 */ + +#ifndef XXH_VECTOR /* can be defined on command line */ +# if defined(__AVX512F__) +# define XXH_VECTOR XXH_AVX512 +# elif defined(__AVX2__) +# define XXH_VECTOR XXH_AVX2 +# elif defined(__SSE2__) || defined(_M_AMD64) || defined(_M_X64) || (defined(_M_IX86_FP) && (_M_IX86_FP == 2)) +# define XXH_VECTOR XXH_SSE2 +# elif defined(__GNUC__) /* msvc support maybe later */ \ + && (defined(__ARM_NEON__) || defined(__ARM_NEON)) \ + && (defined(__LITTLE_ENDIAN__) /* We only support little endian NEON */ \ + || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) +# define XXH_VECTOR XXH_NEON +# elif (defined(__PPC64__) && defined(__POWER8_VECTOR__)) \ + || (defined(__s390x__) && defined(__VEC__)) \ + && defined(__GNUC__) /* TODO: IBM XL */ +# define XXH_VECTOR XXH_VSX +# else +# define XXH_VECTOR XXH_SCALAR +# endif +#endif + +/* + * Controls the alignment of the accumulator, + * for compatibility with aligned vector loads, which are usually faster. + */ +#ifndef XXH_ACC_ALIGN +# if defined(XXH_X86DISPATCH) +# define XXH_ACC_ALIGN 64 /* for compatibility with avx512 */ +# elif XXH_VECTOR == XXH_SCALAR /* scalar */ +# define XXH_ACC_ALIGN 8 +# elif XXH_VECTOR == XXH_SSE2 /* sse2 */ +# define XXH_ACC_ALIGN 16 +# elif XXH_VECTOR == XXH_AVX2 /* avx2 */ +# define XXH_ACC_ALIGN 32 +# elif XXH_VECTOR == XXH_NEON /* neon */ +# define XXH_ACC_ALIGN 16 +# elif XXH_VECTOR == XXH_VSX /* vsx */ +# define XXH_ACC_ALIGN 16 +# elif XXH_VECTOR == XXH_AVX512 /* avx512 */ +# define XXH_ACC_ALIGN 64 +# endif +#endif + +#if defined(XXH_X86DISPATCH) || XXH_VECTOR == XXH_SSE2 \ + || XXH_VECTOR == XXH_AVX2 || XXH_VECTOR == XXH_AVX512 +# define XXH_SEC_ALIGN XXH_ACC_ALIGN +#else +# define XXH_SEC_ALIGN 8 +#endif + +/* + * UGLY HACK: + * GCC usually generates the best code with -O3 for xxHash. + * + * However, when targeting AVX2, it is overzealous in its unrolling resulting + * in code roughly 3/4 the speed of Clang. + * + * There are other issues, such as GCC splitting _mm256_loadu_si256 into + * _mm_loadu_si128 + _mm256_inserti128_si256. This is an optimization which + * only applies to Sandy and Ivy Bridge... which don't even support AVX2. + * + * That is why when compiling the AVX2 version, it is recommended to use either + * -O2 -mavx2 -march=haswell + * or + * -O2 -mavx2 -mno-avx256-split-unaligned-load + * for decent performance, or to use Clang instead. + * + * Fortunately, we can control the first one with a pragma that forces GCC into + * -O2, but the other one we can't control without "failed to inline always + * inline function due to target mismatch" warnings. + */ +#if XXH_VECTOR == XXH_AVX2 /* AVX2 */ \ + && defined(__GNUC__) && !defined(__clang__) /* GCC, not Clang */ \ + && defined(__OPTIMIZE__) && !defined(__OPTIMIZE_SIZE__) /* respect -O0 and -Os */ +# pragma GCC push_options +# pragma GCC optimize("-O2") +#endif + + +#if XXH_VECTOR == XXH_NEON +/* + * NEON's setup for vmlal_u32 is a little more complicated than it is on + * SSE2, AVX2, and VSX. + * + * While PMULUDQ and VMULEUW both perform a mask, VMLAL.U32 performs an upcast. + * + * To do the same operation, the 128-bit 'Q' register needs to be split into + * two 64-bit 'D' registers, performing this operation:: + * + * [ a | b ] + * | '---------. .--------' | + * | x | + * | .---------' '--------. | + * [ a & 0xFFFFFFFF | b & 0xFFFFFFFF ],[ a >> 32 | b >> 32 ] + * + * Due to significant changes in aarch64, the fastest method for aarch64 is + * completely different than the fastest method for ARMv7-A. + * + * ARMv7-A treats D registers as unions overlaying Q registers, so modifying + * D11 will modify the high half of Q5. This is similar to how modifying AH + * will only affect bits 8-15 of AX on x86. + * + * VZIP takes two registers, and puts even lanes in one register and odd lanes + * in the other. + * + * On ARMv7-A, this strangely modifies both parameters in place instead of + * taking the usual 3-operand form. + * + * Therefore, if we want to do this, we can simply use a D-form VZIP.32 on the + * lower and upper halves of the Q register to end up with the high and low + * halves where we want - all in one instruction. + * + * vzip.32 d10, d11 @ d10 = { d10[0], d11[0] }; d11 = { d10[1], d11[1] } + * + * Unfortunately we need inline assembly for this: Instructions modifying two + * registers at once is not possible in GCC or Clang's IR, and they have to + * create a copy. + * + * aarch64 requires a different approach. + * + * In order to make it easier to write a decent compiler for aarch64, many + * quirks were removed, such as conditional execution. + * + * NEON was also affected by this. + * + * aarch64 cannot access the high bits of a Q-form register, and writes to a + * D-form register zero the high bits, similar to how writes to W-form scalar + * registers (or DWORD registers on x86_64) work. + * + * The formerly free vget_high intrinsics now require a vext (with a few + * exceptions) + * + * Additionally, VZIP was replaced by ZIP1 and ZIP2, which are the equivalent + * of PUNPCKL* and PUNPCKH* in SSE, respectively, in order to only modify one + * operand. + * + * The equivalent of the VZIP.32 on the lower and upper halves would be this + * mess: + * + * ext v2.4s, v0.4s, v0.4s, #2 // v2 = { v0[2], v0[3], v0[0], v0[1] } + * zip1 v1.2s, v0.2s, v2.2s // v1 = { v0[0], v2[0] } + * zip2 v0.2s, v0.2s, v1.2s // v0 = { v0[1], v2[1] } + * + * Instead, we use a literal downcast, vmovn_u64 (XTN), and vshrn_n_u64 (SHRN): + * + * shrn v1.2s, v0.2d, #32 // v1 = (uint32x2_t)(v0 >> 32); + * xtn v0.2s, v0.2d // v0 = (uint32x2_t)(v0 & 0xFFFFFFFF); + * + * This is available on ARMv7-A, but is less efficient than a single VZIP.32. + */ + +/* + * Function-like macro: + * void XXH_SPLIT_IN_PLACE(uint64x2_t &in, uint32x2_t &outLo, uint32x2_t &outHi) + * { + * outLo = (uint32x2_t)(in & 0xFFFFFFFF); + * outHi = (uint32x2_t)(in >> 32); + * in = UNDEFINED; + * } + */ +# if !defined(XXH_NO_VZIP_HACK) /* define to disable */ \ + && defined(__GNUC__) \ + && !defined(__aarch64__) && !defined(__arm64__) +# define XXH_SPLIT_IN_PLACE(in, outLo, outHi) \ + do { \ + /* Undocumented GCC/Clang operand modifier: %e0 = lower D half, %f0 = upper D half */ \ + /* https://github.com/gcc-mirror/gcc/blob/38cf91e5/gcc/config/arm/arm.c#L22486 */ \ + /* https://github.com/llvm-mirror/llvm/blob/2c4ca683/lib/Target/ARM/ARMAsmPrinter.cpp#L399 */ \ + __asm__("vzip.32 %e0, %f0" : "+w" (in)); \ + (outLo) = vget_low_u32 (vreinterpretq_u32_u64(in)); \ + (outHi) = vget_high_u32(vreinterpretq_u32_u64(in)); \ + } while (0) +# else +# define XXH_SPLIT_IN_PLACE(in, outLo, outHi) \ + do { \ + (outLo) = vmovn_u64 (in); \ + (outHi) = vshrn_n_u64 ((in), 32); \ + } while (0) +# endif +#endif /* XXH_VECTOR == XXH_NEON */ + +/* + * VSX and Z Vector helpers. + * + * This is very messy, and any pull requests to clean this up are welcome. + * + * There are a lot of problems with supporting VSX and s390x, due to + * inconsistent intrinsics, spotty coverage, and multiple endiannesses. + */ +#if XXH_VECTOR == XXH_VSX +# if defined(__s390x__) +# include <s390intrin.h> +# else +/* gcc's altivec.h can have the unwanted consequence to unconditionally + * #define bool, vector, and pixel keywords, + * with bad consequences for programs already using these keywords for other purposes. + * The paragraph defining these macros is skipped when __APPLE_ALTIVEC__ is defined. + * __APPLE_ALTIVEC__ is _generally_ defined automatically by the compiler, + * but it seems that, in some cases, it isn't. + * Force the build macro to be defined, so that keywords are not altered. + */ +# if defined(__GNUC__) && !defined(__APPLE_ALTIVEC__) +# define __APPLE_ALTIVEC__ +# endif +# include <altivec.h> +# endif + +typedef __vector unsigned long long xxh_u64x2; +typedef __vector unsigned char xxh_u8x16; +typedef __vector unsigned xxh_u32x4; + +# ifndef XXH_VSX_BE +# if defined(__BIG_ENDIAN__) \ + || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) +# define XXH_VSX_BE 1 +# elif defined(__VEC_ELEMENT_REG_ORDER__) && __VEC_ELEMENT_REG_ORDER__ == __ORDER_BIG_ENDIAN__ +# warning "-maltivec=be is not recommended. Please use native endianness." +# define XXH_VSX_BE 1 +# else +# define XXH_VSX_BE 0 +# endif +# endif /* !defined(XXH_VSX_BE) */ + +# if XXH_VSX_BE +/* A wrapper for POWER9's vec_revb. */ +# if defined(__POWER9_VECTOR__) || (defined(__clang__) && defined(__s390x__)) +# define XXH_vec_revb vec_revb +# else +XXH_FORCE_INLINE xxh_u64x2 XXH_vec_revb(xxh_u64x2 val) +{ + xxh_u8x16 const vByteSwap = { 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, + 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08 }; + return vec_perm(val, val, vByteSwap); +} +# endif +# endif /* XXH_VSX_BE */ + +/* + * Performs an unaligned load and byte swaps it on big endian. + */ +XXH_FORCE_INLINE xxh_u64x2 XXH_vec_loadu(const void *ptr) +{ + xxh_u64x2 ret; + memcpy(&ret, ptr, sizeof(xxh_u64x2)); +# if XXH_VSX_BE + ret = XXH_vec_revb(ret); +# endif + return ret; +} + +/* + * vec_mulo and vec_mule are very problematic intrinsics on PowerPC + * + * These intrinsics weren't added until GCC 8, despite existing for a while, + * and they are endian dependent. Also, their meaning swap depending on version. + * */ +# if defined(__s390x__) + /* s390x is always big endian, no issue on this platform */ +# define XXH_vec_mulo vec_mulo +# define XXH_vec_mule vec_mule +# elif defined(__clang__) && XXH_HAS_BUILTIN(__builtin_altivec_vmuleuw) +/* Clang has a better way to control this, we can just use the builtin which doesn't swap. */ +# define XXH_vec_mulo __builtin_altivec_vmulouw +# define XXH_vec_mule __builtin_altivec_vmuleuw +# else +/* gcc needs inline assembly */ +/* Adapted from https://github.com/google/highwayhash/blob/master/highwayhash/hh_vsx.h. */ +XXH_FORCE_INLINE xxh_u64x2 XXH_vec_mulo(xxh_u32x4 a, xxh_u32x4 b) +{ + xxh_u64x2 result; + __asm__("vmulouw %0, %1, %2" : "=v" (result) : "v" (a), "v" (b)); + return result; +} +XXH_FORCE_INLINE xxh_u64x2 XXH_vec_mule(xxh_u32x4 a, xxh_u32x4 b) +{ + xxh_u64x2 result; + __asm__("vmuleuw %0, %1, %2" : "=v" (result) : "v" (a), "v" (b)); + return result; +} +# endif /* XXH_vec_mulo, XXH_vec_mule */ +#endif /* XXH_VECTOR == XXH_VSX */ + + +/* prefetch + * can be disabled, by declaring XXH_NO_PREFETCH build macro */ +#if defined(XXH_NO_PREFETCH) +# define XXH_PREFETCH(ptr) (void)(ptr) /* disabled */ +#else +# if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_I86)) /* _mm_prefetch() is not defined outside of x86/x64 */ +# include <mmintrin.h> /* https://msdn.microsoft.com/fr-fr/library/84szxsww(v=vs.90).aspx */ +# define XXH_PREFETCH(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T0) +# elif defined(__GNUC__) && ( (__GNUC__ >= 4) || ( (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1) ) ) +# define XXH_PREFETCH(ptr) __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */) +# else +# define XXH_PREFETCH(ptr) (void)(ptr) /* disabled */ +# endif +#endif /* XXH_NO_PREFETCH */ + + +/* ========================================== + * XXH3 default settings + * ========================================== */ + +#define XXH_SECRET_DEFAULT_SIZE 192 /* minimum XXH3_SECRET_SIZE_MIN */ + +#if (XXH_SECRET_DEFAULT_SIZE < XXH3_SECRET_SIZE_MIN) +# error "default keyset is not large enough" +#endif + +/* Pseudorandom secret taken directly from FARSH */ +XXH_ALIGN(64) static const xxh_u8 XXH3_kSecret[XXH_SECRET_DEFAULT_SIZE] = { + 0xb8, 0xfe, 0x6c, 0x39, 0x23, 0xa4, 0x4b, 0xbe, 0x7c, 0x01, 0x81, 0x2c, 0xf7, 0x21, 0xad, 0x1c, + 0xde, 0xd4, 0x6d, 0xe9, 0x83, 0x90, 0x97, 0xdb, 0x72, 0x40, 0xa4, 0xa4, 0xb7, 0xb3, 0x67, 0x1f, + 0xcb, 0x79, 0xe6, 0x4e, 0xcc, 0xc0, 0xe5, 0x78, 0x82, 0x5a, 0xd0, 0x7d, 0xcc, 0xff, 0x72, 0x21, + 0xb8, 0x08, 0x46, 0x74, 0xf7, 0x43, 0x24, 0x8e, 0xe0, 0x35, 0x90, 0xe6, 0x81, 0x3a, 0x26, 0x4c, + 0x3c, 0x28, 0x52, 0xbb, 0x91, 0xc3, 0x00, 0xcb, 0x88, 0xd0, 0x65, 0x8b, 0x1b, 0x53, 0x2e, 0xa3, + 0x71, 0x64, 0x48, 0x97, 0xa2, 0x0d, 0xf9, 0x4e, 0x38, 0x19, 0xef, 0x46, 0xa9, 0xde, 0xac, 0xd8, + 0xa8, 0xfa, 0x76, 0x3f, 0xe3, 0x9c, 0x34, 0x3f, 0xf9, 0xdc, 0xbb, 0xc7, 0xc7, 0x0b, 0x4f, 0x1d, + 0x8a, 0x51, 0xe0, 0x4b, 0xcd, 0xb4, 0x59, 0x31, 0xc8, 0x9f, 0x7e, 0xc9, 0xd9, 0x78, 0x73, 0x64, + 0xea, 0xc5, 0xac, 0x83, 0x34, 0xd3, 0xeb, 0xc3, 0xc5, 0x81, 0xa0, 0xff, 0xfa, 0x13, 0x63, 0xeb, + 0x17, 0x0d, 0xdd, 0x51, 0xb7, 0xf0, 0xda, 0x49, 0xd3, 0x16, 0x55, 0x26, 0x29, 0xd4, 0x68, 0x9e, + 0x2b, 0x16, 0xbe, 0x58, 0x7d, 0x47, 0xa1, 0xfc, 0x8f, 0xf8, 0xb8, 0xd1, 0x7a, 0xd0, 0x31, 0xce, + 0x45, 0xcb, 0x3a, 0x8f, 0x95, 0x16, 0x04, 0x28, 0xaf, 0xd7, 0xfb, 0xca, 0xbb, 0x4b, 0x40, 0x7e, +}; + + +#ifdef XXH_OLD_NAMES +# define kSecret XXH3_kSecret +#endif + +/* + * Calculates a 32-bit to 64-bit long multiply. + * + * Wraps __emulu on MSVC x86 because it tends to call __allmul when it doesn't + * need to (but it shouldn't need to anyways, it is about 7 instructions to do + * a 64x64 multiply...). Since we know that this will _always_ emit MULL, we + * use that instead of the normal method. + * + * If you are compiling for platforms like Thumb-1 and don't have a better option, + * you may also want to write your own long multiply routine here. + * + * XXH_FORCE_INLINE xxh_u64 XXH_mult32to64(xxh_u64 x, xxh_u64 y) + * { + * return (x & 0xFFFFFFFF) * (y & 0xFFFFFFFF); + * } + */ +#if defined(_MSC_VER) && defined(_M_IX86) +# include <intrin.h> +# define XXH_mult32to64(x, y) __emulu((unsigned)(x), (unsigned)(y)) +#else +/* + * Downcast + upcast is usually better than masking on older compilers like + * GCC 4.2 (especially 32-bit ones), all without affecting newer compilers. + * + * The other method, (x & 0xFFFFFFFF) * (y & 0xFFFFFFFF), will AND both operands + * and perform a full 64x64 multiply -- entirely redundant on 32-bit. + */ +# define XXH_mult32to64(x, y) ((xxh_u64)(xxh_u32)(x) * (xxh_u64)(xxh_u32)(y)) +#endif + +/* + * Calculates a 64->128-bit long multiply. + * + * Uses __uint128_t and _umul128 if available, otherwise uses a scalar version. + */ +static XXH128_hash_t +XXH_mult64to128(xxh_u64 lhs, xxh_u64 rhs) +{ + /* + * GCC/Clang __uint128_t method. + * + * On most 64-bit targets, GCC and Clang define a __uint128_t type. + * This is usually the best way as it usually uses a native long 64-bit + * multiply, such as MULQ on x86_64 or MUL + UMULH on aarch64. + * + * Usually. + * + * Despite being a 32-bit platform, Clang (and emscripten) define this type + * despite not having the arithmetic for it. This results in a laggy + * compiler builtin call which calculates a full 128-bit multiply. + * In that case it is best to use the portable one. + * https://github.com/Cyan4973/xxHash/issues/211#issuecomment-515575677 + */ +#if defined(__GNUC__) && !defined(__wasm__) \ + && defined(__SIZEOF_INT128__) \ + || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 128) + + __uint128_t const product = (__uint128_t)lhs * (__uint128_t)rhs; + XXH128_hash_t r128; + r128.low64 = (xxh_u64)(product); + r128.high64 = (xxh_u64)(product >> 64); + return r128; + + /* + * MSVC for x64's _umul128 method. + * + * xxh_u64 _umul128(xxh_u64 Multiplier, xxh_u64 Multiplicand, xxh_u64 *HighProduct); + * + * This compiles to single operand MUL on x64. + */ +#elif defined(_M_X64) || defined(_M_IA64) + +#ifndef _MSC_VER +# pragma intrinsic(_umul128) +#endif + xxh_u64 product_high; + xxh_u64 const product_low = _umul128(lhs, rhs, &product_high); + XXH128_hash_t r128; + r128.low64 = product_low; + r128.high64 = product_high; + return r128; + +#else + /* + * Portable scalar method. Optimized for 32-bit and 64-bit ALUs. + * + * This is a fast and simple grade school multiply, which is shown below + * with base 10 arithmetic instead of base 0x100000000. + * + * 9 3 // D2 lhs = 93 + * x 7 5 // D2 rhs = 75 + * ---------- + * 1 5 // D2 lo_lo = (93 % 10) * (75 % 10) = 15 + * 4 5 | // D2 hi_lo = (93 / 10) * (75 % 10) = 45 + * 2 1 | // D2 lo_hi = (93 % 10) * (75 / 10) = 21 + * + 6 3 | | // D2 hi_hi = (93 / 10) * (75 / 10) = 63 + * --------- + * 2 7 | // D2 cross = (15 / 10) + (45 % 10) + 21 = 27 + * + 6 7 | | // D2 upper = (27 / 10) + (45 / 10) + 63 = 67 + * --------- + * 6 9 7 5 // D4 res = (27 * 10) + (15 % 10) + (67 * 100) = 6975 + * + * The reasons for adding the products like this are: + * 1. It avoids manual carry tracking. Just like how + * (9 * 9) + 9 + 9 = 99, the same applies with this for UINT64_MAX. + * This avoids a lot of complexity. + * + * 2. It hints for, and on Clang, compiles to, the powerful UMAAL + * instruction available in ARM's Digital Signal Processing extension + * in 32-bit ARMv6 and later, which is shown below: + * + * void UMAAL(xxh_u32 *RdLo, xxh_u32 *RdHi, xxh_u32 Rn, xxh_u32 Rm) + * { + * xxh_u64 product = (xxh_u64)*RdLo * (xxh_u64)*RdHi + Rn + Rm; + * *RdLo = (xxh_u32)(product & 0xFFFFFFFF); + * *RdHi = (xxh_u32)(product >> 32); + * } + * + * This instruction was designed for efficient long multiplication, and + * allows this to be calculated in only 4 instructions at speeds + * comparable to some 64-bit ALUs. + * + * 3. It isn't terrible on other platforms. Usually this will be a couple + * of 32-bit ADD/ADCs. + */ + + /* First calculate all of the cross products. */ + xxh_u64 const lo_lo = XXH_mult32to64(lhs & 0xFFFFFFFF, rhs & 0xFFFFFFFF); + xxh_u64 const hi_lo = XXH_mult32to64(lhs >> 32, rhs & 0xFFFFFFFF); + xxh_u64 const lo_hi = XXH_mult32to64(lhs & 0xFFFFFFFF, rhs >> 32); + xxh_u64 const hi_hi = XXH_mult32to64(lhs >> 32, rhs >> 32); + + /* Now add the products together. These will never overflow. */ + xxh_u64 const cross = (lo_lo >> 32) + (hi_lo & 0xFFFFFFFF) + lo_hi; + xxh_u64 const upper = (hi_lo >> 32) + (cross >> 32) + hi_hi; + xxh_u64 const lower = (cross << 32) | (lo_lo & 0xFFFFFFFF); + + XXH128_hash_t r128; + r128.low64 = lower; + r128.high64 = upper; + return r128; +#endif +} + +/* + * Does a 64-bit to 128-bit multiply, then XOR folds it. + * + * The reason for the separate function is to prevent passing too many structs + * around by value. This will hopefully inline the multiply, but we don't force it. + */ +static xxh_u64 +XXH3_mul128_fold64(xxh_u64 lhs, xxh_u64 rhs) +{ + XXH128_hash_t product = XXH_mult64to128(lhs, rhs); + return product.low64 ^ product.high64; +} + +/* Seems to produce slightly better code on GCC for some reason. */ +XXH_FORCE_INLINE xxh_u64 XXH_xorshift64(xxh_u64 v64, int shift) +{ + XXH_ASSERT(0 <= shift && shift < 64); + return v64 ^ (v64 >> shift); +} + +/* + * This is a fast avalanche stage, + * suitable when input bits are already partially mixed + */ +static XXH64_hash_t XXH3_avalanche(xxh_u64 h64) +{ + h64 = XXH_xorshift64(h64, 37); + h64 *= 0x165667919E3779F9ULL; + h64 = XXH_xorshift64(h64, 32); + return h64; +} + +/* + * This is a stronger avalanche, + * inspired by Pelle Evensen's rrmxmx + * preferable when input has not been previously mixed + */ +static XXH64_hash_t XXH3_rrmxmx(xxh_u64 h64, xxh_u64 len) +{ + /* this mix is inspired by Pelle Evensen's rrmxmx */ + h64 ^= XXH_rotl64(h64, 49) ^ XXH_rotl64(h64, 24); + h64 *= 0x9FB21C651E98DF25ULL; + h64 ^= (h64 >> 35) + len ; + h64 *= 0x9FB21C651E98DF25ULL; + return XXH_xorshift64(h64, 28); +} + + +/* ========================================== + * Short keys + * ========================================== + * One of the shortcomings of XXH32 and XXH64 was that their performance was + * sub-optimal on short lengths. It used an iterative algorithm which strongly + * favored lengths that were a multiple of 4 or 8. + * + * Instead of iterating over individual inputs, we use a set of single shot + * functions which piece together a range of lengths and operate in constant time. + * + * Additionally, the number of multiplies has been significantly reduced. This + * reduces latency, especially when emulating 64-bit multiplies on 32-bit. + * + * Depending on the platform, this may or may not be faster than XXH32, but it + * is almost guaranteed to be faster than XXH64. + */ + +/* + * At very short lengths, there isn't enough input to fully hide secrets, or use + * the entire secret. + * + * There is also only a limited amount of mixing we can do before significantly + * impacting performance. + * + * Therefore, we use different sections of the secret and always mix two secret + * samples with an XOR. This should have no effect on performance on the + * seedless or withSeed variants because everything _should_ be constant folded + * by modern compilers. + * + * The XOR mixing hides individual parts of the secret and increases entropy. + * + * This adds an extra layer of strength for custom secrets. + */ +XXH_FORCE_INLINE XXH64_hash_t +XXH3_len_1to3_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) +{ + XXH_ASSERT(input != NULL); + XXH_ASSERT(1 <= len && len <= 3); + XXH_ASSERT(secret != NULL); + /* + * len = 1: combined = { input[0], 0x01, input[0], input[0] } + * len = 2: combined = { input[1], 0x02, input[0], input[1] } + * len = 3: combined = { input[2], 0x03, input[0], input[1] } + */ + { xxh_u8 const c1 = input[0]; + xxh_u8 const c2 = input[len >> 1]; + xxh_u8 const c3 = input[len - 1]; + xxh_u32 const combined = ((xxh_u32)c1 << 16) | ((xxh_u32)c2 << 24) + | ((xxh_u32)c3 << 0) | ((xxh_u32)len << 8); + xxh_u64 const bitflip = (XXH_readLE32(secret) ^ XXH_readLE32(secret+4)) + seed; + xxh_u64 const keyed = (xxh_u64)combined ^ bitflip; + return XXH64_avalanche(keyed); + } +} + +XXH_FORCE_INLINE XXH64_hash_t +XXH3_len_4to8_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) +{ + XXH_ASSERT(input != NULL); + XXH_ASSERT(secret != NULL); + XXH_ASSERT(4 <= len && len < 8); + seed ^= (xxh_u64)XXH_swap32((xxh_u32)seed) << 32; + { xxh_u32 const input1 = XXH_readLE32(input); + xxh_u32 const input2 = XXH_readLE32(input + len - 4); + xxh_u64 const bitflip = (XXH_readLE64(secret+8) ^ XXH_readLE64(secret+16)) - seed; + xxh_u64 const input64 = input2 + (((xxh_u64)input1) << 32); + xxh_u64 const keyed = input64 ^ bitflip; + return XXH3_rrmxmx(keyed, len); + } +} + +XXH_FORCE_INLINE XXH64_hash_t +XXH3_len_9to16_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) +{ + XXH_ASSERT(input != NULL); + XXH_ASSERT(secret != NULL); + XXH_ASSERT(8 <= len && len <= 16); + { xxh_u64 const bitflip1 = (XXH_readLE64(secret+24) ^ XXH_readLE64(secret+32)) + seed; + xxh_u64 const bitflip2 = (XXH_readLE64(secret+40) ^ XXH_readLE64(secret+48)) - seed; + xxh_u64 const input_lo = XXH_readLE64(input) ^ bitflip1; + xxh_u64 const input_hi = XXH_readLE64(input + len - 8) ^ bitflip2; + xxh_u64 const acc = len + + XXH_swap64(input_lo) + input_hi + + XXH3_mul128_fold64(input_lo, input_hi); + return XXH3_avalanche(acc); + } +} + +XXH_FORCE_INLINE XXH64_hash_t +XXH3_len_0to16_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) +{ + XXH_ASSERT(len <= 16); + { if (XXH_likely(len > 8)) return XXH3_len_9to16_64b(input, len, secret, seed); + if (XXH_likely(len >= 4)) return XXH3_len_4to8_64b(input, len, secret, seed); + if (len) return XXH3_len_1to3_64b(input, len, secret, seed); + return XXH64_avalanche(seed ^ (XXH_readLE64(secret+56) ^ XXH_readLE64(secret+64))); + } +} + +/* + * DISCLAIMER: There are known *seed-dependent* multicollisions here due to + * multiplication by zero, affecting hashes of lengths 17 to 240. + * + * However, they are very unlikely. + * + * Keep this in mind when using the unseeded XXH3_64bits() variant: As with all + * unseeded non-cryptographic hashes, it does not attempt to defend itself + * against specially crafted inputs, only random inputs. + * + * Compared to classic UMAC where a 1 in 2^31 chance of 4 consecutive bytes + * cancelling out the secret is taken an arbitrary number of times (addressed + * in XXH3_accumulate_512), this collision is very unlikely with random inputs + * and/or proper seeding: + * + * This only has a 1 in 2^63 chance of 8 consecutive bytes cancelling out, in a + * function that is only called up to 16 times per hash with up to 240 bytes of + * input. + * + * This is not too bad for a non-cryptographic hash function, especially with + * only 64 bit outputs. + * + * The 128-bit variant (which trades some speed for strength) is NOT affected + * by this, although it is always a good idea to use a proper seed if you care + * about strength. + */ +XXH_FORCE_INLINE xxh_u64 XXH3_mix16B(const xxh_u8* XXH_RESTRICT input, + const xxh_u8* XXH_RESTRICT secret, xxh_u64 seed64) +{ +#if defined(__GNUC__) && !defined(__clang__) /* GCC, not Clang */ \ + && defined(__i386__) && defined(__SSE2__) /* x86 + SSE2 */ \ + && !defined(XXH_ENABLE_AUTOVECTORIZE) /* Define to disable like XXH32 hack */ + /* + * UGLY HACK: + * GCC for x86 tends to autovectorize the 128-bit multiply, resulting in + * slower code. + * + * By forcing seed64 into a register, we disrupt the cost model and + * cause it to scalarize. See `XXH32_round()` + * + * FIXME: Clang's output is still _much_ faster -- On an AMD Ryzen 3600, + * XXH3_64bits @ len=240 runs at 4.6 GB/s with Clang 9, but 3.3 GB/s on + * GCC 9.2, despite both emitting scalar code. + * + * GCC generates much better scalar code than Clang for the rest of XXH3, + * which is why finding a more optimal codepath is an interest. + */ + __asm__ ("" : "+r" (seed64)); +#endif + { xxh_u64 const input_lo = XXH_readLE64(input); + xxh_u64 const input_hi = XXH_readLE64(input+8); + return XXH3_mul128_fold64( + input_lo ^ (XXH_readLE64(secret) + seed64), + input_hi ^ (XXH_readLE64(secret+8) - seed64) + ); + } +} + +/* For mid range keys, XXH3 uses a Mum-hash variant. */ +XXH_FORCE_INLINE XXH64_hash_t +XXH3_len_17to128_64b(const xxh_u8* XXH_RESTRICT input, size_t len, + const xxh_u8* XXH_RESTRICT secret, size_t secretSize, + XXH64_hash_t seed) +{ + XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); (void)secretSize; + XXH_ASSERT(16 < len && len <= 128); + + { xxh_u64 acc = len * XXH_PRIME64_1; + if (len > 32) { + if (len > 64) { + if (len > 96) { + acc += XXH3_mix16B(input+48, secret+96, seed); + acc += XXH3_mix16B(input+len-64, secret+112, seed); + } + acc += XXH3_mix16B(input+32, secret+64, seed); + acc += XXH3_mix16B(input+len-48, secret+80, seed); + } + acc += XXH3_mix16B(input+16, secret+32, seed); + acc += XXH3_mix16B(input+len-32, secret+48, seed); + } + acc += XXH3_mix16B(input+0, secret+0, seed); + acc += XXH3_mix16B(input+len-16, secret+16, seed); + + return XXH3_avalanche(acc); + } +} + +#define XXH3_MIDSIZE_MAX 240 + +XXH_NO_INLINE XXH64_hash_t +XXH3_len_129to240_64b(const xxh_u8* XXH_RESTRICT input, size_t len, + const xxh_u8* XXH_RESTRICT secret, size_t secretSize, + XXH64_hash_t seed) +{ + XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); (void)secretSize; + XXH_ASSERT(128 < len && len <= XXH3_MIDSIZE_MAX); + + #define XXH3_MIDSIZE_STARTOFFSET 3 + #define XXH3_MIDSIZE_LASTOFFSET 17 + + { xxh_u64 acc = len * XXH_PRIME64_1; + int const nbRounds = (int)len / 16; + int i; + for (i=0; i<8; i++) { + acc += XXH3_mix16B(input+(16*i), secret+(16*i), seed); + } + acc = XXH3_avalanche(acc); + XXH_ASSERT(nbRounds >= 8); +#if defined(__clang__) /* Clang */ \ + && (defined(__ARM_NEON) || defined(__ARM_NEON__)) /* NEON */ \ + && !defined(XXH_ENABLE_AUTOVECTORIZE) /* Define to disable */ + /* + * UGLY HACK: + * Clang for ARMv7-A tries to vectorize this loop, similar to GCC x86. + * In everywhere else, it uses scalar code. + * + * For 64->128-bit multiplies, even if the NEON was 100% optimal, it + * would still be slower than UMAAL (see XXH_mult64to128). + * + * Unfortunately, Clang doesn't handle the long multiplies properly and + * converts them to the nonexistent "vmulq_u64" intrinsic, which is then + * scalarized into an ugly mess of VMOV.32 instructions. + * + * This mess is difficult to avoid without turning autovectorization + * off completely, but they are usually relatively minor and/or not + * worth it to fix. + * + * This loop is the easiest to fix, as unlike XXH32, this pragma + * _actually works_ because it is a loop vectorization instead of an + * SLP vectorization. + */ + #pragma clang loop vectorize(disable) +#endif + for (i=8 ; i < nbRounds; i++) { + acc += XXH3_mix16B(input+(16*i), secret+(16*(i-8)) + XXH3_MIDSIZE_STARTOFFSET, seed); + } + /* last bytes */ + acc += XXH3_mix16B(input + len - 16, secret + XXH3_SECRET_SIZE_MIN - XXH3_MIDSIZE_LASTOFFSET, seed); + return XXH3_avalanche(acc); + } +} + + +/* ======= Long Keys ======= */ + +#define XXH_STRIPE_LEN 64 +#define XXH_SECRET_CONSUME_RATE 8 /* nb of secret bytes consumed at each accumulation */ +#define XXH_ACC_NB (XXH_STRIPE_LEN / sizeof(xxh_u64)) + +#ifdef XXH_OLD_NAMES +# define STRIPE_LEN XXH_STRIPE_LEN +# define ACC_NB XXH_ACC_NB +#endif + +XXH_FORCE_INLINE void XXH_writeLE64(void* dst, xxh_u64 v64) +{ + if (!XXH_CPU_LITTLE_ENDIAN) v64 = XXH_swap64(v64); + memcpy(dst, &v64, sizeof(v64)); +} + +/* Several intrinsic functions below are supposed to accept __int64 as argument, + * as documented in https://software.intel.com/sites/landingpage/IntrinsicsGuide/ . + * However, several environments do not define __int64 type, + * requiring a workaround. + */ +#if !defined (__VMS) \ + && (defined (__cplusplus) \ + || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) + typedef int64_t xxh_i64; +#else + /* the following type must have a width of 64-bit */ + typedef long long xxh_i64; +#endif + +/* + * XXH3_accumulate_512 is the tightest loop for long inputs, and it is the most optimized. + * + * It is a hardened version of UMAC, based off of FARSH's implementation. + * + * This was chosen because it adapts quite well to 32-bit, 64-bit, and SIMD + * implementations, and it is ridiculously fast. + * + * We harden it by mixing the original input to the accumulators as well as the product. + * + * This means that in the (relatively likely) case of a multiply by zero, the + * original input is preserved. + * + * On 128-bit inputs, we swap 64-bit pairs when we add the input to improve + * cross-pollination, as otherwise the upper and lower halves would be + * essentially independent. + * + * This doesn't matter on 64-bit hashes since they all get merged together in + * the end, so we skip the extra step. + * + * Both XXH3_64bits and XXH3_128bits use this subroutine. + */ + +#if (XXH_VECTOR == XXH_AVX512) || defined(XXH_X86DISPATCH) + +#ifndef XXH_TARGET_AVX512 +# define XXH_TARGET_AVX512 /* disable attribute target */ +#endif + +XXH_FORCE_INLINE XXH_TARGET_AVX512 void +XXH3_accumulate_512_avx512(void* XXH_RESTRICT acc, + const void* XXH_RESTRICT input, + const void* XXH_RESTRICT secret) +{ + XXH_ALIGN(64) __m512i* const xacc = (__m512i *) acc; + XXH_ASSERT((((size_t)acc) & 63) == 0); + XXH_STATIC_ASSERT(XXH_STRIPE_LEN == sizeof(__m512i)); + + { + /* data_vec = input[0]; */ + __m512i const data_vec = _mm512_loadu_si512 (input); + /* key_vec = secret[0]; */ + __m512i const key_vec = _mm512_loadu_si512 (secret); + /* data_key = data_vec ^ key_vec; */ + __m512i const data_key = _mm512_xor_si512 (data_vec, key_vec); + /* data_key_lo = data_key >> 32; */ + __m512i const data_key_lo = _mm512_shuffle_epi32 (data_key, (_MM_PERM_ENUM)_MM_SHUFFLE(0, 3, 0, 1)); + /* product = (data_key & 0xffffffff) * (data_key_lo & 0xffffffff); */ + __m512i const product = _mm512_mul_epu32 (data_key, data_key_lo); + /* xacc[0] += swap(data_vec); */ + __m512i const data_swap = _mm512_shuffle_epi32(data_vec, (_MM_PERM_ENUM)_MM_SHUFFLE(1, 0, 3, 2)); + __m512i const sum = _mm512_add_epi64(*xacc, data_swap); + /* xacc[0] += product; */ + *xacc = _mm512_add_epi64(product, sum); + } +} + +/* + * XXH3_scrambleAcc: Scrambles the accumulators to improve mixing. + * + * Multiplication isn't perfect, as explained by Google in HighwayHash: + * + * // Multiplication mixes/scrambles bytes 0-7 of the 64-bit result to + * // varying degrees. In descending order of goodness, bytes + * // 3 4 2 5 1 6 0 7 have quality 228 224 164 160 100 96 36 32. + * // As expected, the upper and lower bytes are much worse. + * + * Source: https://github.com/google/highwayhash/blob/0aaf66b/highwayhash/hh_avx2.h#L291 + * + * Since our algorithm uses a pseudorandom secret to add some variance into the + * mix, we don't need to (or want to) mix as often or as much as HighwayHash does. + * + * This isn't as tight as XXH3_accumulate, but still written in SIMD to avoid + * extraction. + * + * Both XXH3_64bits and XXH3_128bits use this subroutine. + */ + +XXH_FORCE_INLINE XXH_TARGET_AVX512 void +XXH3_scrambleAcc_avx512(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) +{ + XXH_ASSERT((((size_t)acc) & 63) == 0); + XXH_STATIC_ASSERT(XXH_STRIPE_LEN == sizeof(__m512i)); + { XXH_ALIGN(64) __m512i* const xacc = (__m512i*) acc; + const __m512i prime32 = _mm512_set1_epi32((int)XXH_PRIME32_1); + + /* xacc[0] ^= (xacc[0] >> 47) */ + __m512i const acc_vec = *xacc; + __m512i const shifted = _mm512_srli_epi64 (acc_vec, 47); + __m512i const data_vec = _mm512_xor_si512 (acc_vec, shifted); + /* xacc[0] ^= secret; */ + __m512i const key_vec = _mm512_loadu_si512 (secret); + __m512i const data_key = _mm512_xor_si512 (data_vec, key_vec); + + /* xacc[0] *= XXH_PRIME32_1; */ + __m512i const data_key_hi = _mm512_shuffle_epi32 (data_key, (_MM_PERM_ENUM)_MM_SHUFFLE(0, 3, 0, 1)); + __m512i const prod_lo = _mm512_mul_epu32 (data_key, prime32); + __m512i const prod_hi = _mm512_mul_epu32 (data_key_hi, prime32); + *xacc = _mm512_add_epi64(prod_lo, _mm512_slli_epi64(prod_hi, 32)); + } +} + +XXH_FORCE_INLINE XXH_TARGET_AVX512 void +XXH3_initCustomSecret_avx512(void* XXH_RESTRICT customSecret, xxh_u64 seed64) +{ + XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE & 63) == 0); + XXH_STATIC_ASSERT(XXH_SEC_ALIGN == 64); + XXH_ASSERT(((size_t)customSecret & 63) == 0); + (void)(&XXH_writeLE64); + { int const nbRounds = XXH_SECRET_DEFAULT_SIZE / sizeof(__m512i); + __m512i const seed = _mm512_mask_set1_epi64(_mm512_set1_epi64((xxh_i64)seed64), 0xAA, -(xxh_i64)seed64); + + XXH_ALIGN(64) const __m512i* const src = (const __m512i*) XXH3_kSecret; + XXH_ALIGN(64) __m512i* const dest = ( __m512i*) customSecret; + int i; + for (i=0; i < nbRounds; ++i) { + /* GCC has a bug, _mm512_stream_load_si512 accepts 'void*', not 'void const*', + * this will warn "discards ‘const’ qualifier". */ + union { + XXH_ALIGN(64) const __m512i* cp; + XXH_ALIGN(64) void* p; + } remote_const_void; + remote_const_void.cp = src + i; + dest[i] = _mm512_add_epi64(_mm512_stream_load_si512(remote_const_void.p), seed); + } } +} + +#endif + +#if (XXH_VECTOR == XXH_AVX2) || defined(XXH_X86DISPATCH) + +#ifndef XXH_TARGET_AVX2 +# define XXH_TARGET_AVX2 /* disable attribute target */ +#endif + +XXH_FORCE_INLINE XXH_TARGET_AVX2 void +XXH3_accumulate_512_avx2( void* XXH_RESTRICT acc, + const void* XXH_RESTRICT input, + const void* XXH_RESTRICT secret) +{ + XXH_ASSERT((((size_t)acc) & 31) == 0); + { XXH_ALIGN(32) __m256i* const xacc = (__m256i *) acc; + /* Unaligned. This is mainly for pointer arithmetic, and because + * _mm256_loadu_si256 requires a const __m256i * pointer for some reason. */ + const __m256i* const xinput = (const __m256i *) input; + /* Unaligned. This is mainly for pointer arithmetic, and because + * _mm256_loadu_si256 requires a const __m256i * pointer for some reason. */ + const __m256i* const xsecret = (const __m256i *) secret; + + size_t i; + for (i=0; i < XXH_STRIPE_LEN/sizeof(__m256i); i++) { + /* data_vec = xinput[i]; */ + __m256i const data_vec = _mm256_loadu_si256 (xinput+i); + /* key_vec = xsecret[i]; */ + __m256i const key_vec = _mm256_loadu_si256 (xsecret+i); + /* data_key = data_vec ^ key_vec; */ + __m256i const data_key = _mm256_xor_si256 (data_vec, key_vec); + /* data_key_lo = data_key >> 32; */ + __m256i const data_key_lo = _mm256_shuffle_epi32 (data_key, _MM_SHUFFLE(0, 3, 0, 1)); + /* product = (data_key & 0xffffffff) * (data_key_lo & 0xffffffff); */ + __m256i const product = _mm256_mul_epu32 (data_key, data_key_lo); + /* xacc[i] += swap(data_vec); */ + __m256i const data_swap = _mm256_shuffle_epi32(data_vec, _MM_SHUFFLE(1, 0, 3, 2)); + __m256i const sum = _mm256_add_epi64(xacc[i], data_swap); + /* xacc[i] += product; */ + xacc[i] = _mm256_add_epi64(product, sum); + } } +} + +XXH_FORCE_INLINE XXH_TARGET_AVX2 void +XXH3_scrambleAcc_avx2(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) +{ + XXH_ASSERT((((size_t)acc) & 31) == 0); + { XXH_ALIGN(32) __m256i* const xacc = (__m256i*) acc; + /* Unaligned. This is mainly for pointer arithmetic, and because + * _mm256_loadu_si256 requires a const __m256i * pointer for some reason. */ + const __m256i* const xsecret = (const __m256i *) secret; + const __m256i prime32 = _mm256_set1_epi32((int)XXH_PRIME32_1); + + size_t i; + for (i=0; i < XXH_STRIPE_LEN/sizeof(__m256i); i++) { + /* xacc[i] ^= (xacc[i] >> 47) */ + __m256i const acc_vec = xacc[i]; + __m256i const shifted = _mm256_srli_epi64 (acc_vec, 47); + __m256i const data_vec = _mm256_xor_si256 (acc_vec, shifted); + /* xacc[i] ^= xsecret; */ + __m256i const key_vec = _mm256_loadu_si256 (xsecret+i); + __m256i const data_key = _mm256_xor_si256 (data_vec, key_vec); + + /* xacc[i] *= XXH_PRIME32_1; */ + __m256i const data_key_hi = _mm256_shuffle_epi32 (data_key, _MM_SHUFFLE(0, 3, 0, 1)); + __m256i const prod_lo = _mm256_mul_epu32 (data_key, prime32); + __m256i const prod_hi = _mm256_mul_epu32 (data_key_hi, prime32); + xacc[i] = _mm256_add_epi64(prod_lo, _mm256_slli_epi64(prod_hi, 32)); + } + } +} + +XXH_FORCE_INLINE XXH_TARGET_AVX2 void XXH3_initCustomSecret_avx2(void* XXH_RESTRICT customSecret, xxh_u64 seed64) +{ + XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE & 31) == 0); + XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE / sizeof(__m256i)) == 6); + XXH_STATIC_ASSERT(XXH_SEC_ALIGN <= 64); + (void)(&XXH_writeLE64); + XXH_PREFETCH(customSecret); + { __m256i const seed = _mm256_set_epi64x(-(xxh_i64)seed64, (xxh_i64)seed64, -(xxh_i64)seed64, (xxh_i64)seed64); + + XXH_ALIGN(64) const __m256i* const src = (const __m256i*) XXH3_kSecret; + XXH_ALIGN(64) __m256i* dest = ( __m256i*) customSecret; + +# if defined(__GNUC__) || defined(__clang__) + /* + * On GCC & Clang, marking 'dest' as modified will cause the compiler: + * - do not extract the secret from sse registers in the internal loop + * - use less common registers, and avoid pushing these reg into stack + * The asm hack causes Clang to assume that XXH3_kSecretPtr aliases with + * customSecret, and on aarch64, this prevented LDP from merging two + * loads together for free. Putting the loads together before the stores + * properly generates LDP. + */ + __asm__("" : "+r" (dest)); +# endif + + /* GCC -O2 need unroll loop manually */ + dest[0] = _mm256_add_epi64(_mm256_stream_load_si256(src+0), seed); + dest[1] = _mm256_add_epi64(_mm256_stream_load_si256(src+1), seed); + dest[2] = _mm256_add_epi64(_mm256_stream_load_si256(src+2), seed); + dest[3] = _mm256_add_epi64(_mm256_stream_load_si256(src+3), seed); + dest[4] = _mm256_add_epi64(_mm256_stream_load_si256(src+4), seed); + dest[5] = _mm256_add_epi64(_mm256_stream_load_si256(src+5), seed); + } +} + +#endif + +#if (XXH_VECTOR == XXH_SSE2) || defined(XXH_X86DISPATCH) + +#ifndef XXH_TARGET_SSE2 +# define XXH_TARGET_SSE2 /* disable attribute target */ +#endif + +XXH_FORCE_INLINE XXH_TARGET_SSE2 void +XXH3_accumulate_512_sse2( void* XXH_RESTRICT acc, + const void* XXH_RESTRICT input, + const void* XXH_RESTRICT secret) +{ + /* SSE2 is just a half-scale version of the AVX2 version. */ + XXH_ASSERT((((size_t)acc) & 15) == 0); + { XXH_ALIGN(16) __m128i* const xacc = (__m128i *) acc; + /* Unaligned. This is mainly for pointer arithmetic, and because + * _mm_loadu_si128 requires a const __m128i * pointer for some reason. */ + const __m128i* const xinput = (const __m128i *) input; + /* Unaligned. This is mainly for pointer arithmetic, and because + * _mm_loadu_si128 requires a const __m128i * pointer for some reason. */ + const __m128i* const xsecret = (const __m128i *) secret; + + size_t i; + for (i=0; i < XXH_STRIPE_LEN/sizeof(__m128i); i++) { + /* data_vec = xinput[i]; */ + __m128i const data_vec = _mm_loadu_si128 (xinput+i); + /* key_vec = xsecret[i]; */ + __m128i const key_vec = _mm_loadu_si128 (xsecret+i); + /* data_key = data_vec ^ key_vec; */ + __m128i const data_key = _mm_xor_si128 (data_vec, key_vec); + /* data_key_lo = data_key >> 32; */ + __m128i const data_key_lo = _mm_shuffle_epi32 (data_key, _MM_SHUFFLE(0, 3, 0, 1)); + /* product = (data_key & 0xffffffff) * (data_key_lo & 0xffffffff); */ + __m128i const product = _mm_mul_epu32 (data_key, data_key_lo); + /* xacc[i] += swap(data_vec); */ + __m128i const data_swap = _mm_shuffle_epi32(data_vec, _MM_SHUFFLE(1,0,3,2)); + __m128i const sum = _mm_add_epi64(xacc[i], data_swap); + /* xacc[i] += product; */ + xacc[i] = _mm_add_epi64(product, sum); + } } +} + +XXH_FORCE_INLINE XXH_TARGET_SSE2 void +XXH3_scrambleAcc_sse2(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) +{ + XXH_ASSERT((((size_t)acc) & 15) == 0); + { XXH_ALIGN(16) __m128i* const xacc = (__m128i*) acc; + /* Unaligned. This is mainly for pointer arithmetic, and because + * _mm_loadu_si128 requires a const __m128i * pointer for some reason. */ + const __m128i* const xsecret = (const __m128i *) secret; + const __m128i prime32 = _mm_set1_epi32((int)XXH_PRIME32_1); + + size_t i; + for (i=0; i < XXH_STRIPE_LEN/sizeof(__m128i); i++) { + /* xacc[i] ^= (xacc[i] >> 47) */ + __m128i const acc_vec = xacc[i]; + __m128i const shifted = _mm_srli_epi64 (acc_vec, 47); + __m128i const data_vec = _mm_xor_si128 (acc_vec, shifted); + /* xacc[i] ^= xsecret[i]; */ + __m128i const key_vec = _mm_loadu_si128 (xsecret+i); + __m128i const data_key = _mm_xor_si128 (data_vec, key_vec); + + /* xacc[i] *= XXH_PRIME32_1; */ + __m128i const data_key_hi = _mm_shuffle_epi32 (data_key, _MM_SHUFFLE(0, 3, 0, 1)); + __m128i const prod_lo = _mm_mul_epu32 (data_key, prime32); + __m128i const prod_hi = _mm_mul_epu32 (data_key_hi, prime32); + xacc[i] = _mm_add_epi64(prod_lo, _mm_slli_epi64(prod_hi, 32)); + } + } +} + +XXH_FORCE_INLINE XXH_TARGET_SSE2 void XXH3_initCustomSecret_sse2(void* XXH_RESTRICT customSecret, xxh_u64 seed64) +{ + XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE & 15) == 0); + (void)(&XXH_writeLE64); + { int const nbRounds = XXH_SECRET_DEFAULT_SIZE / sizeof(__m128i); + +# if defined(_MSC_VER) && defined(_M_IX86) && _MSC_VER < 1900 + // MSVC 32bit mode does not support _mm_set_epi64x before 2015 + XXH_ALIGN(16) const xxh_i64 seed64x2[2] = { (xxh_i64)seed64, -(xxh_i64)seed64 }; + __m128i const seed = _mm_load_si128((__m128i const*)seed64x2); +# else + __m128i const seed = _mm_set_epi64x(-(xxh_i64)seed64, (xxh_i64)seed64); +# endif + int i; + + XXH_ALIGN(64) const float* const src = (float const*) XXH3_kSecret; + XXH_ALIGN(XXH_SEC_ALIGN) __m128i* dest = (__m128i*) customSecret; +# if defined(__GNUC__) || defined(__clang__) + /* + * On GCC & Clang, marking 'dest' as modified will cause the compiler: + * - do not extract the secret from sse registers in the internal loop + * - use less common registers, and avoid pushing these reg into stack + */ + __asm__("" : "+r" (dest)); +# endif + + for (i=0; i < nbRounds; ++i) { + dest[i] = _mm_add_epi64(_mm_castps_si128(_mm_load_ps(src+i*4)), seed); + } } +} + +#endif + +#if (XXH_VECTOR == XXH_NEON) + +XXH_FORCE_INLINE void +XXH3_accumulate_512_neon( void* XXH_RESTRICT acc, + const void* XXH_RESTRICT input, + const void* XXH_RESTRICT secret) +{ + XXH_ASSERT((((size_t)acc) & 15) == 0); + { + XXH_ALIGN(16) uint64x2_t* const xacc = (uint64x2_t *) acc; + /* We don't use a uint32x4_t pointer because it causes bus errors on ARMv7. */ + uint8_t const* const xinput = (const uint8_t *) input; + uint8_t const* const xsecret = (const uint8_t *) secret; + + size_t i; + for (i=0; i < XXH_STRIPE_LEN / sizeof(uint64x2_t); i++) { + /* data_vec = xinput[i]; */ + uint8x16_t data_vec = vld1q_u8(xinput + (i * 16)); + /* key_vec = xsecret[i]; */ + uint8x16_t key_vec = vld1q_u8(xsecret + (i * 16)); + uint64x2_t data_key; + uint32x2_t data_key_lo, data_key_hi; + /* xacc[i] += swap(data_vec); */ + uint64x2_t const data64 = vreinterpretq_u64_u8(data_vec); + uint64x2_t const swapped = vextq_u64(data64, data64, 1); + xacc[i] = vaddq_u64 (xacc[i], swapped); + /* data_key = data_vec ^ key_vec; */ + data_key = vreinterpretq_u64_u8(veorq_u8(data_vec, key_vec)); + /* data_key_lo = (uint32x2_t) (data_key & 0xFFFFFFFF); + * data_key_hi = (uint32x2_t) (data_key >> 32); + * data_key = UNDEFINED; */ + XXH_SPLIT_IN_PLACE(data_key, data_key_lo, data_key_hi); + /* xacc[i] += (uint64x2_t) data_key_lo * (uint64x2_t) data_key_hi; */ + xacc[i] = vmlal_u32 (xacc[i], data_key_lo, data_key_hi); + + } + } +} + +XXH_FORCE_INLINE void +XXH3_scrambleAcc_neon(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) +{ + XXH_ASSERT((((size_t)acc) & 15) == 0); + + { uint64x2_t* xacc = (uint64x2_t*) acc; + uint8_t const* xsecret = (uint8_t const*) secret; + uint32x2_t prime = vdup_n_u32 (XXH_PRIME32_1); + + size_t i; + for (i=0; i < XXH_STRIPE_LEN/sizeof(uint64x2_t); i++) { + /* xacc[i] ^= (xacc[i] >> 47); */ + uint64x2_t acc_vec = xacc[i]; + uint64x2_t shifted = vshrq_n_u64 (acc_vec, 47); + uint64x2_t data_vec = veorq_u64 (acc_vec, shifted); + + /* xacc[i] ^= xsecret[i]; */ + uint8x16_t key_vec = vld1q_u8(xsecret + (i * 16)); + uint64x2_t data_key = veorq_u64(data_vec, vreinterpretq_u64_u8(key_vec)); + + /* xacc[i] *= XXH_PRIME32_1 */ + uint32x2_t data_key_lo, data_key_hi; + /* data_key_lo = (uint32x2_t) (xacc[i] & 0xFFFFFFFF); + * data_key_hi = (uint32x2_t) (xacc[i] >> 32); + * xacc[i] = UNDEFINED; */ + XXH_SPLIT_IN_PLACE(data_key, data_key_lo, data_key_hi); + { /* + * prod_hi = (data_key >> 32) * XXH_PRIME32_1; + * + * Avoid vmul_u32 + vshll_n_u32 since Clang 6 and 7 will + * incorrectly "optimize" this: + * tmp = vmul_u32(vmovn_u64(a), vmovn_u64(b)); + * shifted = vshll_n_u32(tmp, 32); + * to this: + * tmp = "vmulq_u64"(a, b); // no such thing! + * shifted = vshlq_n_u64(tmp, 32); + * + * However, unlike SSE, Clang lacks a 64-bit multiply routine + * for NEON, and it scalarizes two 64-bit multiplies instead. + * + * vmull_u32 has the same timing as vmul_u32, and it avoids + * this bug completely. + * See https://bugs.llvm.org/show_bug.cgi?id=39967 + */ + uint64x2_t prod_hi = vmull_u32 (data_key_hi, prime); + /* xacc[i] = prod_hi << 32; */ + xacc[i] = vshlq_n_u64(prod_hi, 32); + /* xacc[i] += (prod_hi & 0xFFFFFFFF) * XXH_PRIME32_1; */ + xacc[i] = vmlal_u32(xacc[i], data_key_lo, prime); + } + } } +} + +#endif + +#if (XXH_VECTOR == XXH_VSX) + +XXH_FORCE_INLINE void +XXH3_accumulate_512_vsx( void* XXH_RESTRICT acc, + const void* XXH_RESTRICT input, + const void* XXH_RESTRICT secret) +{ + xxh_u64x2* const xacc = (xxh_u64x2*) acc; /* presumed aligned */ + xxh_u64x2 const* const xinput = (xxh_u64x2 const*) input; /* no alignment restriction */ + xxh_u64x2 const* const xsecret = (xxh_u64x2 const*) secret; /* no alignment restriction */ + xxh_u64x2 const v32 = { 32, 32 }; + size_t i; + for (i = 0; i < XXH_STRIPE_LEN / sizeof(xxh_u64x2); i++) { + /* data_vec = xinput[i]; */ + xxh_u64x2 const data_vec = XXH_vec_loadu(xinput + i); + /* key_vec = xsecret[i]; */ + xxh_u64x2 const key_vec = XXH_vec_loadu(xsecret + i); + xxh_u64x2 const data_key = data_vec ^ key_vec; + /* shuffled = (data_key << 32) | (data_key >> 32); */ + xxh_u32x4 const shuffled = (xxh_u32x4)vec_rl(data_key, v32); + /* product = ((xxh_u64x2)data_key & 0xFFFFFFFF) * ((xxh_u64x2)shuffled & 0xFFFFFFFF); */ + xxh_u64x2 const product = XXH_vec_mulo((xxh_u32x4)data_key, shuffled); + xacc[i] += product; + + /* swap high and low halves */ +#ifdef __s390x__ + xacc[i] += vec_permi(data_vec, data_vec, 2); +#else + xacc[i] += vec_xxpermdi(data_vec, data_vec, 2); +#endif + } +} + +XXH_FORCE_INLINE void +XXH3_scrambleAcc_vsx(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) +{ + XXH_ASSERT((((size_t)acc) & 15) == 0); + + { xxh_u64x2* const xacc = (xxh_u64x2*) acc; + const xxh_u64x2* const xsecret = (const xxh_u64x2*) secret; + /* constants */ + xxh_u64x2 const v32 = { 32, 32 }; + xxh_u64x2 const v47 = { 47, 47 }; + xxh_u32x4 const prime = { XXH_PRIME32_1, XXH_PRIME32_1, XXH_PRIME32_1, XXH_PRIME32_1 }; + size_t i; + for (i = 0; i < XXH_STRIPE_LEN / sizeof(xxh_u64x2); i++) { + /* xacc[i] ^= (xacc[i] >> 47); */ + xxh_u64x2 const acc_vec = xacc[i]; + xxh_u64x2 const data_vec = acc_vec ^ (acc_vec >> v47); + + /* xacc[i] ^= xsecret[i]; */ + xxh_u64x2 const key_vec = XXH_vec_loadu(xsecret + i); + xxh_u64x2 const data_key = data_vec ^ key_vec; + + /* xacc[i] *= XXH_PRIME32_1 */ + /* prod_lo = ((xxh_u64x2)data_key & 0xFFFFFFFF) * ((xxh_u64x2)prime & 0xFFFFFFFF); */ + xxh_u64x2 const prod_even = XXH_vec_mule((xxh_u32x4)data_key, prime); + /* prod_hi = ((xxh_u64x2)data_key >> 32) * ((xxh_u64x2)prime >> 32); */ + xxh_u64x2 const prod_odd = XXH_vec_mulo((xxh_u32x4)data_key, prime); + xacc[i] = prod_odd + (prod_even << v32); + } } +} + +#endif + +/* scalar variants - universal */ + +XXH_FORCE_INLINE void +XXH3_accumulate_512_scalar(void* XXH_RESTRICT acc, + const void* XXH_RESTRICT input, + const void* XXH_RESTRICT secret) +{ + XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64* const xacc = (xxh_u64*) acc; /* presumed aligned */ + const xxh_u8* const xinput = (const xxh_u8*) input; /* no alignment restriction */ + const xxh_u8* const xsecret = (const xxh_u8*) secret; /* no alignment restriction */ + size_t i; + XXH_ASSERT(((size_t)acc & (XXH_ACC_ALIGN-1)) == 0); + for (i=0; i < XXH_ACC_NB; i++) { + xxh_u64 const data_val = XXH_readLE64(xinput + 8*i); + xxh_u64 const data_key = data_val ^ XXH_readLE64(xsecret + i*8); + xacc[i ^ 1] += data_val; /* swap adjacent lanes */ + xacc[i] += XXH_mult32to64(data_key & 0xFFFFFFFF, data_key >> 32); + } +} + +XXH_FORCE_INLINE void +XXH3_scrambleAcc_scalar(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) +{ + XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64* const xacc = (xxh_u64*) acc; /* presumed aligned */ + const xxh_u8* const xsecret = (const xxh_u8*) secret; /* no alignment restriction */ + size_t i; + XXH_ASSERT((((size_t)acc) & (XXH_ACC_ALIGN-1)) == 0); + for (i=0; i < XXH_ACC_NB; i++) { + xxh_u64 const key64 = XXH_readLE64(xsecret + 8*i); + xxh_u64 acc64 = xacc[i]; + acc64 = XXH_xorshift64(acc64, 47); + acc64 ^= key64; + acc64 *= XXH_PRIME32_1; + xacc[i] = acc64; + } +} + +XXH_FORCE_INLINE void +XXH3_initCustomSecret_scalar(void* XXH_RESTRICT customSecret, xxh_u64 seed64) +{ + /* + * We need a separate pointer for the hack below, + * which requires a non-const pointer. + * Any decent compiler will optimize this out otherwise. + */ + const xxh_u8* kSecretPtr = XXH3_kSecret; + XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE & 15) == 0); + +#if defined(__clang__) && defined(__aarch64__) + /* + * UGLY HACK: + * Clang generates a bunch of MOV/MOVK pairs for aarch64, and they are + * placed sequentially, in order, at the top of the unrolled loop. + * + * While MOVK is great for generating constants (2 cycles for a 64-bit + * constant compared to 4 cycles for LDR), long MOVK chains stall the + * integer pipelines: + * I L S + * MOVK + * MOVK + * MOVK + * MOVK + * ADD + * SUB STR + * STR + * By forcing loads from memory (as the asm line causes Clang to assume + * that XXH3_kSecretPtr has been changed), the pipelines are used more + * efficiently: + * I L S + * LDR + * ADD LDR + * SUB STR + * STR + * XXH3_64bits_withSeed, len == 256, Snapdragon 835 + * without hack: 2654.4 MB/s + * with hack: 3202.9 MB/s + */ + __asm__("" : "+r" (kSecretPtr)); +#endif + /* + * Note: in debug mode, this overrides the asm optimization + * and Clang will emit MOVK chains again. + */ + XXH_ASSERT(kSecretPtr == XXH3_kSecret); + + { int const nbRounds = XXH_SECRET_DEFAULT_SIZE / 16; + int i; + for (i=0; i < nbRounds; i++) { + /* + * The asm hack causes Clang to assume that kSecretPtr aliases with + * customSecret, and on aarch64, this prevented LDP from merging two + * loads together for free. Putting the loads together before the stores + * properly generates LDP. + */ + xxh_u64 lo = XXH_readLE64(kSecretPtr + 16*i) + seed64; + xxh_u64 hi = XXH_readLE64(kSecretPtr + 16*i + 8) - seed64; + XXH_writeLE64((xxh_u8*)customSecret + 16*i, lo); + XXH_writeLE64((xxh_u8*)customSecret + 16*i + 8, hi); + } } +} + + +typedef void (*XXH3_f_accumulate_512)(void* XXH_RESTRICT, const void*, const void*); +typedef void (*XXH3_f_scrambleAcc)(void* XXH_RESTRICT, const void*); +typedef void (*XXH3_f_initCustomSecret)(void* XXH_RESTRICT, xxh_u64); + + +#if (XXH_VECTOR == XXH_AVX512) + +#define XXH3_accumulate_512 XXH3_accumulate_512_avx512 +#define XXH3_scrambleAcc XXH3_scrambleAcc_avx512 +#define XXH3_initCustomSecret XXH3_initCustomSecret_avx512 + +#elif (XXH_VECTOR == XXH_AVX2) + +#define XXH3_accumulate_512 XXH3_accumulate_512_avx2 +#define XXH3_scrambleAcc XXH3_scrambleAcc_avx2 +#define XXH3_initCustomSecret XXH3_initCustomSecret_avx2 + +#elif (XXH_VECTOR == XXH_SSE2) + +#define XXH3_accumulate_512 XXH3_accumulate_512_sse2 +#define XXH3_scrambleAcc XXH3_scrambleAcc_sse2 +#define XXH3_initCustomSecret XXH3_initCustomSecret_sse2 + +#elif (XXH_VECTOR == XXH_NEON) + +#define XXH3_accumulate_512 XXH3_accumulate_512_neon +#define XXH3_scrambleAcc XXH3_scrambleAcc_neon +#define XXH3_initCustomSecret XXH3_initCustomSecret_scalar + +#elif (XXH_VECTOR == XXH_VSX) + +#define XXH3_accumulate_512 XXH3_accumulate_512_vsx +#define XXH3_scrambleAcc XXH3_scrambleAcc_vsx +#define XXH3_initCustomSecret XXH3_initCustomSecret_scalar + +#else /* scalar */ + +#define XXH3_accumulate_512 XXH3_accumulate_512_scalar +#define XXH3_scrambleAcc XXH3_scrambleAcc_scalar +#define XXH3_initCustomSecret XXH3_initCustomSecret_scalar + +#endif + + + +#ifndef XXH_PREFETCH_DIST +# ifdef __clang__ +# define XXH_PREFETCH_DIST 320 +# else +# if (XXH_VECTOR == XXH_AVX512) +# define XXH_PREFETCH_DIST 512 +# else +# define XXH_PREFETCH_DIST 384 +# endif +# endif /* __clang__ */ +#endif /* XXH_PREFETCH_DIST */ + +/* + * XXH3_accumulate() + * Loops over XXH3_accumulate_512(). + * Assumption: nbStripes will not overflow the secret size + */ +XXH_FORCE_INLINE void +XXH3_accumulate( xxh_u64* XXH_RESTRICT acc, + const xxh_u8* XXH_RESTRICT input, + const xxh_u8* XXH_RESTRICT secret, + size_t nbStripes, + XXH3_f_accumulate_512 f_acc512) +{ + size_t n; + for (n = 0; n < nbStripes; n++ ) { + const xxh_u8* const in = input + n*XXH_STRIPE_LEN; + XXH_PREFETCH(in + XXH_PREFETCH_DIST); + f_acc512(acc, + in, + secret + n*XXH_SECRET_CONSUME_RATE); + } +} + +XXH_FORCE_INLINE void +XXH3_hashLong_internal_loop(xxh_u64* XXH_RESTRICT acc, + const xxh_u8* XXH_RESTRICT input, size_t len, + const xxh_u8* XXH_RESTRICT secret, size_t secretSize, + XXH3_f_accumulate_512 f_acc512, + XXH3_f_scrambleAcc f_scramble) +{ + size_t const nbStripesPerBlock = (secretSize - XXH_STRIPE_LEN) / XXH_SECRET_CONSUME_RATE; + size_t const block_len = XXH_STRIPE_LEN * nbStripesPerBlock; + size_t const nb_blocks = (len - 1) / block_len; + + size_t n; + + XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); + + for (n = 0; n < nb_blocks; n++) { + XXH3_accumulate(acc, input + n*block_len, secret, nbStripesPerBlock, f_acc512); + f_scramble(acc, secret + secretSize - XXH_STRIPE_LEN); + } + + /* last partial block */ + XXH_ASSERT(len > XXH_STRIPE_LEN); + { size_t const nbStripes = ((len - 1) - (block_len * nb_blocks)) / XXH_STRIPE_LEN; + XXH_ASSERT(nbStripes <= (secretSize / XXH_SECRET_CONSUME_RATE)); + XXH3_accumulate(acc, input + nb_blocks*block_len, secret, nbStripes, f_acc512); + + /* last stripe */ + { const xxh_u8* const p = input + len - XXH_STRIPE_LEN; +#define XXH_SECRET_LASTACC_START 7 /* not aligned on 8, last secret is different from acc & scrambler */ + f_acc512(acc, p, secret + secretSize - XXH_STRIPE_LEN - XXH_SECRET_LASTACC_START); + } } +} + +XXH_FORCE_INLINE xxh_u64 +XXH3_mix2Accs(const xxh_u64* XXH_RESTRICT acc, const xxh_u8* XXH_RESTRICT secret) +{ + return XXH3_mul128_fold64( + acc[0] ^ XXH_readLE64(secret), + acc[1] ^ XXH_readLE64(secret+8) ); +} + +static XXH64_hash_t +XXH3_mergeAccs(const xxh_u64* XXH_RESTRICT acc, const xxh_u8* XXH_RESTRICT secret, xxh_u64 start) +{ + xxh_u64 result64 = start; + size_t i = 0; + + for (i = 0; i < 4; i++) { + result64 += XXH3_mix2Accs(acc+2*i, secret + 16*i); +#if defined(__clang__) /* Clang */ \ + && (defined(__arm__) || defined(__thumb__)) /* ARMv7 */ \ + && (defined(__ARM_NEON) || defined(__ARM_NEON__)) /* NEON */ \ + && !defined(XXH_ENABLE_AUTOVECTORIZE) /* Define to disable */ + /* + * UGLY HACK: + * Prevent autovectorization on Clang ARMv7-a. Exact same problem as + * the one in XXH3_len_129to240_64b. Speeds up shorter keys > 240b. + * XXH3_64bits, len == 256, Snapdragon 835: + * without hack: 2063.7 MB/s + * with hack: 2560.7 MB/s + */ + __asm__("" : "+r" (result64)); +#endif + } + + return XXH3_avalanche(result64); +} + +#define XXH3_INIT_ACC { XXH_PRIME32_3, XXH_PRIME64_1, XXH_PRIME64_2, XXH_PRIME64_3, \ + XXH_PRIME64_4, XXH_PRIME32_2, XXH_PRIME64_5, XXH_PRIME32_1 } + +XXH_FORCE_INLINE XXH64_hash_t +XXH3_hashLong_64b_internal(const void* XXH_RESTRICT input, size_t len, + const void* XXH_RESTRICT secret, size_t secretSize, + XXH3_f_accumulate_512 f_acc512, + XXH3_f_scrambleAcc f_scramble) +{ + XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64 acc[XXH_ACC_NB] = XXH3_INIT_ACC; + + XXH3_hashLong_internal_loop(acc, (const xxh_u8*)input, len, (const xxh_u8*)secret, secretSize, f_acc512, f_scramble); + + /* converge into final hash */ + XXH_STATIC_ASSERT(sizeof(acc) == 64); + /* do not align on 8, so that the secret is different from the accumulator */ +#define XXH_SECRET_MERGEACCS_START 11 + XXH_ASSERT(secretSize >= sizeof(acc) + XXH_SECRET_MERGEACCS_START); + return XXH3_mergeAccs(acc, (const xxh_u8*)secret + XXH_SECRET_MERGEACCS_START, (xxh_u64)len * XXH_PRIME64_1); +} + +/* + * It's important for performance that XXH3_hashLong is not inlined. + */ +XXH_NO_INLINE XXH64_hash_t +XXH3_hashLong_64b_withSecret(const void* XXH_RESTRICT input, size_t len, + XXH64_hash_t seed64, const xxh_u8* XXH_RESTRICT secret, size_t secretLen) +{ + (void)seed64; + return XXH3_hashLong_64b_internal(input, len, secret, secretLen, XXH3_accumulate_512, XXH3_scrambleAcc); +} + +/* + * It's important for performance that XXH3_hashLong is not inlined. + * Since the function is not inlined, the compiler may not be able to understand that, + * in some scenarios, its `secret` argument is actually a compile time constant. + * This variant enforces that the compiler can detect that, + * and uses this opportunity to streamline the generated code for better performance. + */ +XXH_NO_INLINE XXH64_hash_t +XXH3_hashLong_64b_default(const void* XXH_RESTRICT input, size_t len, + XXH64_hash_t seed64, const xxh_u8* XXH_RESTRICT secret, size_t secretLen) +{ + (void)seed64; (void)secret; (void)secretLen; + return XXH3_hashLong_64b_internal(input, len, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_accumulate_512, XXH3_scrambleAcc); +} + +/* + * XXH3_hashLong_64b_withSeed(): + * Generate a custom key based on alteration of default XXH3_kSecret with the seed, + * and then use this key for long mode hashing. + * + * This operation is decently fast but nonetheless costs a little bit of time. + * Try to avoid it whenever possible (typically when seed==0). + * + * It's important for performance that XXH3_hashLong is not inlined. Not sure + * why (uop cache maybe?), but the difference is large and easily measurable. + */ +XXH_FORCE_INLINE XXH64_hash_t +XXH3_hashLong_64b_withSeed_internal(const void* input, size_t len, + XXH64_hash_t seed, + XXH3_f_accumulate_512 f_acc512, + XXH3_f_scrambleAcc f_scramble, + XXH3_f_initCustomSecret f_initSec) +{ + if (seed == 0) + return XXH3_hashLong_64b_internal(input, len, + XXH3_kSecret, sizeof(XXH3_kSecret), + f_acc512, f_scramble); + { XXH_ALIGN(XXH_SEC_ALIGN) xxh_u8 secret[XXH_SECRET_DEFAULT_SIZE]; + f_initSec(secret, seed); + return XXH3_hashLong_64b_internal(input, len, secret, sizeof(secret), + f_acc512, f_scramble); + } +} + +/* + * It's important for performance that XXH3_hashLong is not inlined. + */ +XXH_NO_INLINE XXH64_hash_t +XXH3_hashLong_64b_withSeed(const void* input, size_t len, + XXH64_hash_t seed, const xxh_u8* secret, size_t secretLen) +{ + (void)secret; (void)secretLen; + return XXH3_hashLong_64b_withSeed_internal(input, len, seed, + XXH3_accumulate_512, XXH3_scrambleAcc, XXH3_initCustomSecret); +} + + +typedef XXH64_hash_t (*XXH3_hashLong64_f)(const void* XXH_RESTRICT, size_t, + XXH64_hash_t, const xxh_u8* XXH_RESTRICT, size_t); + +XXH_FORCE_INLINE XXH64_hash_t +XXH3_64bits_internal(const void* XXH_RESTRICT input, size_t len, + XXH64_hash_t seed64, const void* XXH_RESTRICT secret, size_t secretLen, + XXH3_hashLong64_f f_hashLong) +{ + XXH_ASSERT(secretLen >= XXH3_SECRET_SIZE_MIN); + /* + * If an action is to be taken if `secretLen` condition is not respected, + * it should be done here. + * For now, it's a contract pre-condition. + * Adding a check and a branch here would cost performance at every hash. + * Also, note that function signature doesn't offer room to return an error. + */ + if (len <= 16) + return XXH3_len_0to16_64b((const xxh_u8*)input, len, (const xxh_u8*)secret, seed64); + if (len <= 128) + return XXH3_len_17to128_64b((const xxh_u8*)input, len, (const xxh_u8*)secret, secretLen, seed64); + if (len <= XXH3_MIDSIZE_MAX) + return XXH3_len_129to240_64b((const xxh_u8*)input, len, (const xxh_u8*)secret, secretLen, seed64); + return f_hashLong(input, len, seed64, (const xxh_u8*)secret, secretLen); +} + + +/* === Public entry point === */ + +XXH_PUBLIC_API XXH64_hash_t XXH3_64bits(const void* input, size_t len) +{ + return XXH3_64bits_internal(input, len, 0, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_64b_default); +} + +XXH_PUBLIC_API XXH64_hash_t +XXH3_64bits_withSecret(const void* input, size_t len, const void* secret, size_t secretSize) +{ + return XXH3_64bits_internal(input, len, 0, secret, secretSize, XXH3_hashLong_64b_withSecret); +} + +XXH_PUBLIC_API XXH64_hash_t +XXH3_64bits_withSeed(const void* input, size_t len, XXH64_hash_t seed) +{ + return XXH3_64bits_internal(input, len, seed, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_64b_withSeed); +} + + +/* === XXH3 streaming === */ + +/* + * Malloc's a pointer that is always aligned to align. + * + * This must be freed with `XXH_alignedFree()`. + * + * malloc typically guarantees 16 byte alignment on 64-bit systems and 8 byte + * alignment on 32-bit. This isn't enough for the 32 byte aligned loads in AVX2 + * or on 32-bit, the 16 byte aligned loads in SSE2 and NEON. + * + * This underalignment previously caused a rather obvious crash which went + * completely unnoticed due to XXH3_createState() not actually being tested. + * Credit to RedSpah for noticing this bug. + * + * The alignment is done manually: Functions like posix_memalign or _mm_malloc + * are avoided: To maintain portability, we would have to write a fallback + * like this anyways, and besides, testing for the existence of library + * functions without relying on external build tools is impossible. + * + * The method is simple: Overallocate, manually align, and store the offset + * to the original behind the returned pointer. + * + * Align must be a power of 2 and 8 <= align <= 128. + */ +static void* XXH_alignedMalloc(size_t s, size_t align) +{ + XXH_ASSERT(align <= 128 && align >= 8); /* range check */ + XXH_ASSERT((align & (align-1)) == 0); /* power of 2 */ + XXH_ASSERT(s != 0 && s < (s + align)); /* empty/overflow */ + { /* Overallocate to make room for manual realignment and an offset byte */ + xxh_u8* base = (xxh_u8*)XXH_malloc(s + align); + if (base != NULL) { + /* + * Get the offset needed to align this pointer. + * + * Even if the returned pointer is aligned, there will always be + * at least one byte to store the offset to the original pointer. + */ + size_t offset = align - ((size_t)base & (align - 1)); /* base % align */ + /* Add the offset for the now-aligned pointer */ + xxh_u8* ptr = base + offset; + + XXH_ASSERT((size_t)ptr % align == 0); + + /* Store the offset immediately before the returned pointer. */ + ptr[-1] = (xxh_u8)offset; + return ptr; + } + return NULL; + } +} +/* + * Frees an aligned pointer allocated by XXH_alignedMalloc(). Don't pass + * normal malloc'd pointers, XXH_alignedMalloc has a specific data layout. + */ +static void XXH_alignedFree(void* p) +{ + if (p != NULL) { + xxh_u8* ptr = (xxh_u8*)p; + /* Get the offset byte we added in XXH_malloc. */ + xxh_u8 offset = ptr[-1]; + /* Free the original malloc'd pointer */ + xxh_u8* base = ptr - offset; + XXH_free(base); + } +} +XXH_PUBLIC_API XXH3_state_t* XXH3_createState(void) +{ + XXH3_state_t* const state = (XXH3_state_t*)XXH_alignedMalloc(sizeof(XXH3_state_t), 64); + if (state==NULL) return NULL; + XXH3_INITSTATE(state); + return state; +} + +XXH_PUBLIC_API XXH_errorcode XXH3_freeState(XXH3_state_t* statePtr) +{ + XXH_alignedFree(statePtr); + return XXH_OK; +} + +XXH_PUBLIC_API void +XXH3_copyState(XXH3_state_t* dst_state, const XXH3_state_t* src_state) +{ + memcpy(dst_state, src_state, sizeof(*dst_state)); +} + +static void +XXH3_64bits_reset_internal(XXH3_state_t* statePtr, + XXH64_hash_t seed, + const void* secret, size_t secretSize) +{ + size_t const initStart = offsetof(XXH3_state_t, bufferedSize); + size_t const initLength = offsetof(XXH3_state_t, nbStripesPerBlock) - initStart; + XXH_ASSERT(offsetof(XXH3_state_t, nbStripesPerBlock) > initStart); + XXH_ASSERT(statePtr != NULL); + /* set members from bufferedSize to nbStripesPerBlock (excluded) to 0 */ + memset((char*)statePtr + initStart, 0, initLength); + statePtr->acc[0] = XXH_PRIME32_3; + statePtr->acc[1] = XXH_PRIME64_1; + statePtr->acc[2] = XXH_PRIME64_2; + statePtr->acc[3] = XXH_PRIME64_3; + statePtr->acc[4] = XXH_PRIME64_4; + statePtr->acc[5] = XXH_PRIME32_2; + statePtr->acc[6] = XXH_PRIME64_5; + statePtr->acc[7] = XXH_PRIME32_1; + statePtr->seed = seed; + statePtr->extSecret = (const unsigned char*)secret; + XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); + statePtr->secretLimit = secretSize - XXH_STRIPE_LEN; + statePtr->nbStripesPerBlock = statePtr->secretLimit / XXH_SECRET_CONSUME_RATE; +} + +XXH_PUBLIC_API XXH_errorcode +XXH3_64bits_reset(XXH3_state_t* statePtr) +{ + if (statePtr == NULL) return XXH_ERROR; + XXH3_64bits_reset_internal(statePtr, 0, XXH3_kSecret, XXH_SECRET_DEFAULT_SIZE); + return XXH_OK; +} + +XXH_PUBLIC_API XXH_errorcode +XXH3_64bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t secretSize) +{ + if (statePtr == NULL) return XXH_ERROR; + XXH3_64bits_reset_internal(statePtr, 0, secret, secretSize); + if (secret == NULL) return XXH_ERROR; + if (secretSize < XXH3_SECRET_SIZE_MIN) return XXH_ERROR; + return XXH_OK; +} + +XXH_PUBLIC_API XXH_errorcode +XXH3_64bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed) +{ + if (statePtr == NULL) return XXH_ERROR; + if (seed==0) return XXH3_64bits_reset(statePtr); + if (seed != statePtr->seed) XXH3_initCustomSecret(statePtr->customSecret, seed); + XXH3_64bits_reset_internal(statePtr, seed, NULL, XXH_SECRET_DEFAULT_SIZE); + return XXH_OK; +} + +/* Note : when XXH3_consumeStripes() is invoked, + * there must be a guarantee that at least one more byte must be consumed from input + * so that the function can blindly consume all stripes using the "normal" secret segment */ +XXH_FORCE_INLINE void +XXH3_consumeStripes(xxh_u64* XXH_RESTRICT acc, + size_t* XXH_RESTRICT nbStripesSoFarPtr, size_t nbStripesPerBlock, + const xxh_u8* XXH_RESTRICT input, size_t nbStripes, + const xxh_u8* XXH_RESTRICT secret, size_t secretLimit, + XXH3_f_accumulate_512 f_acc512, + XXH3_f_scrambleAcc f_scramble) +{ + XXH_ASSERT(nbStripes <= nbStripesPerBlock); /* can handle max 1 scramble per invocation */ + XXH_ASSERT(*nbStripesSoFarPtr < nbStripesPerBlock); + if (nbStripesPerBlock - *nbStripesSoFarPtr <= nbStripes) { + /* need a scrambling operation */ + size_t const nbStripesToEndofBlock = nbStripesPerBlock - *nbStripesSoFarPtr; + size_t const nbStripesAfterBlock = nbStripes - nbStripesToEndofBlock; + XXH3_accumulate(acc, input, secret + nbStripesSoFarPtr[0] * XXH_SECRET_CONSUME_RATE, nbStripesToEndofBlock, f_acc512); + f_scramble(acc, secret + secretLimit); + XXH3_accumulate(acc, input + nbStripesToEndofBlock * XXH_STRIPE_LEN, secret, nbStripesAfterBlock, f_acc512); + *nbStripesSoFarPtr = nbStripesAfterBlock; + } else { + XXH3_accumulate(acc, input, secret + nbStripesSoFarPtr[0] * XXH_SECRET_CONSUME_RATE, nbStripes, f_acc512); + *nbStripesSoFarPtr += nbStripes; + } +} + +/* + * Both XXH3_64bits_update and XXH3_128bits_update use this routine. + */ +XXH_FORCE_INLINE XXH_errorcode +XXH3_update(XXH3_state_t* state, + const xxh_u8* input, size_t len, + XXH3_f_accumulate_512 f_acc512, + XXH3_f_scrambleAcc f_scramble) +{ + if (input==NULL) +#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) && (XXH_ACCEPT_NULL_INPUT_POINTER>=1) + return XXH_OK; +#else + return XXH_ERROR; +#endif + + { const xxh_u8* const bEnd = input + len; + const unsigned char* const secret = (state->extSecret == NULL) ? state->customSecret : state->extSecret; + + state->totalLen += len; + + if (state->bufferedSize + len <= XXH3_INTERNALBUFFER_SIZE) { /* fill in tmp buffer */ + XXH_memcpy(state->buffer + state->bufferedSize, input, len); + state->bufferedSize += (XXH32_hash_t)len; + return XXH_OK; + } + /* total input is now > XXH3_INTERNALBUFFER_SIZE */ + + #define XXH3_INTERNALBUFFER_STRIPES (XXH3_INTERNALBUFFER_SIZE / XXH_STRIPE_LEN) + XXH_STATIC_ASSERT(XXH3_INTERNALBUFFER_SIZE % XXH_STRIPE_LEN == 0); /* clean multiple */ + + /* + * Internal buffer is partially filled (always, except at beginning) + * Complete it, then consume it. + */ + if (state->bufferedSize) { + size_t const loadSize = XXH3_INTERNALBUFFER_SIZE - state->bufferedSize; + XXH_memcpy(state->buffer + state->bufferedSize, input, loadSize); + input += loadSize; + XXH3_consumeStripes(state->acc, + &state->nbStripesSoFar, state->nbStripesPerBlock, + state->buffer, XXH3_INTERNALBUFFER_STRIPES, + secret, state->secretLimit, + f_acc512, f_scramble); + state->bufferedSize = 0; + } + XXH_ASSERT(input < bEnd); + + /* Consume input by a multiple of internal buffer size */ + if (input+XXH3_INTERNALBUFFER_SIZE < bEnd) { + const xxh_u8* const limit = bEnd - XXH3_INTERNALBUFFER_SIZE; + do { + XXH3_consumeStripes(state->acc, + &state->nbStripesSoFar, state->nbStripesPerBlock, + input, XXH3_INTERNALBUFFER_STRIPES, + secret, state->secretLimit, + f_acc512, f_scramble); + input += XXH3_INTERNALBUFFER_SIZE; + } while (input<limit); + /* for last partial stripe */ + memcpy(state->buffer + sizeof(state->buffer) - XXH_STRIPE_LEN, input - XXH_STRIPE_LEN, XXH_STRIPE_LEN); + } + XXH_ASSERT(input < bEnd); + + /* Some remaining input (always) : buffer it */ + XXH_memcpy(state->buffer, input, (size_t)(bEnd-input)); + state->bufferedSize = (XXH32_hash_t)(bEnd-input); + } + + return XXH_OK; +} + +XXH_PUBLIC_API XXH_errorcode +XXH3_64bits_update(XXH3_state_t* state, const void* input, size_t len) +{ + return XXH3_update(state, (const xxh_u8*)input, len, + XXH3_accumulate_512, XXH3_scrambleAcc); +} + + +XXH_FORCE_INLINE void +XXH3_digest_long (XXH64_hash_t* acc, + const XXH3_state_t* state, + const unsigned char* secret) +{ + /* + * Digest on a local copy. This way, the state remains unaltered, and it can + * continue ingesting more input afterwards. + */ + memcpy(acc, state->acc, sizeof(state->acc)); + if (state->bufferedSize >= XXH_STRIPE_LEN) { + size_t const nbStripes = (state->bufferedSize - 1) / XXH_STRIPE_LEN; + size_t nbStripesSoFar = state->nbStripesSoFar; + XXH3_consumeStripes(acc, + &nbStripesSoFar, state->nbStripesPerBlock, + state->buffer, nbStripes, + secret, state->secretLimit, + XXH3_accumulate_512, XXH3_scrambleAcc); + /* last stripe */ + XXH3_accumulate_512(acc, + state->buffer + state->bufferedSize - XXH_STRIPE_LEN, + secret + state->secretLimit - XXH_SECRET_LASTACC_START); + } else { /* bufferedSize < XXH_STRIPE_LEN */ + xxh_u8 lastStripe[XXH_STRIPE_LEN]; + size_t const catchupSize = XXH_STRIPE_LEN - state->bufferedSize; + XXH_ASSERT(state->bufferedSize > 0); /* there is always some input buffered */ + memcpy(lastStripe, state->buffer + sizeof(state->buffer) - catchupSize, catchupSize); + memcpy(lastStripe + catchupSize, state->buffer, state->bufferedSize); + XXH3_accumulate_512(acc, + lastStripe, + secret + state->secretLimit - XXH_SECRET_LASTACC_START); + } +} + +XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_digest (const XXH3_state_t* state) +{ + const unsigned char* const secret = (state->extSecret == NULL) ? state->customSecret : state->extSecret; + if (state->totalLen > XXH3_MIDSIZE_MAX) { + XXH_ALIGN(XXH_ACC_ALIGN) XXH64_hash_t acc[XXH_ACC_NB]; + XXH3_digest_long(acc, state, secret); + return XXH3_mergeAccs(acc, + secret + XXH_SECRET_MERGEACCS_START, + (xxh_u64)state->totalLen * XXH_PRIME64_1); + } + /* totalLen <= XXH3_MIDSIZE_MAX: digesting a short input */ + if (state->seed) + return XXH3_64bits_withSeed(state->buffer, (size_t)state->totalLen, state->seed); + return XXH3_64bits_withSecret(state->buffer, (size_t)(state->totalLen), + secret, state->secretLimit + XXH_STRIPE_LEN); +} + + +#define XXH_MIN(x, y) (((x) > (y)) ? (y) : (x)) + +XXH_PUBLIC_API void +XXH3_generateSecret(void* secretBuffer, const void* customSeed, size_t customSeedSize) +{ + XXH_ASSERT(secretBuffer != NULL); + if (customSeedSize == 0) { + memcpy(secretBuffer, XXH3_kSecret, XXH_SECRET_DEFAULT_SIZE); + return; + } + XXH_ASSERT(customSeed != NULL); + + { size_t const segmentSize = sizeof(XXH128_hash_t); + size_t const nbSegments = XXH_SECRET_DEFAULT_SIZE / segmentSize; + XXH128_canonical_t scrambler; + XXH64_hash_t seeds[12]; + size_t segnb; + XXH_ASSERT(nbSegments == 12); + XXH_ASSERT(segmentSize * nbSegments == XXH_SECRET_DEFAULT_SIZE); /* exact multiple */ + XXH128_canonicalFromHash(&scrambler, XXH128(customSeed, customSeedSize, 0)); + + /* + * Copy customSeed to seeds[], truncating or repeating as necessary. + */ + { size_t toFill = XXH_MIN(customSeedSize, sizeof(seeds)); + size_t filled = toFill; + memcpy(seeds, customSeed, toFill); + while (filled < sizeof(seeds)) { + toFill = XXH_MIN(filled, sizeof(seeds) - filled); + memcpy((char*)seeds + filled, seeds, toFill); + filled += toFill; + } } + + /* generate secret */ + memcpy(secretBuffer, &scrambler, sizeof(scrambler)); + for (segnb=1; segnb < nbSegments; segnb++) { + size_t const segmentStart = segnb * segmentSize; + XXH128_canonical_t segment; + XXH128_canonicalFromHash(&segment, + XXH128(&scrambler, sizeof(scrambler), XXH_readLE64(seeds + segnb) + segnb) ); + memcpy((char*)secretBuffer + segmentStart, &segment, sizeof(segment)); + } } +} + + +/* ========================================== + * XXH3 128 bits (a.k.a XXH128) + * ========================================== + * XXH3's 128-bit variant has better mixing and strength than the 64-bit variant, + * even without counting the significantly larger output size. + * + * For example, extra steps are taken to avoid the seed-dependent collisions + * in 17-240 byte inputs (See XXH3_mix16B and XXH128_mix32B). + * + * This strength naturally comes at the cost of some speed, especially on short + * lengths. Note that longer hashes are about as fast as the 64-bit version + * due to it using only a slight modification of the 64-bit loop. + * + * XXH128 is also more oriented towards 64-bit machines. It is still extremely + * fast for a _128-bit_ hash on 32-bit (it usually clears XXH64). + */ + +XXH_FORCE_INLINE XXH128_hash_t +XXH3_len_1to3_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) +{ + /* A doubled version of 1to3_64b with different constants. */ + XXH_ASSERT(input != NULL); + XXH_ASSERT(1 <= len && len <= 3); + XXH_ASSERT(secret != NULL); + /* + * len = 1: combinedl = { input[0], 0x01, input[0], input[0] } + * len = 2: combinedl = { input[1], 0x02, input[0], input[1] } + * len = 3: combinedl = { input[2], 0x03, input[0], input[1] } + */ + { xxh_u8 const c1 = input[0]; + xxh_u8 const c2 = input[len >> 1]; + xxh_u8 const c3 = input[len - 1]; + xxh_u32 const combinedl = ((xxh_u32)c1 <<16) | ((xxh_u32)c2 << 24) + | ((xxh_u32)c3 << 0) | ((xxh_u32)len << 8); + xxh_u32 const combinedh = XXH_rotl32(XXH_swap32(combinedl), 13); + xxh_u64 const bitflipl = (XXH_readLE32(secret) ^ XXH_readLE32(secret+4)) + seed; + xxh_u64 const bitfliph = (XXH_readLE32(secret+8) ^ XXH_readLE32(secret+12)) - seed; + xxh_u64 const keyed_lo = (xxh_u64)combinedl ^ bitflipl; + xxh_u64 const keyed_hi = (xxh_u64)combinedh ^ bitfliph; + XXH128_hash_t h128; + h128.low64 = XXH64_avalanche(keyed_lo); + h128.high64 = XXH64_avalanche(keyed_hi); + return h128; + } +} + +XXH_FORCE_INLINE XXH128_hash_t +XXH3_len_4to8_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) +{ + XXH_ASSERT(input != NULL); + XXH_ASSERT(secret != NULL); + XXH_ASSERT(4 <= len && len <= 8); + seed ^= (xxh_u64)XXH_swap32((xxh_u32)seed) << 32; + { xxh_u32 const input_lo = XXH_readLE32(input); + xxh_u32 const input_hi = XXH_readLE32(input + len - 4); + xxh_u64 const input_64 = input_lo + ((xxh_u64)input_hi << 32); + xxh_u64 const bitflip = (XXH_readLE64(secret+16) ^ XXH_readLE64(secret+24)) + seed; + xxh_u64 const keyed = input_64 ^ bitflip; + + /* Shift len to the left to ensure it is even, this avoids even multiplies. */ + XXH128_hash_t m128 = XXH_mult64to128(keyed, XXH_PRIME64_1 + (len << 2)); + + m128.high64 += (m128.low64 << 1); + m128.low64 ^= (m128.high64 >> 3); + + m128.low64 = XXH_xorshift64(m128.low64, 35); + m128.low64 *= 0x9FB21C651E98DF25ULL; + m128.low64 = XXH_xorshift64(m128.low64, 28); + m128.high64 = XXH3_avalanche(m128.high64); + return m128; + } +} + +XXH_FORCE_INLINE XXH128_hash_t +XXH3_len_9to16_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) +{ + XXH_ASSERT(input != NULL); + XXH_ASSERT(secret != NULL); + XXH_ASSERT(9 <= len && len <= 16); + { xxh_u64 const bitflipl = (XXH_readLE64(secret+32) ^ XXH_readLE64(secret+40)) - seed; + xxh_u64 const bitfliph = (XXH_readLE64(secret+48) ^ XXH_readLE64(secret+56)) + seed; + xxh_u64 const input_lo = XXH_readLE64(input); + xxh_u64 input_hi = XXH_readLE64(input + len - 8); + XXH128_hash_t m128 = XXH_mult64to128(input_lo ^ input_hi ^ bitflipl, XXH_PRIME64_1); + /* + * Put len in the middle of m128 to ensure that the length gets mixed to + * both the low and high bits in the 128x64 multiply below. + */ + m128.low64 += (xxh_u64)(len - 1) << 54; + input_hi ^= bitfliph; + /* + * Add the high 32 bits of input_hi to the high 32 bits of m128, then + * add the long product of the low 32 bits of input_hi and XXH_PRIME32_2 to + * the high 64 bits of m128. + * + * The best approach to this operation is different on 32-bit and 64-bit. + */ + if (sizeof(void *) < sizeof(xxh_u64)) { /* 32-bit */ + /* + * 32-bit optimized version, which is more readable. + * + * On 32-bit, it removes an ADC and delays a dependency between the two + * halves of m128.high64, but it generates an extra mask on 64-bit. + */ + m128.high64 += (input_hi & 0xFFFFFFFF00000000ULL) + XXH_mult32to64((xxh_u32)input_hi, XXH_PRIME32_2); + } else { + /* + * 64-bit optimized (albeit more confusing) version. + * + * Uses some properties of addition and multiplication to remove the mask: + * + * Let: + * a = input_hi.lo = (input_hi & 0x00000000FFFFFFFF) + * b = input_hi.hi = (input_hi & 0xFFFFFFFF00000000) + * c = XXH_PRIME32_2 + * + * a + (b * c) + * Inverse Property: x + y - x == y + * a + (b * (1 + c - 1)) + * Distributive Property: x * (y + z) == (x * y) + (x * z) + * a + (b * 1) + (b * (c - 1)) + * Identity Property: x * 1 == x + * a + b + (b * (c - 1)) + * + * Substitute a, b, and c: + * input_hi.hi + input_hi.lo + ((xxh_u64)input_hi.lo * (XXH_PRIME32_2 - 1)) + * + * Since input_hi.hi + input_hi.lo == input_hi, we get this: + * input_hi + ((xxh_u64)input_hi.lo * (XXH_PRIME32_2 - 1)) + */ + m128.high64 += input_hi + XXH_mult32to64((xxh_u32)input_hi, XXH_PRIME32_2 - 1); + } + /* m128 ^= XXH_swap64(m128 >> 64); */ + m128.low64 ^= XXH_swap64(m128.high64); + + { /* 128x64 multiply: h128 = m128 * XXH_PRIME64_2; */ + XXH128_hash_t h128 = XXH_mult64to128(m128.low64, XXH_PRIME64_2); + h128.high64 += m128.high64 * XXH_PRIME64_2; + + h128.low64 = XXH3_avalanche(h128.low64); + h128.high64 = XXH3_avalanche(h128.high64); + return h128; + } } +} + +/* + * Assumption: `secret` size is >= XXH3_SECRET_SIZE_MIN + */ +XXH_FORCE_INLINE XXH128_hash_t +XXH3_len_0to16_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) +{ + XXH_ASSERT(len <= 16); + { if (len > 8) return XXH3_len_9to16_128b(input, len, secret, seed); + if (len >= 4) return XXH3_len_4to8_128b(input, len, secret, seed); + if (len) return XXH3_len_1to3_128b(input, len, secret, seed); + { XXH128_hash_t h128; + xxh_u64 const bitflipl = XXH_readLE64(secret+64) ^ XXH_readLE64(secret+72); + xxh_u64 const bitfliph = XXH_readLE64(secret+80) ^ XXH_readLE64(secret+88); + h128.low64 = XXH64_avalanche(seed ^ bitflipl); + h128.high64 = XXH64_avalanche( seed ^ bitfliph); + return h128; + } } +} + +/* + * A bit slower than XXH3_mix16B, but handles multiply by zero better. + */ +XXH_FORCE_INLINE XXH128_hash_t +XXH128_mix32B(XXH128_hash_t acc, const xxh_u8* input_1, const xxh_u8* input_2, + const xxh_u8* secret, XXH64_hash_t seed) +{ + acc.low64 += XXH3_mix16B (input_1, secret+0, seed); + acc.low64 ^= XXH_readLE64(input_2) + XXH_readLE64(input_2 + 8); + acc.high64 += XXH3_mix16B (input_2, secret+16, seed); + acc.high64 ^= XXH_readLE64(input_1) + XXH_readLE64(input_1 + 8); + return acc; +} + + +XXH_FORCE_INLINE XXH128_hash_t +XXH3_len_17to128_128b(const xxh_u8* XXH_RESTRICT input, size_t len, + const xxh_u8* XXH_RESTRICT secret, size_t secretSize, + XXH64_hash_t seed) +{ + XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); (void)secretSize; + XXH_ASSERT(16 < len && len <= 128); + + { XXH128_hash_t acc; + acc.low64 = len * XXH_PRIME64_1; + acc.high64 = 0; + if (len > 32) { + if (len > 64) { + if (len > 96) { + acc = XXH128_mix32B(acc, input+48, input+len-64, secret+96, seed); + } + acc = XXH128_mix32B(acc, input+32, input+len-48, secret+64, seed); + } + acc = XXH128_mix32B(acc, input+16, input+len-32, secret+32, seed); + } + acc = XXH128_mix32B(acc, input, input+len-16, secret, seed); + { XXH128_hash_t h128; + h128.low64 = acc.low64 + acc.high64; + h128.high64 = (acc.low64 * XXH_PRIME64_1) + + (acc.high64 * XXH_PRIME64_4) + + ((len - seed) * XXH_PRIME64_2); + h128.low64 = XXH3_avalanche(h128.low64); + h128.high64 = (XXH64_hash_t)0 - XXH3_avalanche(h128.high64); + return h128; + } + } +} + +XXH_NO_INLINE XXH128_hash_t +XXH3_len_129to240_128b(const xxh_u8* XXH_RESTRICT input, size_t len, + const xxh_u8* XXH_RESTRICT secret, size_t secretSize, + XXH64_hash_t seed) +{ + XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); (void)secretSize; + XXH_ASSERT(128 < len && len <= XXH3_MIDSIZE_MAX); + + { XXH128_hash_t acc; + int const nbRounds = (int)len / 32; + int i; + acc.low64 = len * XXH_PRIME64_1; + acc.high64 = 0; + for (i=0; i<4; i++) { + acc = XXH128_mix32B(acc, + input + (32 * i), + input + (32 * i) + 16, + secret + (32 * i), + seed); + } + acc.low64 = XXH3_avalanche(acc.low64); + acc.high64 = XXH3_avalanche(acc.high64); + XXH_ASSERT(nbRounds >= 4); + for (i=4 ; i < nbRounds; i++) { + acc = XXH128_mix32B(acc, + input + (32 * i), + input + (32 * i) + 16, + secret + XXH3_MIDSIZE_STARTOFFSET + (32 * (i - 4)), + seed); + } + /* last bytes */ + acc = XXH128_mix32B(acc, + input + len - 16, + input + len - 32, + secret + XXH3_SECRET_SIZE_MIN - XXH3_MIDSIZE_LASTOFFSET - 16, + 0ULL - seed); + + { XXH128_hash_t h128; + h128.low64 = acc.low64 + acc.high64; + h128.high64 = (acc.low64 * XXH_PRIME64_1) + + (acc.high64 * XXH_PRIME64_4) + + ((len - seed) * XXH_PRIME64_2); + h128.low64 = XXH3_avalanche(h128.low64); + h128.high64 = (XXH64_hash_t)0 - XXH3_avalanche(h128.high64); + return h128; + } + } +} + +XXH_FORCE_INLINE XXH128_hash_t +XXH3_hashLong_128b_internal(const void* XXH_RESTRICT input, size_t len, + const xxh_u8* XXH_RESTRICT secret, size_t secretSize, + XXH3_f_accumulate_512 f_acc512, + XXH3_f_scrambleAcc f_scramble) +{ + XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64 acc[XXH_ACC_NB] = XXH3_INIT_ACC; + + XXH3_hashLong_internal_loop(acc, (const xxh_u8*)input, len, secret, secretSize, f_acc512, f_scramble); + + /* converge into final hash */ + XXH_STATIC_ASSERT(sizeof(acc) == 64); + XXH_ASSERT(secretSize >= sizeof(acc) + XXH_SECRET_MERGEACCS_START); + { XXH128_hash_t h128; + h128.low64 = XXH3_mergeAccs(acc, + secret + XXH_SECRET_MERGEACCS_START, + (xxh_u64)len * XXH_PRIME64_1); + h128.high64 = XXH3_mergeAccs(acc, + secret + secretSize + - sizeof(acc) - XXH_SECRET_MERGEACCS_START, + ~((xxh_u64)len * XXH_PRIME64_2)); + return h128; + } +} + +/* + * It's important for performance that XXH3_hashLong is not inlined. + */ +XXH_NO_INLINE XXH128_hash_t +XXH3_hashLong_128b_default(const void* XXH_RESTRICT input, size_t len, + XXH64_hash_t seed64, + const void* XXH_RESTRICT secret, size_t secretLen) +{ + (void)seed64; (void)secret; (void)secretLen; + return XXH3_hashLong_128b_internal(input, len, XXH3_kSecret, sizeof(XXH3_kSecret), + XXH3_accumulate_512, XXH3_scrambleAcc); +} + +/* + * It's important for performance that XXH3_hashLong is not inlined. + */ +XXH_NO_INLINE XXH128_hash_t +XXH3_hashLong_128b_withSecret(const void* XXH_RESTRICT input, size_t len, + XXH64_hash_t seed64, + const void* XXH_RESTRICT secret, size_t secretLen) +{ + (void)seed64; + return XXH3_hashLong_128b_internal(input, len, (const xxh_u8*)secret, secretLen, + XXH3_accumulate_512, XXH3_scrambleAcc); +} + +XXH_FORCE_INLINE XXH128_hash_t +XXH3_hashLong_128b_withSeed_internal(const void* XXH_RESTRICT input, size_t len, + XXH64_hash_t seed64, + XXH3_f_accumulate_512 f_acc512, + XXH3_f_scrambleAcc f_scramble, + XXH3_f_initCustomSecret f_initSec) +{ + if (seed64 == 0) + return XXH3_hashLong_128b_internal(input, len, + XXH3_kSecret, sizeof(XXH3_kSecret), + f_acc512, f_scramble); + { XXH_ALIGN(XXH_SEC_ALIGN) xxh_u8 secret[XXH_SECRET_DEFAULT_SIZE]; + f_initSec(secret, seed64); + return XXH3_hashLong_128b_internal(input, len, (const xxh_u8*)secret, sizeof(secret), + f_acc512, f_scramble); + } +} + +/* + * It's important for performance that XXH3_hashLong is not inlined. + */ +XXH_NO_INLINE XXH128_hash_t +XXH3_hashLong_128b_withSeed(const void* input, size_t len, + XXH64_hash_t seed64, const void* XXH_RESTRICT secret, size_t secretLen) +{ + (void)secret; (void)secretLen; + return XXH3_hashLong_128b_withSeed_internal(input, len, seed64, + XXH3_accumulate_512, XXH3_scrambleAcc, XXH3_initCustomSecret); +} + +typedef XXH128_hash_t (*XXH3_hashLong128_f)(const void* XXH_RESTRICT, size_t, + XXH64_hash_t, const void* XXH_RESTRICT, size_t); + +XXH_FORCE_INLINE XXH128_hash_t +XXH3_128bits_internal(const void* input, size_t len, + XXH64_hash_t seed64, const void* XXH_RESTRICT secret, size_t secretLen, + XXH3_hashLong128_f f_hl128) +{ + XXH_ASSERT(secretLen >= XXH3_SECRET_SIZE_MIN); + /* + * If an action is to be taken if `secret` conditions are not respected, + * it should be done here. + * For now, it's a contract pre-condition. + * Adding a check and a branch here would cost performance at every hash. + */ + if (len <= 16) + return XXH3_len_0to16_128b((const xxh_u8*)input, len, (const xxh_u8*)secret, seed64); + if (len <= 128) + return XXH3_len_17to128_128b((const xxh_u8*)input, len, (const xxh_u8*)secret, secretLen, seed64); + if (len <= XXH3_MIDSIZE_MAX) + return XXH3_len_129to240_128b((const xxh_u8*)input, len, (const xxh_u8*)secret, secretLen, seed64); + return f_hl128(input, len, seed64, secret, secretLen); +} + + +/* === Public XXH128 API === */ + +XXH_PUBLIC_API XXH128_hash_t XXH3_128bits(const void* input, size_t len) +{ + return XXH3_128bits_internal(input, len, 0, + XXH3_kSecret, sizeof(XXH3_kSecret), + XXH3_hashLong_128b_default); +} + +XXH_PUBLIC_API XXH128_hash_t +XXH3_128bits_withSecret(const void* input, size_t len, const void* secret, size_t secretSize) +{ + return XXH3_128bits_internal(input, len, 0, + (const xxh_u8*)secret, secretSize, + XXH3_hashLong_128b_withSecret); +} + +XXH_PUBLIC_API XXH128_hash_t +XXH3_128bits_withSeed(const void* input, size_t len, XXH64_hash_t seed) +{ + return XXH3_128bits_internal(input, len, seed, + XXH3_kSecret, sizeof(XXH3_kSecret), + XXH3_hashLong_128b_withSeed); +} + +XXH_PUBLIC_API XXH128_hash_t +XXH128(const void* input, size_t len, XXH64_hash_t seed) +{ + return XXH3_128bits_withSeed(input, len, seed); +} + + +/* === XXH3 128-bit streaming === */ + +/* + * All the functions are actually the same as for 64-bit streaming variant. + * The only difference is the finalizatiom routine. + */ + +static void +XXH3_128bits_reset_internal(XXH3_state_t* statePtr, + XXH64_hash_t seed, + const void* secret, size_t secretSize) +{ + XXH3_64bits_reset_internal(statePtr, seed, secret, secretSize); +} + +XXH_PUBLIC_API XXH_errorcode +XXH3_128bits_reset(XXH3_state_t* statePtr) +{ + if (statePtr == NULL) return XXH_ERROR; + XXH3_128bits_reset_internal(statePtr, 0, XXH3_kSecret, XXH_SECRET_DEFAULT_SIZE); + return XXH_OK; +} + +XXH_PUBLIC_API XXH_errorcode +XXH3_128bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t secretSize) +{ + if (statePtr == NULL) return XXH_ERROR; + XXH3_128bits_reset_internal(statePtr, 0, secret, secretSize); + if (secret == NULL) return XXH_ERROR; + if (secretSize < XXH3_SECRET_SIZE_MIN) return XXH_ERROR; + return XXH_OK; +} + +XXH_PUBLIC_API XXH_errorcode +XXH3_128bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed) +{ + if (statePtr == NULL) return XXH_ERROR; + if (seed==0) return XXH3_128bits_reset(statePtr); + if (seed != statePtr->seed) XXH3_initCustomSecret(statePtr->customSecret, seed); + XXH3_128bits_reset_internal(statePtr, seed, NULL, XXH_SECRET_DEFAULT_SIZE); + return XXH_OK; +} + +XXH_PUBLIC_API XXH_errorcode +XXH3_128bits_update(XXH3_state_t* state, const void* input, size_t len) +{ + return XXH3_update(state, (const xxh_u8*)input, len, + XXH3_accumulate_512, XXH3_scrambleAcc); +} + +XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_digest (const XXH3_state_t* state) +{ + const unsigned char* const secret = (state->extSecret == NULL) ? state->customSecret : state->extSecret; + if (state->totalLen > XXH3_MIDSIZE_MAX) { + XXH_ALIGN(XXH_ACC_ALIGN) XXH64_hash_t acc[XXH_ACC_NB]; + XXH3_digest_long(acc, state, secret); + XXH_ASSERT(state->secretLimit + XXH_STRIPE_LEN >= sizeof(acc) + XXH_SECRET_MERGEACCS_START); + { XXH128_hash_t h128; + h128.low64 = XXH3_mergeAccs(acc, + secret + XXH_SECRET_MERGEACCS_START, + (xxh_u64)state->totalLen * XXH_PRIME64_1); + h128.high64 = XXH3_mergeAccs(acc, + secret + state->secretLimit + XXH_STRIPE_LEN + - sizeof(acc) - XXH_SECRET_MERGEACCS_START, + ~((xxh_u64)state->totalLen * XXH_PRIME64_2)); + return h128; + } + } + /* len <= XXH3_MIDSIZE_MAX : short code */ + if (state->seed) + return XXH3_128bits_withSeed(state->buffer, (size_t)state->totalLen, state->seed); + return XXH3_128bits_withSecret(state->buffer, (size_t)(state->totalLen), + secret, state->secretLimit + XXH_STRIPE_LEN); +} + +/* 128-bit utility functions */ + +#include <string.h> /* memcmp, memcpy */ + +/* return : 1 is equal, 0 if different */ +XXH_PUBLIC_API int XXH128_isEqual(XXH128_hash_t h1, XXH128_hash_t h2) +{ + /* note : XXH128_hash_t is compact, it has no padding byte */ + return !(memcmp(&h1, &h2, sizeof(h1))); +} + +/* This prototype is compatible with stdlib's qsort(). + * return : >0 if *h128_1 > *h128_2 + * <0 if *h128_1 < *h128_2 + * =0 if *h128_1 == *h128_2 */ +XXH_PUBLIC_API int XXH128_cmp(const void* h128_1, const void* h128_2) +{ + XXH128_hash_t const h1 = *(const XXH128_hash_t*)h128_1; + XXH128_hash_t const h2 = *(const XXH128_hash_t*)h128_2; + int const hcmp = (h1.high64 > h2.high64) - (h2.high64 > h1.high64); + /* note : bets that, in most cases, hash values are different */ + if (hcmp) return hcmp; + return (h1.low64 > h2.low64) - (h2.low64 > h1.low64); +} + + +/*====== Canonical representation ======*/ +XXH_PUBLIC_API void +XXH128_canonicalFromHash(XXH128_canonical_t* dst, XXH128_hash_t hash) +{ + XXH_STATIC_ASSERT(sizeof(XXH128_canonical_t) == sizeof(XXH128_hash_t)); + if (XXH_CPU_LITTLE_ENDIAN) { + hash.high64 = XXH_swap64(hash.high64); + hash.low64 = XXH_swap64(hash.low64); + } + memcpy(dst, &hash.high64, sizeof(hash.high64)); + memcpy((char*)dst + sizeof(hash.high64), &hash.low64, sizeof(hash.low64)); +} + +XXH_PUBLIC_API XXH128_hash_t +XXH128_hashFromCanonical(const XXH128_canonical_t* src) +{ + XXH128_hash_t h; + h.high64 = XXH_readBE64(src); + h.low64 = XXH_readBE64(src->digest + 8); + return h; +} + +/* Pop our optimization override from above */ +#if XXH_VECTOR == XXH_AVX2 /* AVX2 */ \ + && defined(__GNUC__) && !defined(__clang__) /* GCC, not Clang */ \ + && defined(__OPTIMIZE__) && !defined(__OPTIMIZE_SIZE__) /* respect -O0 and -Os */ +# pragma GCC pop_options +#endif + +#endif /* XXH_NO_LONG_LONG */ + + +#endif /* XXH_IMPLEMENTATION */ + + +#if defined (__cplusplus) +} +#endif diff --git a/tools/msys/mingw64/lib/cmake/xxHash/xxHashConfig.cmake b/tools/msys/mingw64/lib/cmake/xxHash/xxHashConfig.cmake new file mode 100644 index 0000000000000000000000000000000000000000..10d8f61ff712674e0babfc3c78f9cd7800a5fd90 --- /dev/null +++ b/tools/msys/mingw64/lib/cmake/xxHash/xxHashConfig.cmake @@ -0,0 +1,28 @@ + +####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() ####### +####### Any changes to this file will be overwritten by the next CMake run #### +####### The input file was xxHashConfig.cmake.in ######## + +get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE) + +macro(set_and_check _var _file) + set(${_var} "${_file}") + if(NOT EXISTS "${_file}") + message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") + endif() +endmacro() + +macro(check_required_components _NAME) + foreach(comp ${${_NAME}_FIND_COMPONENTS}) + if(NOT ${_NAME}_${comp}_FOUND) + if(${_NAME}_FIND_REQUIRED_${comp}) + set(${_NAME}_FOUND FALSE) + endif() + endif() + endforeach() +endmacro() + +#################################################################################### + +include(${CMAKE_CURRENT_LIST_DIR}/xxHashTargets.cmake) + diff --git a/tools/msys/mingw64/lib/cmake/xxHash/xxHashConfigVersion.cmake b/tools/msys/mingw64/lib/cmake/xxHash/xxHashConfigVersion.cmake new file mode 100644 index 0000000000000000000000000000000000000000..e5534e636a032835081c0a8c8912ce3214affdcd --- /dev/null +++ b/tools/msys/mingw64/lib/cmake/xxHash/xxHashConfigVersion.cmake @@ -0,0 +1,37 @@ +# This is a basic version file for the Config-mode of find_package(). +# It is used by write_basic_package_version_file() as input file for configure_file() +# to create a version-file which can be installed along a config.cmake file. +# +# The created file sets PACKAGE_VERSION_EXACT if the current version string and +# the requested version string are exactly the same and it sets +# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version. +# The variable CVF_VERSION must be set before calling configure_file(). + +set(PACKAGE_VERSION "0.8.0") + +if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() + + +# if the installed project requested no architecture check, don't perform the check +if("FALSE") + return() +endif() + +# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: +if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "") + return() +endif() + +# check that the installed version has the same 32/64bit-ness as the one which is currently searching: +if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8") + math(EXPR installedBits "8 * 8") + set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") + set(PACKAGE_VERSION_UNSUITABLE TRUE) +endif() diff --git a/tools/msys/mingw64/lib/cmake/xxHash/xxHashTargets-release.cmake b/tools/msys/mingw64/lib/cmake/xxHash/xxHashTargets-release.cmake new file mode 100644 index 0000000000000000000000000000000000000000..89f548fa633eee73d40525a1360bc2543eed55ef --- /dev/null +++ b/tools/msys/mingw64/lib/cmake/xxHash/xxHashTargets-release.cmake @@ -0,0 +1,28 @@ +#---------------------------------------------------------------- +# Generated CMake target import file for configuration "Release". +#---------------------------------------------------------------- + +# Commands may need to know the format version. +set(CMAKE_IMPORT_FILE_VERSION 1) + +# Import target "xxHash::xxhash" for configuration "Release" +set_property(TARGET xxHash::xxhash APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +set_target_properties(xxHash::xxhash PROPERTIES + IMPORTED_IMPLIB_RELEASE "${_IMPORT_PREFIX}/lib/libxxhash.dll.a" + IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/libxxhash.dll" + ) + +list(APPEND _IMPORT_CHECK_TARGETS xxHash::xxhash ) +list(APPEND _IMPORT_CHECK_FILES_FOR_xxHash::xxhash "${_IMPORT_PREFIX}/lib/libxxhash.dll.a" "${_IMPORT_PREFIX}/bin/libxxhash.dll" ) + +# Import target "xxHash::xxhsum" for configuration "Release" +set_property(TARGET xxHash::xxhsum APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +set_target_properties(xxHash::xxhsum PROPERTIES + IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/xxhsum.exe" + ) + +list(APPEND _IMPORT_CHECK_TARGETS xxHash::xxhsum ) +list(APPEND _IMPORT_CHECK_FILES_FOR_xxHash::xxhsum "${_IMPORT_PREFIX}/bin/xxhsum.exe" ) + +# Commands beyond this point should not need to know the version. +set(CMAKE_IMPORT_FILE_VERSION) diff --git a/tools/msys/mingw64/lib/cmake/xxHash/xxHashTargets.cmake b/tools/msys/mingw64/lib/cmake/xxHash/xxHashTargets.cmake new file mode 100644 index 0000000000000000000000000000000000000000..b164fbacc2c57d3085c9295c55054d75fde48928 --- /dev/null +++ b/tools/msys/mingw64/lib/cmake/xxHash/xxHashTargets.cmake @@ -0,0 +1,98 @@ +# Generated by CMake + +if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5) + message(FATAL_ERROR "CMake >= 2.6.0 required") +endif() +cmake_policy(PUSH) +cmake_policy(VERSION 2.6...3.17) +#---------------------------------------------------------------- +# Generated CMake target import file. +#---------------------------------------------------------------- + +# Commands may need to know the format version. +set(CMAKE_IMPORT_FILE_VERSION 1) + +# Protect against multiple inclusion, which would fail when already imported targets are added once more. +set(_targetsDefined) +set(_targetsNotDefined) +set(_expectedTargets) +foreach(_expectedTarget xxHash::xxhash xxHash::xxhsum) + list(APPEND _expectedTargets ${_expectedTarget}) + if(NOT TARGET ${_expectedTarget}) + list(APPEND _targetsNotDefined ${_expectedTarget}) + endif() + if(TARGET ${_expectedTarget}) + list(APPEND _targetsDefined ${_expectedTarget}) + endif() +endforeach() +if("${_targetsDefined}" STREQUAL "${_expectedTargets}") + unset(_targetsDefined) + unset(_targetsNotDefined) + unset(_expectedTargets) + set(CMAKE_IMPORT_FILE_VERSION) + cmake_policy(POP) + return() +endif() +if(NOT "${_targetsDefined}" STREQUAL "") + message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n") +endif() +unset(_targetsDefined) +unset(_targetsNotDefined) +unset(_expectedTargets) + + +# Compute the installation prefix relative to this file. +get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +if(_IMPORT_PREFIX STREQUAL "/") + set(_IMPORT_PREFIX "") +endif() + +# Create imported target xxHash::xxhash +add_library(xxHash::xxhash SHARED IMPORTED) + +set_target_properties(xxHash::xxhash PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "XXH_EXPORT" + INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include/" +) + +# Create imported target xxHash::xxhsum +add_executable(xxHash::xxhsum IMPORTED) + +# Load information for each installed configuration. +get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +file(GLOB CONFIG_FILES "${_DIR}/xxHashTargets-*.cmake") +foreach(f ${CONFIG_FILES}) + include(${f}) +endforeach() + +# Cleanup temporary variables. +set(_IMPORT_PREFIX) + +# Loop over all imported files and verify that they actually exist +foreach(target ${_IMPORT_CHECK_TARGETS} ) + foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} ) + if(NOT EXISTS "${file}" ) + message(FATAL_ERROR "The imported target \"${target}\" references the file + \"${file}\" +but this file does not exist. Possible reasons include: +* The file was deleted, renamed, or moved to another location. +* An install or uninstall procedure did not complete successfully. +* The installation package was faulty and contained + \"${CMAKE_CURRENT_LIST_FILE}\" +but not all the files it references. +") + endif() + endforeach() + unset(_IMPORT_CHECK_FILES_FOR_${target}) +endforeach() +unset(_IMPORT_CHECK_TARGETS) + +# This file does not depend on other imported targets which have +# been exported from the same project but in a separate export set. + +# Commands beyond this point should not need to know the version. +set(CMAKE_IMPORT_FILE_VERSION) +cmake_policy(POP) diff --git a/tools/msys/mingw64/lib/libxxhash.dll.a b/tools/msys/mingw64/lib/libxxhash.dll.a new file mode 100644 index 0000000000000000000000000000000000000000..0d004809b2e1a4fde6ecd0a2021940ce008c5b10 Binary files /dev/null and b/tools/msys/mingw64/lib/libxxhash.dll.a differ diff --git a/tools/msys/mingw64/share/gdb/python/gdb/FrameDecorator.py b/tools/msys/mingw64/share/gdb/python/gdb/FrameDecorator.py new file mode 100644 index 0000000000000000000000000000000000000000..8d75d96cc8d842b6a12d03bb410b74e3b8abfce3 --- /dev/null +++ b/tools/msys/mingw64/share/gdb/python/gdb/FrameDecorator.py @@ -0,0 +1,302 @@ +# Copyright (C) 2013-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import gdb + +# This small code snippet deals with problem of strings in Python 2.x +# and Python 3.x. Python 2.x has str and unicode classes which are +# sub-classes of basestring. In Python 3.x all strings are encoded +# and basestring has been removed. +try: + basestring +except NameError: + basestring = str + +class FrameDecorator(object): + """Basic implementation of a Frame Decorator""" + + """ This base frame decorator decorates a frame or another frame + decorator, and provides convenience methods. If this object is + wrapping a frame decorator, defer to that wrapped object's method + if it has one. This allows for frame decorators that have + sub-classed FrameDecorator object, but also wrap other frame + decorators on the same frame to correctly execute. + + E.g + + If the result of frame filters running means we have one gdb.Frame + wrapped by multiple frame decorators, all sub-classed from + FrameDecorator, the resulting hierarchy will be: + + Decorator1 + -- (wraps) Decorator2 + -- (wraps) FrameDecorator + -- (wraps) gdb.Frame + + In this case we have two frame decorators, both of which are + sub-classed from FrameDecorator. If Decorator1 just overrides the + 'function' method, then all of the other methods are carried out + by the super-class FrameDecorator. But Decorator2 may have + overriden other methods, so FrameDecorator will look at the + 'base' parameter and defer to that class's methods. And so on, + down the chain.""" + + # 'base' can refer to a gdb.Frame or another frame decorator. In + # the latter case, the child class will have called the super + # method and _base will be an object conforming to the Frame Filter + # class. + def __init__(self, base): + self._base = base + + @staticmethod + def _is_limited_frame(frame): + """Internal utility to determine if the frame is special or + limited.""" + sal = frame.find_sal() + + if (not sal.symtab or not sal.symtab.filename + or frame.type() == gdb.DUMMY_FRAME + or frame.type() == gdb.SIGTRAMP_FRAME): + + return True + + return False + + def elided(self): + """Return any elided frames that this class might be + wrapping, or None.""" + if hasattr(self._base, "elided"): + return self._base.elided() + + return None + + def function(self): + """ Return the name of the frame's function or an address of + the function of the frame. First determine if this is a + special frame. If not, try to determine filename from GDB's + frame internal function API. Finally, if a name cannot be + determined return the address. If this function returns an + address, GDB will attempt to determine the function name from + its internal minimal symbols store (for example, for inferiors + without debug-info).""" + + # Both gdb.Frame, and FrameDecorator have a method called + # "function", so determine which object this is. + if not isinstance(self._base, gdb.Frame): + if hasattr(self._base, "function"): + # If it is not a gdb.Frame, and there is already a + # "function" method, use that. + return self._base.function() + + frame = self.inferior_frame() + + if frame.type() == gdb.DUMMY_FRAME: + return "<function called from gdb>" + elif frame.type() == gdb.SIGTRAMP_FRAME: + return "<signal handler called>" + + func = frame.function() + + # If we cannot determine the function name, return the + # address. If GDB detects an integer value from this function + # it will attempt to find the function name from minimal + # symbols via its own internal functions. + if func == None: + pc = frame.pc() + return pc + + return str(func) + + def address(self): + """ Return the address of the frame's pc""" + + if hasattr(self._base, "address"): + return self._base.address() + + frame = self.inferior_frame() + return frame.pc() + + def filename(self): + """ Return the filename associated with this frame, detecting + and returning the appropriate library name is this is a shared + library.""" + + if hasattr(self._base, "filename"): + return self._base.filename() + + frame = self.inferior_frame() + sal = frame.find_sal() + if not sal.symtab or not sal.symtab.filename: + pc = frame.pc() + return gdb.solib_name(pc) + else: + return sal.symtab.filename + + def frame_args(self): + """ Return an iterable of frame arguments for this frame, if + any. The iterable object contains objects conforming with the + Symbol/Value interface. If there are no frame arguments, or + if this frame is deemed to be a special case, return None.""" + + if hasattr(self._base, "frame_args"): + return self._base.frame_args() + + frame = self.inferior_frame() + if self._is_limited_frame(frame): + return None + + args = FrameVars(frame) + return args.fetch_frame_args() + + def frame_locals(self): + """ Return an iterable of local variables for this frame, if + any. The iterable object contains objects conforming with the + Symbol/Value interface. If there are no frame locals, or if + this frame is deemed to be a special case, return None.""" + + if hasattr(self._base, "frame_locals"): + return self._base.frame_locals() + + frame = self.inferior_frame() + if self._is_limited_frame(frame): + return None + + args = FrameVars(frame) + return args.fetch_frame_locals() + + def line(self): + """ Return line number information associated with the frame's + pc. If symbol table/line information does not exist, or if + this frame is deemed to be a special case, return None""" + + if hasattr(self._base, "line"): + return self._base.line() + + frame = self.inferior_frame() + if self._is_limited_frame(frame): + return None + + sal = frame.find_sal() + if (sal): + return sal.line + else: + return None + + def inferior_frame(self): + """ Return the gdb.Frame underpinning this frame decorator.""" + + # If 'base' is a frame decorator, we want to call its inferior + # frame method. If '_base' is a gdb.Frame, just return that. + if hasattr(self._base, "inferior_frame"): + return self._base.inferior_frame() + return self._base + +class SymValueWrapper(object): + """A container class conforming to the Symbol/Value interface + which holds frame locals or frame arguments.""" + def __init__(self, symbol, value): + self.sym = symbol + self.val = value + + def value(self): + """ Return the value associated with this symbol, or None""" + return self.val + + def symbol(self): + """ Return the symbol, or Python text, associated with this + symbol, or None""" + return self.sym + +class FrameVars(object): + + """Utility class to fetch and store frame local variables, or + frame arguments.""" + + def __init__(self, frame): + self.frame = frame + self.symbol_class = { + gdb.SYMBOL_LOC_STATIC: True, + gdb.SYMBOL_LOC_REGISTER: True, + gdb.SYMBOL_LOC_ARG: True, + gdb.SYMBOL_LOC_REF_ARG: True, + gdb.SYMBOL_LOC_LOCAL: True, + gdb.SYMBOL_LOC_REGPARM_ADDR: True, + gdb.SYMBOL_LOC_COMPUTED: True + } + + def fetch_b(self, sym): + """ Local utility method to determine if according to Symbol + type whether it should be included in the iterator. Not all + symbols are fetched, and only symbols that return + True from this method should be fetched.""" + + # SYM may be a string instead of a symbol in the case of + # synthetic local arguments or locals. If that is the case, + # always fetch. + if isinstance(sym, basestring): + return True + + sym_type = sym.addr_class + + return self.symbol_class.get(sym_type, False) + + def fetch_frame_locals(self): + """Public utility method to fetch frame local variables for + the stored frame. Frame arguments are not fetched. If there + are no frame local variables, return an empty list.""" + lvars = [] + + try: + block = self.frame.block() + except RuntimeError: + block = None + + while block != None: + if block.is_global or block.is_static: + break + for sym in block: + if sym.is_argument: + continue; + if self.fetch_b(sym): + lvars.append(SymValueWrapper(sym, None)) + + block = block.superblock + + return lvars + + def fetch_frame_args(self): + """Public utility method to fetch frame arguments for the + stored frame. Frame arguments are the only type fetched. If + there are no frame argument variables, return an empty list.""" + + args = [] + + try: + block = self.frame.block() + except RuntimeError: + block = None + + while block != None: + if block.function != None: + break + block = block.superblock + + if block != None: + for sym in block: + if not sym.is_argument: + continue; + args.append(SymValueWrapper(sym, None)) + + return args diff --git a/tools/msys/mingw64/share/gdb/python/gdb/FrameIterator.py b/tools/msys/mingw64/share/gdb/python/gdb/FrameIterator.py new file mode 100644 index 0000000000000000000000000000000000000000..9ff21c829931a57e33e9cb9c9b55a84e6abc6fcc --- /dev/null +++ b/tools/msys/mingw64/share/gdb/python/gdb/FrameIterator.py @@ -0,0 +1,51 @@ +# Copyright (C) 2013-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import gdb +import itertools + +class FrameIterator(object): + """A gdb.Frame iterator. Iterates over gdb.Frames or objects that + conform to that interface.""" + + def __init__(self, frame_obj): + """Initialize a FrameIterator. + + Arguments: + frame_obj the starting frame.""" + + super(FrameIterator, self).__init__() + self.frame = frame_obj + + def __iter__(self): + return self + + def next(self): + """next implementation. + + Returns: + The next oldest frame.""" + + result = self.frame + if result is None: + raise StopIteration + self.frame = result.older() + return result + + # Python 3.x requires __next__(self) while Python 2.x requires + # next(self). Define next(self), and for Python 3.x create this + # wrapper. + def __next__(self): + return self.next() diff --git a/tools/msys/mingw64/share/gdb/python/gdb/__init__.py b/tools/msys/mingw64/share/gdb/python/gdb/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..09d43b2a8aba1e9d0d49408036ab426a65d9e162 --- /dev/null +++ b/tools/msys/mingw64/share/gdb/python/gdb/__init__.py @@ -0,0 +1,212 @@ +# Copyright (C) 2010-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import traceback +import os +import sys +import _gdb + +if sys.version_info[0] > 2: + # Python 3 moved "reload" + from imp import reload + +from _gdb import * + +class _GdbFile (object): + # These two are needed in Python 3 + encoding = "UTF-8" + errors = "strict" + + def close(self): + # Do nothing. + return None + + def isatty(self): + return False + + def writelines(self, iterable): + for line in iterable: + self.write(line) + + def flush(self): + flush() + +class _GdbOutputFile (_GdbFile): + def write(self, s): + write(s, stream=STDOUT) + +sys.stdout = _GdbOutputFile() + +class _GdbOutputErrorFile (_GdbFile): + def write(self, s): + write(s, stream=STDERR) + +sys.stderr = _GdbOutputErrorFile() + +# Default prompt hook does nothing. +prompt_hook = None + +# Ensure that sys.argv is set to something. +# We do not use PySys_SetArgvEx because it did not appear until 2.6.6. +sys.argv = [''] + +# Initial pretty printers. +pretty_printers = [] + +# Initial type printers. +type_printers = [] +# Initial xmethod matchers. +xmethods = [] +# Initial frame filters. +frame_filters = {} +# Initial frame unwinders. +frame_unwinders = [] + +def _execute_unwinders(pending_frame): + """Internal function called from GDB to execute all unwinders. + + Runs each currently enabled unwinder until it finds the one that + can unwind given frame. + + Arguments: + pending_frame: gdb.PendingFrame instance. + Returns: + gdb.UnwindInfo instance or None. + """ + for objfile in objfiles(): + for unwinder in objfile.frame_unwinders: + if unwinder.enabled: + unwind_info = unwinder(pending_frame) + if unwind_info is not None: + return unwind_info + + for unwinder in current_progspace().frame_unwinders: + if unwinder.enabled: + unwind_info = unwinder(pending_frame) + if unwind_info is not None: + return unwind_info + + for unwinder in frame_unwinders: + if unwinder.enabled: + unwind_info = unwinder(pending_frame) + if unwind_info is not None: + return unwind_info + + return None + +def _execute_file(filepath): + """This function is used to replace Python 2's PyRun_SimpleFile. + + Loads and executes the given file. + + We could use the runpy module, but its documentation says: + "Furthermore, any functions and classes defined by the executed code are + not guaranteed to work correctly after a runpy function has returned." + """ + globals = sys.modules['__main__'].__dict__ + set_file = False + # Set file (if not set) so that the imported file can use it (e.g. to + # access file-relative paths). This matches what PyRun_SimpleFile does. + if not hasattr(globals, '__file__'): + globals['__file__'] = filepath + set_file = True + try: + with open(filepath, 'rb') as file: + # We pass globals also as locals to match what Python does + # in PyRun_SimpleFile. + compiled = compile(file.read(), filepath, 'exec') + exec(compiled, globals, globals) + finally: + if set_file: + del globals['__file__'] + + +# Convenience variable to GDB's python directory +PYTHONDIR = os.path.dirname(os.path.dirname(__file__)) + +# Auto-load all functions/commands. + +# Packages to auto-load. + +packages = [ + 'function', + 'command', + 'printer' +] + +# pkgutil.iter_modules is not available prior to Python 2.6. Instead, +# manually iterate the list, collating the Python files in each module +# path. Construct the module name, and import. + +def _auto_load_packages(): + for package in packages: + location = os.path.join(os.path.dirname(__file__), package) + if os.path.exists(location): + py_files = filter(lambda x: x.endswith('.py') + and x != '__init__.py', + os.listdir(location)) + + for py_file in py_files: + # Construct from foo.py, gdb.module.foo + modname = "%s.%s.%s" % ( __name__, package, py_file[:-3] ) + try: + if modname in sys.modules: + # reload modules with duplicate names + reload(__import__(modname)) + else: + __import__(modname) + except: + sys.stderr.write (traceback.format_exc() + "\n") + +_auto_load_packages() + +def GdbSetPythonDirectory(dir): + """Update sys.path, reload gdb and auto-load packages.""" + global PYTHONDIR + + try: + sys.path.remove(PYTHONDIR) + except ValueError: + pass + sys.path.insert(0, dir) + + PYTHONDIR = dir + + # note that reload overwrites the gdb module without deleting existing + # attributes + reload(__import__(__name__)) + _auto_load_packages() + +def current_progspace(): + "Return the current Progspace." + return selected_inferior().progspace + +def objfiles(): + "Return a sequence of the current program space's objfiles." + return current_progspace().objfiles() + +def solib_name (addr): + """solib_name (Long) -> String.\n\ +Return the name of the shared library holding a given address, or None.""" + return current_progspace().solib_name(addr) + +def block_for_pc(pc): + "Return the block containing the given pc value, or None." + return current_progspace().block_for_pc(pc) + +def find_pc_line(pc): + """find_pc_line (pc) -> Symtab_and_line. +Return the gdb.Symtab_and_line object corresponding to the pc value.""" + return current_progspace().find_pc_line(pc) diff --git a/tools/msys/mingw64/share/gdb/python/gdb/command/__init__.py b/tools/msys/mingw64/share/gdb/python/gdb/command/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..03488303439cb22f9c613d321365fadd51ec24e7 --- /dev/null +++ b/tools/msys/mingw64/share/gdb/python/gdb/command/__init__.py @@ -0,0 +1,16 @@ +# Copyright (C) 2010-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + diff --git a/tools/msys/mingw64/share/gdb/python/gdb/command/explore.py b/tools/msys/mingw64/share/gdb/python/gdb/command/explore.py new file mode 100644 index 0000000000000000000000000000000000000000..c3fd6d287314598d6b38facc3d09d87b7dca957a --- /dev/null +++ b/tools/msys/mingw64/share/gdb/python/gdb/command/explore.py @@ -0,0 +1,750 @@ +# GDB 'explore' command. +# Copyright (C) 2012-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""Implementation of the GDB 'explore' command using the GDB Python API.""" + +import gdb +import sys + +if sys.version_info[0] > 2: + # Python 3 renamed raw_input to input + raw_input = input + +class Explorer(object): + """Internal class which invokes other explorers.""" + + # This map is filled by the Explorer.init_env() function + type_code_to_explorer_map = { } + + _SCALAR_TYPE_LIST = ( + gdb.TYPE_CODE_CHAR, + gdb.TYPE_CODE_INT, + gdb.TYPE_CODE_BOOL, + gdb.TYPE_CODE_FLT, + gdb.TYPE_CODE_VOID, + gdb.TYPE_CODE_ENUM, + ) + + @staticmethod + def guard_expr(expr): + length = len(expr) + guard = False + + if expr[0] == '(' and expr[length-1] == ')': + pass + else: + i = 0 + while i < length: + c = expr[i] + if (c == '_' or ('a' <= c and c <= 'z') or + ('A' <= c and c <= 'Z') or ('0' <= c and c <= '9')): + pass + else: + guard = True + break + i += 1 + + if guard: + return "(" + expr + ")" + else: + return expr + + @staticmethod + def explore_expr(expr, value, is_child): + """Main function to explore an expression value. + + Arguments: + expr: The expression string that is being explored. + value: The gdb.Value value of the expression. + is_child: Boolean value to indicate if the expression is a child. + An expression is a child if it is derived from the main + expression entered by the user. For example, if the user + entered an expression which evaluates to a struct, then + when exploring the fields of the struct, is_child is set + to True internally. + + Returns: + No return value. + """ + type_code = value.type.code + if type_code in Explorer.type_code_to_explorer_map: + explorer_class = Explorer.type_code_to_explorer_map[type_code] + while explorer_class.explore_expr(expr, value, is_child): + pass + else: + print ("Explorer for type '%s' not yet available.\n" % + str(value.type)) + + @staticmethod + def explore_type(name, datatype, is_child): + """Main function to explore a data type. + + Arguments: + name: The string representing the path to the data type being + explored. + datatype: The gdb.Type value of the data type being explored. + is_child: Boolean value to indicate if the name is a child. + A name is a child if it is derived from the main name + entered by the user. For example, if the user entered + the name of struct type, then when exploring the fields + of the struct, is_child is set to True internally. + + Returns: + No return value. + """ + type_code = datatype.code + if type_code in Explorer.type_code_to_explorer_map: + explorer_class = Explorer.type_code_to_explorer_map[type_code] + while explorer_class.explore_type(name, datatype, is_child): + pass + else: + print ("Explorer for type '%s' not yet available.\n" % + str(datatype)) + + @staticmethod + def init_env(): + """Initializes the Explorer environment. + This function should be invoked before starting any exploration. If + invoked before an exploration, it need not be invoked for subsequent + explorations. + """ + Explorer.type_code_to_explorer_map = { + gdb.TYPE_CODE_CHAR : ScalarExplorer, + gdb.TYPE_CODE_INT : ScalarExplorer, + gdb.TYPE_CODE_BOOL : ScalarExplorer, + gdb.TYPE_CODE_FLT : ScalarExplorer, + gdb.TYPE_CODE_VOID : ScalarExplorer, + gdb.TYPE_CODE_ENUM : ScalarExplorer, + gdb.TYPE_CODE_STRUCT : CompoundExplorer, + gdb.TYPE_CODE_UNION : CompoundExplorer, + gdb.TYPE_CODE_PTR : PointerExplorer, + gdb.TYPE_CODE_REF : ReferenceExplorer, + gdb.TYPE_CODE_RVALUE_REF : ReferenceExplorer, + gdb.TYPE_CODE_TYPEDEF : TypedefExplorer, + gdb.TYPE_CODE_ARRAY : ArrayExplorer + } + + @staticmethod + def is_scalar_type(type): + """Checks whether a type is a scalar type. + A type is a scalar type of its type is + gdb.TYPE_CODE_CHAR or + gdb.TYPE_CODE_INT or + gdb.TYPE_CODE_BOOL or + gdb.TYPE_CODE_FLT or + gdb.TYPE_CODE_VOID or + gdb.TYPE_CODE_ENUM. + + Arguments: + type: The type to be checked. + + Returns: + 'True' if 'type' is a scalar type. 'False' otherwise. + """ + return type.code in Explorer._SCALAR_TYPE_LIST + + @staticmethod + def return_to_parent_value(): + """A utility function which prints that the current exploration session + is returning to the parent value. Useful when exploring values. + """ + print ("\nReturning to parent value...\n") + + @staticmethod + def return_to_parent_value_prompt(): + """A utility function which prompts the user to press the 'enter' key + so that the exploration session can shift back to the parent value. + Useful when exploring values. + """ + raw_input("\nPress enter to return to parent value: ") + + @staticmethod + def return_to_enclosing_type(): + """A utility function which prints that the current exploration session + is returning to the enclosing type. Useful when exploring types. + """ + print ("\nReturning to enclosing type...\n") + + @staticmethod + def return_to_enclosing_type_prompt(): + """A utility function which prompts the user to press the 'enter' key + so that the exploration session can shift back to the enclosing type. + Useful when exploring types. + """ + raw_input("\nPress enter to return to enclosing type: ") + + +class ScalarExplorer(object): + """Internal class used to explore scalar values.""" + + @staticmethod + def explore_expr(expr, value, is_child): + """Function to explore scalar values. + See Explorer.explore_expr and Explorer.is_scalar_type for more + information. + """ + print ("'%s' is a scalar value of type '%s'." % + (expr, value.type)) + print ("%s = %s" % (expr, str(value))) + + if is_child: + Explorer.return_to_parent_value_prompt() + Explorer.return_to_parent_value() + + return False + + @staticmethod + def explore_type(name, datatype, is_child): + """Function to explore scalar types. + See Explorer.explore_type and Explorer.is_scalar_type for more + information. + """ + if datatype.code == gdb.TYPE_CODE_ENUM: + if is_child: + print ("%s is of an enumerated type '%s'." % + (name, str(datatype))) + else: + print ("'%s' is an enumerated type." % name) + else: + if is_child: + print ("%s is of a scalar type '%s'." % + (name, str(datatype))) + else: + print ("'%s' is a scalar type." % name) + + if is_child: + Explorer.return_to_enclosing_type_prompt() + Explorer.return_to_enclosing_type() + + return False + + +class PointerExplorer(object): + """Internal class used to explore pointer values.""" + + @staticmethod + def explore_expr(expr, value, is_child): + """Function to explore pointer values. + See Explorer.explore_expr for more information. + """ + print ("'%s' is a pointer to a value of type '%s'" % + (expr, str(value.type.target()))) + option = raw_input("Continue exploring it as a pointer to a single " + "value [y/n]: ") + if option == "y": + deref_value = None + try: + deref_value = value.dereference() + str(deref_value) + except gdb.MemoryError: + print ("'%s' a pointer pointing to an invalid memory " + "location." % expr) + if is_child: + Explorer.return_to_parent_value_prompt() + return False + Explorer.explore_expr("*%s" % Explorer.guard_expr(expr), + deref_value, is_child) + return False + + option = raw_input("Continue exploring it as a pointer to an " + "array [y/n]: ") + if option == "y": + while True: + index = 0 + try: + index = int(raw_input("Enter the index of the element you " + "want to explore in '%s': " % expr)) + except ValueError: + break + element_expr = "%s[%d]" % (Explorer.guard_expr(expr), index) + element = value[index] + try: + str(element) + except gdb.MemoryError: + print ("Cannot read value at index %d." % index) + continue + Explorer.explore_expr(element_expr, element, True) + return False + + if is_child: + Explorer.return_to_parent_value() + return False + + @staticmethod + def explore_type(name, datatype, is_child): + """Function to explore pointer types. + See Explorer.explore_type for more information. + """ + target_type = datatype.target() + print ("\n%s is a pointer to a value of type '%s'." % + (name, str(target_type))) + + Explorer.explore_type("the pointee type of %s" % name, + target_type, + is_child) + return False + + +class ReferenceExplorer(object): + """Internal class used to explore reference (TYPE_CODE_REF) values.""" + + @staticmethod + def explore_expr(expr, value, is_child): + """Function to explore array values. + See Explorer.explore_expr for more information. + """ + referenced_value = value.referenced_value() + Explorer.explore_expr(expr, referenced_value, is_child) + return False + + @staticmethod + def explore_type(name, datatype, is_child): + """Function to explore pointer types. + See Explorer.explore_type for more information. + """ + target_type = datatype.target() + Explorer.explore_type(name, target_type, is_child) + return False + +class ArrayExplorer(object): + """Internal class used to explore arrays.""" + + @staticmethod + def explore_expr(expr, value, is_child): + """Function to explore array values. + See Explorer.explore_expr for more information. + """ + target_type = value.type.target() + print ("'%s' is an array of '%s'." % (expr, str(target_type))) + index = 0 + try: + index = int(raw_input("Enter the index of the element you want to " + "explore in '%s': " % expr)) + except ValueError: + if is_child: + Explorer.return_to_parent_value() + return False + + element = None + try: + element = value[index] + str(element) + except gdb.MemoryError: + print ("Cannot read value at index %d." % index) + raw_input("Press enter to continue... ") + return True + + Explorer.explore_expr("%s[%d]" % (Explorer.guard_expr(expr), index), + element, True) + return True + + @staticmethod + def explore_type(name, datatype, is_child): + """Function to explore array types. + See Explorer.explore_type for more information. + """ + target_type = datatype.target() + print ("%s is an array of '%s'." % (name, str(target_type))) + + Explorer.explore_type("the array element of %s" % name, target_type, + is_child) + return False + + +class CompoundExplorer(object): + """Internal class used to explore struct, classes and unions.""" + + @staticmethod + def _print_fields(print_list): + """Internal function which prints the fields of a struct/class/union. + """ + max_field_name_length = 0 + for pair in print_list: + if max_field_name_length < len(pair[0]): + max_field_name_length = len(pair[0]) + + for pair in print_list: + print (" %*s = %s" % (max_field_name_length, pair[0], pair[1])) + + @staticmethod + def _get_real_field_count(fields): + real_field_count = 0; + for field in fields: + if not field.artificial: + real_field_count = real_field_count + 1 + + return real_field_count + + @staticmethod + def explore_expr(expr, value, is_child): + """Function to explore structs/classes and union values. + See Explorer.explore_expr for more information. + """ + datatype = value.type + type_code = datatype.code + fields = datatype.fields() + + if type_code == gdb.TYPE_CODE_STRUCT: + type_desc = "struct/class" + else: + type_desc = "union" + + if CompoundExplorer._get_real_field_count(fields) == 0: + print ("The value of '%s' is a %s of type '%s' with no fields." % + (expr, type_desc, str(value.type))) + if is_child: + Explorer.return_to_parent_value_prompt() + return False + + print ("The value of '%s' is a %s of type '%s' with the following " + "fields:\n" % (expr, type_desc, str(value.type))) + + has_explorable_fields = False + choice_to_compound_field_map = { } + current_choice = 0 + print_list = [ ] + for field in fields: + if field.artificial: + continue + field_full_name = Explorer.guard_expr(expr) + "." + field.name + if field.is_base_class: + field_value = value.cast(field.type) + else: + field_value = value[field.name] + literal_value = "" + if type_code == gdb.TYPE_CODE_UNION: + literal_value = ("<Enter %d to explore this field of type " + "'%s'>" % (current_choice, str(field.type))) + has_explorable_fields = True + else: + if Explorer.is_scalar_type(field.type): + literal_value = ("%s .. (Value of type '%s')" % + (str(field_value), str(field.type))) + else: + if field.is_base_class: + field_desc = "base class" + else: + field_desc = "field" + literal_value = ("<Enter %d to explore this %s of type " + "'%s'>" % + (current_choice, field_desc, + str(field.type))) + has_explorable_fields = True + + choice_to_compound_field_map[str(current_choice)] = ( + field_full_name, field_value) + current_choice = current_choice + 1 + + print_list.append((field.name, literal_value)) + + CompoundExplorer._print_fields(print_list) + print ("") + + if has_explorable_fields: + choice = raw_input("Enter the field number of choice: ") + if choice in choice_to_compound_field_map: + Explorer.explore_expr(choice_to_compound_field_map[choice][0], + choice_to_compound_field_map[choice][1], + True) + return True + else: + if is_child: + Explorer.return_to_parent_value() + else: + if is_child: + Explorer.return_to_parent_value_prompt() + + return False + + @staticmethod + def explore_type(name, datatype, is_child): + """Function to explore struct/class and union types. + See Explorer.explore_type for more information. + """ + type_code = datatype.code + type_desc = "" + if type_code == gdb.TYPE_CODE_STRUCT: + type_desc = "struct/class" + else: + type_desc = "union" + + fields = datatype.fields() + if CompoundExplorer._get_real_field_count(fields) == 0: + if is_child: + print ("%s is a %s of type '%s' with no fields." % + (name, type_desc, str(datatype))) + Explorer.return_to_enclosing_type_prompt() + else: + print ("'%s' is a %s with no fields." % (name, type_desc)) + return False + + if is_child: + print ("%s is a %s of type '%s' " + "with the following fields:\n" % + (name, type_desc, str(datatype))) + else: + print ("'%s' is a %s with the following " + "fields:\n" % + (name, type_desc)) + + has_explorable_fields = False + current_choice = 0 + choice_to_compound_field_map = { } + print_list = [ ] + for field in fields: + if field.artificial: + continue + if field.is_base_class: + field_desc = "base class" + else: + field_desc = "field" + rhs = ("<Enter %d to explore this %s of type '%s'>" % + (current_choice, field_desc, str(field.type))) + print_list.append((field.name, rhs)) + choice_to_compound_field_map[str(current_choice)] = ( + field.name, field.type, field_desc) + current_choice = current_choice + 1 + + CompoundExplorer._print_fields(print_list) + print ("") + + if len(choice_to_compound_field_map) > 0: + choice = raw_input("Enter the field number of choice: ") + if choice in choice_to_compound_field_map: + if is_child: + new_name = ("%s '%s' of %s" % + (choice_to_compound_field_map[choice][2], + choice_to_compound_field_map[choice][0], + name)) + else: + new_name = ("%s '%s' of '%s'" % + (choice_to_compound_field_map[choice][2], + choice_to_compound_field_map[choice][0], + name)) + Explorer.explore_type(new_name, + choice_to_compound_field_map[choice][1], True) + return True + else: + if is_child: + Explorer.return_to_enclosing_type() + else: + if is_child: + Explorer.return_to_enclosing_type_prompt() + + return False + + +class TypedefExplorer(object): + """Internal class used to explore values whose type is a typedef.""" + + @staticmethod + def explore_expr(expr, value, is_child): + """Function to explore typedef values. + See Explorer.explore_expr for more information. + """ + actual_type = value.type.strip_typedefs() + print ("The value of '%s' is of type '%s' " + "which is a typedef of type '%s'" % + (expr, str(value.type), str(actual_type))) + + Explorer.explore_expr(expr, value.cast(actual_type), is_child) + return False + + @staticmethod + def explore_type(name, datatype, is_child): + """Function to explore typedef types. + See Explorer.explore_type for more information. + """ + actual_type = datatype.strip_typedefs() + if is_child: + print ("The type of %s is a typedef of type '%s'." % + (name, str(actual_type))) + else: + print ("The type '%s' is a typedef of type '%s'." % + (name, str(actual_type))) + + Explorer.explore_type(name, actual_type, is_child) + return False + + +class ExploreUtils(object): + """Internal class which provides utilities for the main command classes.""" + + @staticmethod + def check_args(name, arg_str): + """Utility to check if adequate number of arguments are passed to an + explore command. + + Arguments: + name: The name of the explore command. + arg_str: The argument string passed to the explore command. + + Returns: + True if adequate arguments are passed, false otherwise. + + Raises: + gdb.GdbError if adequate arguments are not passed. + """ + if len(arg_str) < 1: + raise gdb.GdbError("ERROR: '%s' requires an argument." + % name) + return False + else: + return True + + @staticmethod + def get_type_from_str(type_str): + """A utility function to deduce the gdb.Type value from a string + representing the type. + + Arguments: + type_str: The type string from which the gdb.Type value should be + deduced. + + Returns: + The deduced gdb.Type value if possible, None otherwise. + """ + try: + # Assume the current language to be C/C++ and make a try. + return gdb.parse_and_eval("(%s *)0" % type_str).type.target() + except RuntimeError: + # If assumption of current language to be C/C++ was wrong, then + # lookup the type using the API. + try: + return gdb.lookup_type(type_str) + except RuntimeError: + return None + + @staticmethod + def get_value_from_str(value_str): + """A utility function to deduce the gdb.Value value from a string + representing the value. + + Arguments: + value_str: The value string from which the gdb.Value value should + be deduced. + + Returns: + The deduced gdb.Value value if possible, None otherwise. + """ + try: + return gdb.parse_and_eval(value_str) + except RuntimeError: + return None + + +class ExploreCommand(gdb.Command): + """Explore a value or a type valid in the current context. + +Usage: explore ARG + +- ARG is either a valid expression or a type name. +- At any stage of exploration, hit the return key (instead of a +choice, if any) to return to the enclosing type or value.""" + + def __init__(self): + super(ExploreCommand, self).__init__(name = "explore", + command_class = gdb.COMMAND_DATA, + prefix = True) + + def invoke(self, arg_str, from_tty): + if ExploreUtils.check_args("explore", arg_str) == False: + return + + # Check if it is a value + value = ExploreUtils.get_value_from_str(arg_str) + if value is not None: + Explorer.explore_expr(arg_str, value, False) + return + + # If it is not a value, check if it is a type + datatype = ExploreUtils.get_type_from_str(arg_str) + if datatype is not None: + Explorer.explore_type(arg_str, datatype, False) + return + + # If it is neither a value nor a type, raise an error. + raise gdb.GdbError( + ("'%s' neither evaluates to a value nor is a type " + "in the current context." % + arg_str)) + + +class ExploreValueCommand(gdb.Command): + """Explore value of an expression valid in the current context. + +Usage: explore value ARG + +- ARG is a valid expression. +- At any stage of exploration, hit the return key (instead of a +choice, if any) to return to the enclosing value.""" + + def __init__(self): + super(ExploreValueCommand, self).__init__( + name = "explore value", command_class = gdb.COMMAND_DATA) + + def invoke(self, arg_str, from_tty): + if ExploreUtils.check_args("explore value", arg_str) == False: + return + + value = ExploreUtils.get_value_from_str(arg_str) + if value is None: + raise gdb.GdbError( + (" '%s' does not evaluate to a value in the current " + "context." % + arg_str)) + return + + Explorer.explore_expr(arg_str, value, False) + + +class ExploreTypeCommand(gdb.Command): + """Explore a type or the type of an expression. + +Usage: explore type ARG + +- ARG is a valid expression or a type name. +- At any stage of exploration, hit the return key (instead of a +choice, if any) to return to the enclosing type.""" + + def __init__(self): + super(ExploreTypeCommand, self).__init__( + name = "explore type", command_class = gdb.COMMAND_DATA) + + def invoke(self, arg_str, from_tty): + if ExploreUtils.check_args("explore type", arg_str) == False: + return + + datatype = ExploreUtils.get_type_from_str(arg_str) + if datatype is not None: + Explorer.explore_type(arg_str, datatype, False) + return + + value = ExploreUtils.get_value_from_str(arg_str) + if value is not None: + print ("'%s' is of type '%s'." % (arg_str, str(value.type))) + Explorer.explore_type(str(value.type), value.type, False) + return + + raise gdb.GdbError(("'%s' is not a type or value in the current " + "context." % arg_str)) + + +Explorer.init_env() + +ExploreCommand() +ExploreValueCommand() +ExploreTypeCommand() diff --git a/tools/msys/mingw64/share/gdb/python/gdb/command/frame_filters.py b/tools/msys/mingw64/share/gdb/python/gdb/command/frame_filters.py new file mode 100644 index 0000000000000000000000000000000000000000..fd7498fd144731c099fc14fc38755f8fb21e2f32 --- /dev/null +++ b/tools/msys/mingw64/share/gdb/python/gdb/command/frame_filters.py @@ -0,0 +1,456 @@ +# Frame-filter commands. +# Copyright (C) 2013-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""GDB commands for working with frame-filters.""" + +import sys +import gdb +import copy +from gdb.FrameIterator import FrameIterator +from gdb.FrameDecorator import FrameDecorator +import gdb.frames +import itertools + +# GDB Commands. +class SetFilterPrefixCmd(gdb.Command): + """Prefix command for 'set' frame-filter related operations.""" + + def __init__(self): + super(SetFilterPrefixCmd, self).__init__("set frame-filter", + gdb.COMMAND_OBSCURE, + gdb.COMPLETE_NONE, True) + +class ShowFilterPrefixCmd(gdb.Command): + """Prefix command for 'show' frame-filter related operations.""" + def __init__(self): + super(ShowFilterPrefixCmd, self).__init__("show frame-filter", + gdb.COMMAND_OBSCURE, + gdb.COMPLETE_NONE, True) +class InfoFrameFilter(gdb.Command): + """List all registered Python frame-filters. + +Usage: info frame-filters""" + + def __init__(self): + super(InfoFrameFilter, self).__init__("info frame-filter", + gdb.COMMAND_DATA) + @staticmethod + def enabled_string(state): + """Return "Yes" if filter is enabled, otherwise "No".""" + if state: + return "Yes" + else: + return "No" + + def print_list(self, title, frame_filters, blank_line): + sorted_frame_filters = sorted(frame_filters.items(), + key=lambda i: gdb.frames.get_priority(i[1]), + reverse=True) + + if len(sorted_frame_filters) == 0: + return 0 + + print(title) + print(" Priority Enabled Name") + for frame_filter in sorted_frame_filters: + name = frame_filter[0] + try: + priority = '{:<8}'.format( + str(gdb.frames.get_priority(frame_filter[1]))) + enabled = '{:<7}'.format( + self.enabled_string(gdb.frames.get_enabled(frame_filter[1]))) + print(" %s %s %s" % (priority, enabled, name)) + except Exception: + e = sys.exc_info()[1] + print(" Error printing filter '"+name+"': "+str(e)) + if blank_line: + print("") + return 1 + + def invoke(self, arg, from_tty): + any_printed = self.print_list("global frame-filters:", gdb.frame_filters, True) + + cp = gdb.current_progspace() + any_printed += self.print_list("progspace %s frame-filters:" % cp.filename, + cp.frame_filters, True) + + for objfile in gdb.objfiles(): + any_printed += self.print_list("objfile %s frame-filters:" % objfile.filename, + objfile.frame_filters, False) + + if any_printed == 0: + print ("No frame filters.") + +# Internal enable/disable functions. + +def _enable_parse_arg(cmd_name, arg): + """ Internal worker function to take an argument from + enable/disable and return a tuple of arguments. + + Arguments: + cmd_name: Name of the command invoking this function. + args: The argument as a string. + + Returns: + A tuple containing the dictionary, and the argument, or just + the dictionary in the case of "all". + """ + + argv = gdb.string_to_argv(arg); + argc = len(argv) + if argc == 0: + raise gdb.GdbError(cmd_name + " requires an argument") + if argv[0] == "all": + if argc > 1: + raise gdb.GdbError(cmd_name + ": with 'all' " \ + "you may not specify a filter.") + elif argc != 2: + raise gdb.GdbError(cmd_name + " takes exactly two arguments.") + + return argv + +def _do_enable_frame_filter(command_tuple, flag): + """Worker for enabling/disabling frame_filters. + + Arguments: + command_type: A tuple with the first element being the + frame filter dictionary, and the second being + the frame filter name. + flag: True for Enable, False for Disable. + """ + + list_op = command_tuple[0] + op_list = gdb.frames.return_list(list_op) + + if list_op == "all": + for item in op_list: + gdb.frames.set_enabled(item, flag) + else: + frame_filter = command_tuple[1] + try: + ff = op_list[frame_filter] + except KeyError: + msg = "frame-filter '" + str(frame_filter) + "' not found." + raise gdb.GdbError(msg) + + gdb.frames.set_enabled(ff, flag) + +def _complete_frame_filter_list(text, word, all_flag): + """Worker for frame filter dictionary name completion. + + Arguments: + text: The full text of the command line. + word: The most recent word of the command line. + all_flag: Whether to include the word "all" in completion. + + Returns: + A list of suggested frame filter dictionary name completions + from text/word analysis. This list can be empty when there + are no suggestions for completion. + """ + if all_flag == True: + filter_locations = ["all", "global", "progspace"] + else: + filter_locations = ["global", "progspace"] + for objfile in gdb.objfiles(): + filter_locations.append(objfile.filename) + + # If the user just asked for completions with no completion + # hints, just return all the frame filter dictionaries we know + # about. + if (text == ""): + return filter_locations + + # Otherwise filter on what we know. + flist = filter(lambda x,y=text:x.startswith(y), filter_locations) + + # If we only have one completion, complete it and return it. + if len(flist) == 1: + flist[0] = flist[0][len(text)-len(word):] + + # Otherwise, return an empty list, or a list of frame filter + # dictionaries that the previous filter operation returned. + return flist + +def _complete_frame_filter_name(word, printer_dict): + """Worker for frame filter name completion. + + Arguments: + + word: The most recent word of the command line. + + printer_dict: The frame filter dictionary to search for frame + filter name completions. + + Returns: A list of suggested frame filter name completions + from word analysis of the frame filter dictionary. This list + can be empty when there are no suggestions for completion. + """ + + printer_keys = printer_dict.keys() + if (word == ""): + return printer_keys + + flist = filter(lambda x,y=word:x.startswith(y), printer_keys) + return flist + +class EnableFrameFilter(gdb.Command): + """GDB command to enable the specified frame-filter. + +Usage: enable frame-filter DICTIONARY [NAME] + +DICTIONARY is the name of the frame filter dictionary on which to +operate. If dictionary is set to "all", perform operations on all +dictionaries. Named dictionaries are: "global" for the global +frame filter dictionary, "progspace" for the program space's frame +filter dictionary. If either all, or the two named dictionaries +are not specified, the dictionary name is assumed to be the name +of an "objfile" -- a shared library or an executable. + +NAME matches the name of the frame-filter to operate on.""" + def __init__(self): + super(EnableFrameFilter, self).__init__("enable frame-filter", + gdb.COMMAND_DATA) + def complete(self, text, word): + """Completion function for both frame filter dictionary, and + frame filter name.""" + if text.count(" ") == 0: + return _complete_frame_filter_list(text, word, True) + else: + printer_list = gdb.frames.return_list(text.split()[0].rstrip()) + return _complete_frame_filter_name(word, printer_list) + + def invoke(self, arg, from_tty): + command_tuple = _enable_parse_arg("enable frame-filter", arg) + _do_enable_frame_filter(command_tuple, True) + + +class DisableFrameFilter(gdb.Command): + """GDB command to disable the specified frame-filter. + +Usage: disable frame-filter DICTIONARY [NAME] + +DICTIONARY is the name of the frame filter dictionary on which to +operate. If dictionary is set to "all", perform operations on all +dictionaries. Named dictionaries are: "global" for the global +frame filter dictionary, "progspace" for the program space's frame +filter dictionary. If either all, or the two named dictionaries +are not specified, the dictionary name is assumed to be the name +of an "objfile" -- a shared library or an executable. + +NAME matches the name of the frame-filter to operate on.""" + def __init__(self): + super(DisableFrameFilter, self).__init__("disable frame-filter", + gdb.COMMAND_DATA) + + def complete(self, text, word): + """Completion function for both frame filter dictionary, and + frame filter name.""" + if text.count(" ") == 0: + return _complete_frame_filter_list(text, word, True) + else: + printer_list = gdb.frames.return_list(text.split()[0].rstrip()) + return _complete_frame_filter_name(word, printer_list) + + def invoke(self, arg, from_tty): + command_tuple = _enable_parse_arg("disable frame-filter", arg) + _do_enable_frame_filter(command_tuple, False) + +class SetFrameFilterPriority(gdb.Command): + """GDB command to set the priority of the specified frame-filter. + +Usage: set frame-filter priority DICTIONARY NAME PRIORITY + +DICTIONARY is the name of the frame filter dictionary on which to +operate. Named dictionaries are: "global" for the global frame +filter dictionary, "progspace" for the program space's framefilter +dictionary. If either of these two are not specified, the +dictionary name is assumed to be the name of an "objfile" -- a +shared library or an executable. + +NAME matches the name of the frame filter to operate on. + +PRIORITY is the an integer to assign the new priority to the frame +filter.""" + + def __init__(self): + super(SetFrameFilterPriority, self).__init__("set frame-filter " \ + "priority", + gdb.COMMAND_DATA) + + def _parse_pri_arg(self, arg): + """Internal worker to parse a priority from a tuple. + + Arguments: + arg: Tuple which contains the arguments from the command. + + Returns: + A tuple containing the dictionary, name and priority from + the arguments. + + Raises: + gdb.GdbError: An error parsing the arguments. + """ + + argv = gdb.string_to_argv(arg); + argc = len(argv) + if argc != 3: + print("set frame-filter priority " \ + "takes exactly three arguments.") + return None + + return argv + + def _set_filter_priority(self, command_tuple): + """Internal worker for setting priority of frame-filters, by + parsing a tuple and calling _set_priority with the parsed + tuple. + + Arguments: + command_tuple: Tuple which contains the arguments from the + command. + """ + + list_op = command_tuple[0] + frame_filter = command_tuple[1] + + # GDB returns arguments as a string, so convert priority to + # a number. + priority = int(command_tuple[2]) + + op_list = gdb.frames.return_list(list_op) + + try: + ff = op_list[frame_filter] + except KeyError: + msg = "frame-filter '" + str(frame_filter) + "' not found." + raise gdb.GdbError(msg) + + gdb.frames.set_priority(ff, priority) + + def complete(self, text, word): + """Completion function for both frame filter dictionary, and + frame filter name.""" + if text.count(" ") == 0: + return _complete_frame_filter_list(text, word, False) + else: + printer_list = gdb.frames.return_list(text.split()[0].rstrip()) + return _complete_frame_filter_name(word, printer_list) + + def invoke(self, arg, from_tty): + command_tuple = self._parse_pri_arg(arg) + if command_tuple != None: + self._set_filter_priority(command_tuple) + +class ShowFrameFilterPriority(gdb.Command): + """GDB command to show the priority of the specified frame-filter. + +Usage: show frame-filter priority DICTIONARY NAME + +DICTIONARY is the name of the frame filter dictionary on which to +operate. Named dictionaries are: "global" for the global frame +filter dictionary, "progspace" for the program space's framefilter +dictionary. If either of these two are not specified, the +dictionary name is assumed to be the name of an "objfile" -- a +shared library or an executable. + +NAME matches the name of the frame-filter to operate on.""" + + def __init__(self): + super(ShowFrameFilterPriority, self).__init__("show frame-filter " \ + "priority", + gdb.COMMAND_DATA) + + def _parse_pri_arg(self, arg): + """Internal worker to parse a dictionary and name from a + tuple. + + Arguments: + arg: Tuple which contains the arguments from the command. + + Returns: + A tuple containing the dictionary, and frame filter name. + + Raises: + gdb.GdbError: An error parsing the arguments. + """ + + argv = gdb.string_to_argv(arg); + argc = len(argv) + if argc != 2: + print("show frame-filter priority " \ + "takes exactly two arguments.") + return None + + return argv + + def get_filter_priority(self, frame_filters, name): + """Worker for retrieving the priority of frame_filters. + + Arguments: + frame_filters: Name of frame filter dictionary. + name: object to select printers. + + Returns: + The priority of the frame filter. + + Raises: + gdb.GdbError: A frame filter cannot be found. + """ + + op_list = gdb.frames.return_list(frame_filters) + + try: + ff = op_list[name] + except KeyError: + msg = "frame-filter '" + str(name) + "' not found." + raise gdb.GdbError(msg) + + return gdb.frames.get_priority(ff) + + def complete(self, text, word): + """Completion function for both frame filter dictionary, and + frame filter name.""" + + if text.count(" ") == 0: + return _complete_frame_filter_list(text, word, False) + else: + printer_list = frame._return_list(text.split()[0].rstrip()) + return _complete_frame_filter_name(word, printer_list) + + def invoke(self, arg, from_tty): + command_tuple = self._parse_pri_arg(arg) + if command_tuple == None: + return + filter_name = command_tuple[1] + list_name = command_tuple[0] + try: + priority = self.get_filter_priority(list_name, filter_name); + except Exception: + e = sys.exc_info()[1] + print("Error printing filter priority for '"+name+"':"+str(e)) + else: + print("Priority of filter '" + filter_name + "' in list '" \ + + list_name + "' is: " + str(priority)) + +# Register commands +SetFilterPrefixCmd() +ShowFilterPrefixCmd() +InfoFrameFilter() +EnableFrameFilter() +DisableFrameFilter() +SetFrameFilterPriority() +ShowFrameFilterPriority() diff --git a/tools/msys/mingw64/share/gdb/python/gdb/command/pretty_printers.py b/tools/msys/mingw64/share/gdb/python/gdb/command/pretty_printers.py new file mode 100644 index 0000000000000000000000000000000000000000..f25807d076538a879583cac07b91596b1ca0f1a1 --- /dev/null +++ b/tools/msys/mingw64/share/gdb/python/gdb/command/pretty_printers.py @@ -0,0 +1,365 @@ +# Pretty-printer commands. +# Copyright (C) 2010-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""GDB commands for working with pretty-printers.""" + +import copy +import gdb +import re + + +def parse_printer_regexps(arg): + """Internal utility to parse a pretty-printer command argv. + + Arguments: + arg: The arguments to the command. The format is: + [object-regexp [name-regexp]]. + Individual printers in a collection are named as + printer-name;subprinter-name. + + Returns: + The result is a 3-tuple of compiled regular expressions, except that + the resulting compiled subprinter regexp is None if not provided. + + Raises: + SyntaxError: an error processing ARG + """ + + argv = gdb.string_to_argv(arg); + argc = len(argv) + object_regexp = "" # match everything + name_regexp = "" # match everything + subname_regexp = None + if argc > 3: + raise SyntaxError("too many arguments") + if argc >= 1: + object_regexp = argv[0] + if argc >= 2: + name_subname = argv[1].split(";", 1) + name_regexp = name_subname[0] + if len(name_subname) == 2: + subname_regexp = name_subname[1] + # That re.compile raises SyntaxError was determined empirically. + # We catch it and reraise it to provide a slightly more useful + # error message for the user. + try: + object_re = re.compile(object_regexp) + except SyntaxError: + raise SyntaxError("invalid object regexp: %s" % object_regexp) + try: + name_re = re.compile (name_regexp) + except SyntaxError: + raise SyntaxError("invalid name regexp: %s" % name_regexp) + if subname_regexp is not None: + try: + subname_re = re.compile(subname_regexp) + except SyntaxError: + raise SyntaxError("invalid subname regexp: %s" % subname_regexp) + else: + subname_re = None + return(object_re, name_re, subname_re) + + +def printer_enabled_p(printer): + """Internal utility to see if printer (or subprinter) is enabled.""" + if hasattr(printer, "enabled"): + return printer.enabled + else: + return True + + +class InfoPrettyPrinter(gdb.Command): + """GDB command to list all registered pretty-printers. + +Usage: info pretty-printer [OBJECT-REGEXP [NAME-REGEXP]] + +OBJECT-REGEXP is a regular expression matching the objects to list. +Objects are "global", the program space's file, and the objfiles within +that program space. + +NAME-REGEXP matches the name of the pretty-printer. +Individual printers in a collection are named as +printer-name;subprinter-name.""" + + def __init__ (self): + super(InfoPrettyPrinter, self).__init__("info pretty-printer", + gdb.COMMAND_DATA) + + @staticmethod + def enabled_string(printer): + """Return "" if PRINTER is enabled, otherwise " [disabled]".""" + if printer_enabled_p(printer): + return "" + else: + return " [disabled]" + + @staticmethod + def printer_name(printer): + """Return the printer's name.""" + if hasattr(printer, "name"): + return printer.name + if hasattr(printer, "__name__"): + return printer.__name__ + # This "shouldn't happen", but the public API allows for + # direct additions to the pretty-printer list, and we shouldn't + # crash because someone added a bogus printer. + # Plus we want to give the user a way to list unknown printers. + return "unknown" + + def list_pretty_printers(self, pretty_printers, name_re, subname_re): + """Print a list of pretty-printers.""" + # A potential enhancement is to provide an option to list printers in + # "lookup order" (i.e. unsorted). + sorted_pretty_printers = sorted (copy.copy(pretty_printers), + key = self.printer_name) + for printer in sorted_pretty_printers: + name = self.printer_name(printer) + enabled = self.enabled_string(printer) + if name_re.match(name): + print (" %s%s" % (name, enabled)) + if (hasattr(printer, "subprinters") and + printer.subprinters is not None): + sorted_subprinters = sorted (copy.copy(printer.subprinters), + key = self.printer_name) + for subprinter in sorted_subprinters: + if (not subname_re or + subname_re.match(subprinter.name)): + print (" %s%s" % + (subprinter.name, + self.enabled_string(subprinter))) + + def invoke1(self, title, printer_list, + obj_name_to_match, object_re, name_re, subname_re): + """Subroutine of invoke to simplify it.""" + if printer_list and object_re.match(obj_name_to_match): + print (title) + self.list_pretty_printers(printer_list, name_re, subname_re) + + def invoke(self, arg, from_tty): + """GDB calls this to perform the command.""" + (object_re, name_re, subname_re) = parse_printer_regexps(arg) + self.invoke1("global pretty-printers:", gdb.pretty_printers, + "global", object_re, name_re, subname_re) + cp = gdb.current_progspace() + self.invoke1("progspace %s pretty-printers:" % cp.filename, + cp.pretty_printers, "progspace", + object_re, name_re, subname_re) + for objfile in gdb.objfiles(): + self.invoke1("objfile %s pretty-printers:" % objfile.filename, + objfile.pretty_printers, objfile.filename, + object_re, name_re, subname_re) + + +def count_enabled_printers(pretty_printers): + """Return a 2-tuple of number of enabled and total printers.""" + enabled = 0 + total = 0 + for printer in pretty_printers: + if (hasattr(printer, "subprinters") + and printer.subprinters is not None): + if printer_enabled_p(printer): + for subprinter in printer.subprinters: + if printer_enabled_p(subprinter): + enabled += 1 + total += len(printer.subprinters) + else: + if printer_enabled_p(printer): + enabled += 1 + total += 1 + return (enabled, total) + + +def count_all_enabled_printers(): + """Return a 2-tuble of the enabled state and total number of all printers. + This includes subprinters. + """ + enabled_count = 0 + total_count = 0 + (t_enabled, t_total) = count_enabled_printers(gdb.pretty_printers) + enabled_count += t_enabled + total_count += t_total + (t_enabled, t_total) = count_enabled_printers(gdb.current_progspace().pretty_printers) + enabled_count += t_enabled + total_count += t_total + for objfile in gdb.objfiles(): + (t_enabled, t_total) = count_enabled_printers(objfile.pretty_printers) + enabled_count += t_enabled + total_count += t_total + return (enabled_count, total_count) + + +def pluralize(text, n, suffix="s"): + """Return TEXT pluralized if N != 1.""" + if n != 1: + return "%s%s" % (text, suffix) + else: + return text + + +def show_pretty_printer_enabled_summary(): + """Print the number of printers enabled/disabled. + We count subprinters individually. + """ + (enabled_count, total_count) = count_all_enabled_printers() + print ("%d of %d printers enabled" % (enabled_count, total_count)) + + +def do_enable_pretty_printer_1 (pretty_printers, name_re, subname_re, flag): + """Worker for enabling/disabling pretty-printers. + + Arguments: + pretty_printers: list of pretty-printers + name_re: regular-expression object to select printers + subname_re: regular expression object to select subprinters or None + if all are affected + flag: True for Enable, False for Disable + + Returns: + The number of printers affected. + This is just for informational purposes for the user. + """ + total = 0 + for printer in pretty_printers: + if (hasattr(printer, "name") and name_re.match(printer.name) or + hasattr(printer, "__name__") and name_re.match(printer.__name__)): + if (hasattr(printer, "subprinters") and + printer.subprinters is not None): + if not subname_re: + # Only record printers that change state. + if printer_enabled_p(printer) != flag: + for subprinter in printer.subprinters: + if printer_enabled_p(subprinter): + total += 1 + # NOTE: We preserve individual subprinter settings. + printer.enabled = flag + else: + # NOTE: Whether this actually disables the subprinter + # depends on whether the printer's lookup function supports + # the "enable" API. We can only assume it does. + for subprinter in printer.subprinters: + if subname_re.match(subprinter.name): + # Only record printers that change state. + if (printer_enabled_p(printer) and + printer_enabled_p(subprinter) != flag): + total += 1 + subprinter.enabled = flag + else: + # This printer has no subprinters. + # If the user does "disable pretty-printer .* .* foo" + # should we disable printers that don't have subprinters? + # How do we apply "foo" in this context? Since there is no + # "foo" subprinter it feels like we should skip this printer. + # There's still the issue of how to handle + # "disable pretty-printer .* .* .*", and every other variation + # that can match everything. For now punt and only support + # "disable pretty-printer .* .*" (i.e. subname is elided) + # to disable everything. + if not subname_re: + # Only record printers that change state. + if printer_enabled_p(printer) != flag: + total += 1 + printer.enabled = flag + return total + + +def do_enable_pretty_printer (arg, flag): + """Internal worker for enabling/disabling pretty-printers.""" + (object_re, name_re, subname_re) = parse_printer_regexps(arg) + + total = 0 + if object_re.match("global"): + total += do_enable_pretty_printer_1(gdb.pretty_printers, + name_re, subname_re, flag) + cp = gdb.current_progspace() + if object_re.match("progspace"): + total += do_enable_pretty_printer_1(cp.pretty_printers, + name_re, subname_re, flag) + for objfile in gdb.objfiles(): + if object_re.match(objfile.filename): + total += do_enable_pretty_printer_1(objfile.pretty_printers, + name_re, subname_re, flag) + + if flag: + state = "enabled" + else: + state = "disabled" + print ("%d %s %s" % (total, pluralize("printer", total), state)) + + # Print the total list of printers currently enabled/disabled. + # This is to further assist the user in determining whether the result + # is expected. Since we use regexps to select it's useful. + show_pretty_printer_enabled_summary() + + +# Enable/Disable one or more pretty-printers. +# +# This is intended for use when a broken pretty-printer is shipped/installed +# and the user wants to disable that printer without disabling all the other +# printers. +# +# A useful addition would be -v (verbose) to show each printer affected. + +class EnablePrettyPrinter (gdb.Command): + """GDB command to enable the specified pretty-printer. + +Usage: enable pretty-printer [OBJECT-REGEXP [NAME-REGEXP]] + +OBJECT-REGEXP is a regular expression matching the objects to examine. +Objects are "global", the program space's file, and the objfiles within +that program space. + +NAME-REGEXP matches the name of the pretty-printer. +Individual printers in a collection are named as +printer-name;subprinter-name.""" + + def __init__(self): + super(EnablePrettyPrinter, self).__init__("enable pretty-printer", + gdb.COMMAND_DATA) + + def invoke(self, arg, from_tty): + """GDB calls this to perform the command.""" + do_enable_pretty_printer(arg, True) + + +class DisablePrettyPrinter (gdb.Command): + """GDB command to disable the specified pretty-printer. + +Usage: disable pretty-printer [OBJECT-REGEXP [NAME-REGEXP]] + +OBJECT-REGEXP is a regular expression matching the objects to examine. +Objects are "global", the program space's file, and the objfiles within +that program space. + +NAME-REGEXP matches the name of the pretty-printer. +Individual printers in a collection are named as +printer-name;subprinter-name.""" + + def __init__(self): + super(DisablePrettyPrinter, self).__init__("disable pretty-printer", + gdb.COMMAND_DATA) + + def invoke(self, arg, from_tty): + """GDB calls this to perform the command.""" + do_enable_pretty_printer(arg, False) + + +def register_pretty_printer_commands(): + """Call from a top level script to install the pretty-printer commands.""" + InfoPrettyPrinter() + EnablePrettyPrinter() + DisablePrettyPrinter() + +register_pretty_printer_commands() diff --git a/tools/msys/mingw64/share/gdb/python/gdb/command/prompt.py b/tools/msys/mingw64/share/gdb/python/gdb/command/prompt.py new file mode 100644 index 0000000000000000000000000000000000000000..69ab57ba9d299ab99f51425613233ad645379309 --- /dev/null +++ b/tools/msys/mingw64/share/gdb/python/gdb/command/prompt.py @@ -0,0 +1,65 @@ +# Extended prompt. +# Copyright (C) 2011-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""GDB command for working with extended prompts.""" + +import gdb +import gdb.prompt + +class _ExtendedPrompt(gdb.Parameter): + + """Set the extended prompt. + +Usage: set extended-prompt VALUE + +Substitutions are applied to VALUE to compute the real prompt. + +The currently defined substitutions are: + +""" + # Add the prompt library's dynamically generated help to the + # __doc__ string. + __doc__ = __doc__ + gdb.prompt.prompt_help() + + set_doc = "Set the extended prompt." + show_doc = "Show the extended prompt." + + def __init__(self): + super(_ExtendedPrompt, self).__init__("extended-prompt", + gdb.COMMAND_SUPPORT, + gdb.PARAM_STRING_NOESCAPE) + self.value = '' + self.hook_set = False + + def get_show_string (self, pvalue): + if self.value: + return "The extended prompt is: " + self.value + else: + return "The extended prompt is not set." + + def get_set_string (self): + if self.hook_set == False: + gdb.prompt_hook = self.before_prompt_hook + self.hook_set = True + return "" + + def before_prompt_hook(self, current): + if self.value: + return gdb.prompt.substitute_prompt(self.value) + else: + return None + +_ExtendedPrompt() diff --git a/tools/msys/mingw64/share/gdb/python/gdb/command/type_printers.py b/tools/msys/mingw64/share/gdb/python/gdb/command/type_printers.py new file mode 100644 index 0000000000000000000000000000000000000000..af26abdf5780a1962b8f5f610315883a55c9507a --- /dev/null +++ b/tools/msys/mingw64/share/gdb/python/gdb/command/type_printers.py @@ -0,0 +1,122 @@ +# Type printer commands. +# Copyright (C) 2010-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import copy +import gdb + +"""GDB commands for working with type-printers.""" + +class InfoTypePrinter(gdb.Command): + """GDB command to list all registered type-printers. + +Usage: info type-printers""" + + def __init__ (self): + super(InfoTypePrinter, self).__init__("info type-printers", + gdb.COMMAND_DATA) + + def list_type_printers(self, type_printers): + """Print a list of type printers.""" + # A potential enhancement is to provide an option to list printers in + # "lookup order" (i.e. unsorted). + sorted_type_printers = sorted (copy.copy(type_printers), + key = lambda x: x.name) + for printer in sorted_type_printers: + if printer.enabled: + enabled = '' + else: + enabled = " [disabled]" + print (" %s%s" % (printer.name, enabled)) + + def invoke(self, arg, from_tty): + """GDB calls this to perform the command.""" + sep = '' + for objfile in gdb.objfiles(): + if objfile.type_printers: + print ("%sType printers for %s:" % (sep, objfile.filename)) + self.list_type_printers(objfile.type_printers) + sep = '\n' + if gdb.current_progspace().type_printers: + print ("%sType printers for program space:" % sep) + self.list_type_printers(gdb.current_progspace().type_printers) + sep = '\n' + if gdb.type_printers: + print ("%sGlobal type printers:" % sep) + self.list_type_printers(gdb.type_printers) + +class _EnableOrDisableCommand(gdb.Command): + def __init__(self, setting, name): + super(_EnableOrDisableCommand, self).__init__(name, gdb.COMMAND_DATA) + self.setting = setting + + def set_some(self, name, printers): + result = False + for p in printers: + if name == p.name: + p.enabled = self.setting + result = True + return result + + def invoke(self, arg, from_tty): + """GDB calls this to perform the command.""" + for name in arg.split(): + ok = False + for objfile in gdb.objfiles(): + if self.set_some(name, objfile.type_printers): + ok = True + if self.set_some(name, gdb.current_progspace().type_printers): + ok = True + if self.set_some(name, gdb.type_printers): + ok = True + if not ok: + print ("No type printer named '%s'" % name) + + def add_some(self, result, word, printers): + for p in printers: + if p.name.startswith(word): + result.append(p.name) + + def complete(self, text, word): + result = [] + for objfile in gdb.objfiles(): + self.add_some(result, word, objfile.type_printers) + self.add_some(result, word, gdb.current_progspace().type_printers) + self.add_some(result, word, gdb.type_printers) + return result + +class EnableTypePrinter(_EnableOrDisableCommand): + """GDB command to enable the specified type printer. + +Usage: enable type-printer NAME + +NAME is the name of the type-printer.""" + + def __init__(self): + super(EnableTypePrinter, self).__init__(True, "enable type-printer") + +class DisableTypePrinter(_EnableOrDisableCommand): + """GDB command to disable the specified type-printer. + +Usage: disable type-printer NAME + +NAME is the name of the type-printer.""" + + def __init__(self): + super(DisableTypePrinter, self).__init__(False, "disable type-printer") + +InfoTypePrinter() +EnableTypePrinter() +DisableTypePrinter() diff --git a/tools/msys/mingw64/share/gdb/python/gdb/command/unwinders.py b/tools/msys/mingw64/share/gdb/python/gdb/command/unwinders.py new file mode 100644 index 0000000000000000000000000000000000000000..b1edd96ab89e9a3be67eb09e2600a70d8e5839ef --- /dev/null +++ b/tools/msys/mingw64/share/gdb/python/gdb/command/unwinders.py @@ -0,0 +1,195 @@ +# Unwinder commands. +# Copyright 2015-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import gdb +import re + + +def validate_regexp(exp, idstring): + try: + return re.compile(exp) + except SyntaxError: + raise SyntaxError("Invalid %s regexp: %s." % (idstring, exp)) + + +def parse_unwinder_command_args(arg): + """Internal utility to parse unwinder command argv. + + Arguments: + arg: The arguments to the command. The format is: + [locus-regexp [name-regexp]] + + Returns: + A 2-tuple of compiled regular expressions. + + Raises: + SyntaxError: an error processing ARG + """ + + argv = gdb.string_to_argv(arg) + argc = len(argv) + if argc > 2: + raise SyntaxError("Too many arguments.") + locus_regexp = "" + name_regexp = "" + if argc >= 1: + locus_regexp = argv[0] + if argc >= 2: + name_regexp = argv[1] + return (validate_regexp(locus_regexp, "locus"), + validate_regexp(name_regexp, "unwinder")) + + +class InfoUnwinder(gdb.Command): + """GDB command to list unwinders. + +Usage: info unwinder [LOCUS-REGEXP [NAME-REGEXP]] + +LOCUS-REGEXP is a regular expression matching the location of the +unwinder. If it is omitted, all registered unwinders from all +loci are listed. A locus can be 'global', 'progspace' to list +the unwinders from the current progspace, or a regular expression +matching filenames of objfiles. + +NAME-REGEXP is a regular expression to filter unwinder names. If +this omitted for a specified locus, then all registered unwinders +in the locus are listed.""" + + def __init__(self): + super(InfoUnwinder, self).__init__("info unwinder", + gdb.COMMAND_STACK) + + def list_unwinders(self, title, unwinders, name_re): + """Lists the unwinders whose name matches regexp. + + Arguments: + title: The line to print before the list. + unwinders: The list of the unwinders. + name_re: unwinder name filter. + """ + if not unwinders: + return + print(title) + for unwinder in unwinders: + if name_re.match(unwinder.name): + print(" %s%s" % (unwinder.name, + "" if unwinder.enabled else " [disabled]")) + + def invoke(self, arg, from_tty): + locus_re, name_re = parse_unwinder_command_args(arg) + if locus_re.match("global"): + self.list_unwinders("Global:", gdb.frame_unwinders, + name_re) + if locus_re.match("progspace"): + cp = gdb.current_progspace() + self.list_unwinders("Progspace %s:" % cp.filename, + cp.frame_unwinders, name_re) + for objfile in gdb.objfiles(): + if locus_re.match(objfile.filename): + self.list_unwinders("Objfile %s:" % objfile.filename, + objfile.frame_unwinders, name_re) + + +def do_enable_unwinder1(unwinders, name_re, flag): + """Enable/disable unwinders whose names match given regex. + + Arguments: + unwinders: The list of unwinders. + name_re: Unwinder name filter. + flag: Enable/disable. + + Returns: + The number of unwinders affected. + """ + total = 0 + for unwinder in unwinders: + if name_re.match(unwinder.name): + unwinder.enabled = flag + total += 1 + return total + + +def do_enable_unwinder(arg, flag): + """Enable/disable unwinder(s).""" + (locus_re, name_re) = parse_unwinder_command_args(arg) + total = 0 + if locus_re.match("global"): + total += do_enable_unwinder1(gdb.frame_unwinders, name_re, flag) + if locus_re.match("progspace"): + total += do_enable_unwinder1(gdb.current_progspace().frame_unwinders, + name_re, flag) + for objfile in gdb.objfiles(): + if locus_re.match(objfile.filename): + total += do_enable_unwinder1(objfile.frame_unwinders, name_re, + flag) + if total > 0: + gdb.invalidate_cached_frames() + print("%d unwinder%s %s" % (total, "" if total == 1 else "s", + "enabled" if flag else "disabled")) + + +class EnableUnwinder(gdb.Command): + """GDB command to enable unwinders. + +Usage: enable unwinder [LOCUS-REGEXP [NAME-REGEXP]] + +LOCUS-REGEXP is a regular expression specifying the unwinders to +enable. It can 'global', 'progspace', or the name of an objfile +within that progspace. + +NAME_REGEXP is a regular expression to filter unwinder names. If +this omitted for a specified locus, then all registered unwinders +in the locus are affected.""" + + def __init__(self): + super(EnableUnwinder, self).__init__("enable unwinder", + gdb.COMMAND_STACK) + + def invoke(self, arg, from_tty): + """GDB calls this to perform the command.""" + do_enable_unwinder(arg, True) + + +class DisableUnwinder(gdb.Command): + """GDB command to disable the specified unwinder. + +Usage: disable unwinder [LOCUS-REGEXP [NAME-REGEXP]] + +LOCUS-REGEXP is a regular expression specifying the unwinders to +disable. It can 'global', 'progspace', or the name of an objfile +within that progspace. + +NAME_REGEXP is a regular expression to filter unwinder names. If +this omitted for a specified locus, then all registered unwinders +in the locus are affected.""" + + def __init__(self): + super(DisableUnwinder, self).__init__("disable unwinder", + gdb.COMMAND_STACK) + + def invoke(self, arg, from_tty): + """GDB calls this to perform the command.""" + do_enable_unwinder(arg, False) + + +def register_unwinder_commands(): + """Installs the unwinder commands.""" + InfoUnwinder() + EnableUnwinder() + DisableUnwinder() + + +register_unwinder_commands() diff --git a/tools/msys/mingw64/share/gdb/python/gdb/command/xmethods.py b/tools/msys/mingw64/share/gdb/python/gdb/command/xmethods.py new file mode 100644 index 0000000000000000000000000000000000000000..41fd8ed49082aa687d5e3599c05854187172628c --- /dev/null +++ b/tools/msys/mingw64/share/gdb/python/gdb/command/xmethods.py @@ -0,0 +1,271 @@ +# Xmethod commands. +# Copyright 2013-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import gdb +import re + +"""GDB commands for working with xmethods.""" + + +def validate_xm_regexp(part_name, regexp): + try: + return re.compile(regexp) + except SyntaxError: + raise SyntaxError("Invalid %s regexp: %s", part_name, regexp) + + +def parse_xm_command_args(arg): + """Parses the arguments passed to a xmethod command. + + Arguments: + arg: The argument string passed to a xmethod command. + + Returns: + A 3-tuple: (<locus matching regular expression>, + <matcher matching regular expression>, + <name matching regular experession>) + """ + argv = gdb.string_to_argv(arg) + argc = len(argv) + if argc > 2: + raise SyntaxError("Too many arguments to command.") + locus_regexp = "" + matcher_name_regexp = "" + xm_name_regexp = None + if argc >= 1: + locus_regexp = argv[0] + if argc == 2: + parts = argv[1].split(";", 1) + matcher_name_regexp = parts[0] + if len(parts) > 1: + xm_name_regexp = parts[1] + if xm_name_regexp: + name_re = validate_xm_regexp("xmethod name", xm_name_regexp) + else: + name_re = None + return (validate_xm_regexp("locus", locus_regexp), + validate_xm_regexp("matcher name", matcher_name_regexp), + name_re) + + +def get_global_method_matchers(locus_re, matcher_re): + """Returns a dict of matching globally registered xmethods. + + Arguments: + locus_re: Even though only globally registered xmethods are + looked up, they will be looked up only if 'global' matches + LOCUS_RE. + matcher_re: The regular expression matching the names of xmethods. + + Returns: + A dict of matching globally registered xmethod matchers. The only + key in the dict will be 'global'. + """ + locus_str = "global" + xm_dict = { locus_str: [] } + if locus_re.match("global"): + xm_dict[locus_str].extend( + [m for m in gdb.xmethods if matcher_re.match(m.name)]) + return xm_dict + + +def get_method_matchers_in_loci(loci, locus_re, matcher_re): + """Returns a dict of matching registered xmethods in the LOCI. + + Arguments: + loci: The list of loci to lookup matching xmethods in. + locus_re: If a locus is an objfile, then xmethod matchers will be + looked up in it only if its filename matches the regular + expression LOCUS_RE. If a locus is the current progspace, + then xmethod matchers will be looked up in it only if the + string "progspace" matches LOCUS_RE. + matcher_re: The regular expression to match the xmethod matcher + names. + + Returns: + A dict of matching xmethod matchers. The keys of the dict are the + filenames of the loci the xmethod matchers belong to. + """ + xm_dict = {} + for locus in loci: + if isinstance(locus, gdb.Progspace): + if not locus_re.match('progspace'): + continue + locus_type = "progspace" + else: + if not locus_re.match(locus.filename): + continue + locus_type = "objfile" + locus_str = "%s %s" % (locus_type, locus.filename) + xm_dict[locus_str] = [ + m for m in locus.xmethods if matcher_re.match(m.name)] + return xm_dict + + +def print_xm_info(xm_dict, name_re): + """Print a dictionary of xmethods.""" + def get_status_string(m): + if not m.enabled: + return " [disabled]" + else: + return "" + + if not xm_dict: + return + for locus_str in xm_dict: + if not xm_dict[locus_str]: + continue + print ("Xmethods in %s:" % locus_str) + for matcher in xm_dict[locus_str]: + print (" %s%s" % (matcher.name, get_status_string(matcher))) + if not matcher.methods: + continue + for m in matcher.methods: + if name_re is None or name_re.match(m.name): + print (" %s%s" % (m.name, get_status_string(m))) + + +def set_xm_status1(xm_dict, name_re, status): + """Set the status (enabled/disabled) of a dictionary of xmethods.""" + for locus_str, matchers in xm_dict.items(): + for matcher in matchers: + if not name_re: + # If the name regex is missing, then set the status of the + # matcher and move on. + matcher.enabled = status + continue + if not matcher.methods: + # The methods attribute could be None. Move on. + continue + for m in matcher.methods: + if name_re.match(m.name): + m.enabled = status + + +def set_xm_status(arg, status): + """Set the status (enabled/disabled) of xmethods matching ARG. + This is a helper function for enable/disable commands. ARG is the + argument string passed to the commands. + """ + locus_re, matcher_re, name_re = parse_xm_command_args(arg) + set_xm_status1(get_global_method_matchers(locus_re, matcher_re), name_re, + status) + set_xm_status1( + get_method_matchers_in_loci( + [gdb.current_progspace()], locus_re, matcher_re), + name_re, + status) + set_xm_status1( + get_method_matchers_in_loci(gdb.objfiles(), locus_re, matcher_re), + name_re, + status) + + +class InfoXMethod(gdb.Command): + """GDB command to list registered xmethod matchers. + +Usage: info xmethod [LOCUS-REGEXP [NAME-REGEXP]] + +LOCUS-REGEXP is a regular expression matching the location of the +xmethod matchers. If it is omitted, all registered xmethod matchers +from all loci are listed. A locus could be 'global', a regular expression +matching the current program space's filename, or a regular expression +matching filenames of objfiles. Locus could be 'progspace' to specify that +only xmethods from the current progspace should be listed. + +NAME-REGEXP is a regular expression matching the names of xmethod +matchers. If this omitted for a specified locus, then all registered +xmethods in the locus are listed. To list only a certain xmethods +managed by a single matcher, the name regexp can be specified as +matcher-name-regexp;xmethod-name-regexp.""" + + def __init__(self): + super(InfoXMethod, self).__init__("info xmethod", + gdb.COMMAND_DATA) + + def invoke(self, arg, from_tty): + locus_re, matcher_re, name_re = parse_xm_command_args(arg) + print_xm_info(get_global_method_matchers(locus_re, matcher_re), + name_re) + print_xm_info( + get_method_matchers_in_loci( + [gdb.current_progspace()], locus_re, matcher_re), + name_re) + print_xm_info( + get_method_matchers_in_loci(gdb.objfiles(), locus_re, matcher_re), + name_re) + + +class EnableXMethod(gdb.Command): + """GDB command to enable a specified (group of) xmethod(s). + +Usage: enable xmethod [LOCUS-REGEXP [NAME-REGEXP]] + +LOCUS-REGEXP is a regular expression matching the location of the +xmethod matchers. If it is omitted, all registered xmethods matchers +from all loci are enabled. A locus could be 'global', a regular expression +matching the current program space's filename, or a regular expression +matching filenames of objfiles. Locus could be 'progspace' to specify that +only xmethods from the current progspace should be enabled. + +NAME-REGEXP is a regular expression matching the names of xmethods +within a given locus. If this omitted for a specified locus, then all +registered xmethod matchers in the locus are enabled. To enable only +a certain xmethods managed by a single matcher, the name regexp can be +specified as matcher-name-regexp;xmethod-name-regexp.""" + + def __init__(self): + super(EnableXMethod, self).__init__("enable xmethod", + gdb.COMMAND_DATA) + + def invoke(self, arg, from_tty): + set_xm_status(arg, True) + + +class DisableXMethod(gdb.Command): + """GDB command to disable a specified (group of) xmethod(s). + +Usage: disable xmethod [LOCUS-REGEXP [NAME-REGEXP]] + +LOCUS-REGEXP is a regular expression matching the location of the +xmethod matchers. If it is omitted, all registered xmethod matchers +from all loci are disabled. A locus could be 'global', a regular +expression matching the current program space's filename, or a regular +expression filenames of objfiles. Locus could be 'progspace' to specify +that only xmethods from the current progspace should be disabled. + +NAME-REGEXP is a regular expression matching the names of xmethods +within a given locus. If this omitted for a specified locus, then all +registered xmethod matchers in the locus are disabled. To disable +only a certain xmethods managed by a single matcher, the name regexp +can be specified as matcher-name-regexp;xmethod-name-regexp.""" + + def __init__(self): + super(DisableXMethod, self).__init__("disable xmethod", + gdb.COMMAND_DATA) + + def invoke(self, arg, from_tty): + set_xm_status(arg, False) + + +def register_xmethod_commands(): + """Installs the xmethod commands.""" + InfoXMethod() + EnableXMethod() + DisableXMethod() + + +register_xmethod_commands() diff --git a/tools/msys/mingw64/share/gdb/python/gdb/frames.py b/tools/msys/mingw64/share/gdb/python/gdb/frames.py new file mode 100644 index 0000000000000000000000000000000000000000..79bea39daa9d428f73485fb441d7d486883d7b3d --- /dev/null +++ b/tools/msys/mingw64/share/gdb/python/gdb/frames.py @@ -0,0 +1,228 @@ +# Frame-filter commands. +# Copyright (C) 2013-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""Internal functions for working with frame-filters.""" + +import gdb +from gdb.FrameIterator import FrameIterator +from gdb.FrameDecorator import FrameDecorator +import itertools +import collections + +def get_priority(filter_item): + """ Internal worker function to return the frame-filter's priority + from a frame filter object. This is a fail free function as it is + used in sorting and filtering. If a badly implemented frame + filter does not implement the priority attribute, return zero + (otherwise sorting/filtering will fail and prevent other frame + filters from executing). + + Arguments: + filter_item: An object conforming to the frame filter + interface. + + Returns: + The priority of the frame filter from the "priority" + attribute, or zero. + """ + # Do not fail here, as the sort will fail. If a filter has not + # (incorrectly) set a priority, set it to zero. + return getattr(filter_item, "priority", 0) + +def set_priority(filter_item, priority): + """ Internal worker function to set the frame-filter's priority. + + Arguments: + filter_item: An object conforming to the frame filter + interface. + priority: The priority to assign as an integer. + """ + + filter_item.priority = priority + +def get_enabled(filter_item): + """ Internal worker function to return a filter's enabled state + from a frame filter object. This is a fail free function as it is + used in sorting and filtering. If a badly implemented frame + filter does not implement the enabled attribute, return False + (otherwise sorting/filtering will fail and prevent other frame + filters from executing). + + Arguments: + filter_item: An object conforming to the frame filter + interface. + + Returns: + The enabled state of the frame filter from the "enabled" + attribute, or False. + """ + + # If the filter class is badly implemented when called from the + # Python filter command, do not cease filter operations, just set + # enabled to False. + return getattr(filter_item, "enabled", False) + +def set_enabled(filter_item, state): + """ Internal Worker function to set the frame-filter's enabled + state. + + Arguments: + filter_item: An object conforming to the frame filter + interface. + state: True or False, depending on desired state. + """ + + filter_item.enabled = state + +def return_list(name): + """ Internal Worker function to return the frame filter + dictionary, depending on the name supplied as an argument. If the + name is not "all", "global" or "progspace", it is assumed to name + an object-file. + + Arguments: + name: The name of the list, as specified by GDB user commands. + + Returns: + A dictionary object for a single specified dictionary, or a + list containing all the items for "all" + + Raises: + gdb.GdbError: A dictionary of that name cannot be found. + """ + + # If all dictionaries are wanted in the case of "all" we + # cannot return a combined dictionary as keys() may clash in + # between different dictionaries. As we just want all the frame + # filters to enable/disable them all, just return the combined + # items() as a chained iterator of dictionary values. + if name == "all": + glob = gdb.frame_filters.values() + prog = gdb.current_progspace().frame_filters.values() + return_iter = itertools.chain(glob, prog) + for objfile in gdb.objfiles(): + return_iter = itertools.chain(return_iter, objfile.frame_filters.values()) + + return return_iter + + if name == "global": + return gdb.frame_filters + else: + if name == "progspace": + cp = gdb.current_progspace() + return cp.frame_filters + else: + for objfile in gdb.objfiles(): + if name == objfile.filename: + return objfile.frame_filters + + msg = "Cannot find frame-filter dictionary for '" + name + "'" + raise gdb.GdbError(msg) + +def _sort_list(): + """ Internal Worker function to merge all known frame-filter + lists, prune any filters with the state set to "disabled", and + sort the list on the frame-filter's "priority" attribute. + + Returns: + sorted_list: A sorted, pruned list of frame filters to + execute. + """ + + all_filters = return_list("all") + sorted_frame_filters = sorted(all_filters, key = get_priority, + reverse = True) + + sorted_frame_filters = filter(get_enabled, + sorted_frame_filters) + + return sorted_frame_filters + +def execute_frame_filters(frame, frame_low, frame_high): + """ Internal function called from GDB that will execute the chain + of frame filters. Each filter is executed in priority order. + After the execution completes, slice the iterator to frame_low - + frame_high range. + + Arguments: + frame: The initial frame. + + frame_low: The low range of the slice. If this is a negative + integer then it indicates a backward slice (ie bt -4) which + counts backward from the last frame in the backtrace. + + frame_high: The high range of the slice. If this is -1 then + it indicates all frames until the end of the stack from + frame_low. + + Returns: + frame_iterator: The sliced iterator after all frame + filters have had a change to execute, or None if no frame + filters are registered. + """ + + # Get a sorted list of frame filters. + sorted_list = list(_sort_list()) + + # Check to see if there are any frame-filters. If not, just + # return None and let default backtrace printing occur. + if len(sorted_list) == 0: + return None + + frame_iterator = FrameIterator(frame) + + # Apply a basic frame decorator to all gdb.Frames. This unifies + # the interface. Python 3.x moved the itertools.imap + # functionality to map(), so check if it is available. + if hasattr(itertools,"imap"): + frame_iterator = itertools.imap(FrameDecorator, frame_iterator) + else: + frame_iterator = map(FrameDecorator, frame_iterator) + + for ff in sorted_list: + frame_iterator = ff.filter(frame_iterator) + + # Slicing + + # Is this a slice from the end of the backtrace, ie bt -2? + if frame_low < 0: + count = 0 + slice_length = abs(frame_low) + # We cannot use MAXLEN argument for deque as it is 2.6 onwards + # and some GDB versions might be < 2.6. + sliced = collections.deque() + + for frame_item in frame_iterator: + if count >= slice_length: + sliced.popleft(); + count = count + 1 + sliced.append(frame_item) + + return iter(sliced) + + # -1 for frame_high means until the end of the backtrace. Set to + # None if that is the case, to indicate to itertools.islice to + # slice to the end of the iterator. + if frame_high == -1: + frame_high = None + else: + # As frames start from 0, add one to frame_high so islice + # correctly finds the end + frame_high = frame_high + 1; + + sliced = itertools.islice(frame_iterator, frame_low, frame_high) + + return sliced diff --git a/tools/msys/mingw64/share/gdb/python/gdb/function/__init__.py b/tools/msys/mingw64/share/gdb/python/gdb/function/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..862ea83bb8df51abe3d1e80439c7241885c685a2 --- /dev/null +++ b/tools/msys/mingw64/share/gdb/python/gdb/function/__init__.py @@ -0,0 +1,14 @@ +# Copyright (C) 2012-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. diff --git a/tools/msys/mingw64/share/gdb/python/gdb/function/as_string.py b/tools/msys/mingw64/share/gdb/python/gdb/function/as_string.py new file mode 100644 index 0000000000000000000000000000000000000000..d17bee61cfcc2f629ed320da2ba953889cb68911 --- /dev/null +++ b/tools/msys/mingw64/share/gdb/python/gdb/function/as_string.py @@ -0,0 +1,37 @@ +# Copyright (C) 2016-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import gdb + + +class _AsString(gdb.Function): + """Return the string representation of a value. + +Usage: $_as_string (VALUE) + +Arguments: + + VALUE: any value + +Returns: + The string representation of the value.""" + + def __init__(self): + super(_AsString, self).__init__("_as_string") + + def invoke(self, val): + return str(val) + +_AsString() diff --git a/tools/msys/mingw64/share/gdb/python/gdb/function/caller_is.py b/tools/msys/mingw64/share/gdb/python/gdb/function/caller_is.py new file mode 100644 index 0000000000000000000000000000000000000000..56e5111ba0ebdcd06f0f03b13cb66a8ce2b5a9d2 --- /dev/null +++ b/tools/msys/mingw64/share/gdb/python/gdb/function/caller_is.py @@ -0,0 +1,152 @@ +# Caller-is functions. +# Copyright (C) 2008-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import gdb +import re + +class CallerIs(gdb.Function): + """Check the calling function's name. + +Usage: $_caller_is (NAME [, NUMBER-OF-FRAMES]) + +Arguments: + + NAME: The name of the function to search for. + + NUMBER-OF-FRAMES: How many stack frames to traverse back from the currently + selected frame to compare with. If the value is greater than the depth of + the stack from that point then the result is False. + The default is 1. + +Returns: + True if the function's name at the specified frame is equal to NAME.""" + + def __init__(self): + super(CallerIs, self).__init__("_caller_is") + + def invoke(self, name, nframes = 1): + if nframes < 0: + raise ValueError("nframes must be >= 0") + frame = gdb.selected_frame() + while nframes > 0: + frame = frame.older() + if frame is None: + return False + nframes = nframes - 1 + return frame.name() == name.string() + +class CallerMatches(gdb.Function): + """Compare the calling function's name with a regexp. + +Usage: $_caller_matches (REGEX [, NUMBER-OF-FRAMES]) + +Arguments: + + REGEX: The regular expression to compare the function's name with. + + NUMBER-OF-FRAMES: How many stack frames to traverse back from the currently + selected frame to compare with. If the value is greater than the depth of + the stack from that point then the result is False. + The default is 1. + +Returns: + True if the function's name at the specified frame matches REGEX.""" + + def __init__(self): + super(CallerMatches, self).__init__("_caller_matches") + + def invoke(self, name, nframes = 1): + if nframes < 0: + raise ValueError("nframes must be >= 0") + frame = gdb.selected_frame() + while nframes > 0: + frame = frame.older() + if frame is None: + return False + nframes = nframes - 1 + return re.match(name.string(), frame.name()) is not None + +class AnyCallerIs(gdb.Function): + """Check all calling function's names. + +Usage: $_any_caller_is (NAME [, NUMBER-OF-FRAMES]) + +Arguments: + + NAME: The name of the function to search for. + + NUMBER-OF-FRAMES: How many stack frames to traverse back from the currently + selected frame to compare with. If the value is greater than the depth of + the stack from that point then the result is False. + The default is 1. + +Returns: + True if any function's name is equal to NAME.""" + + def __init__(self): + super(AnyCallerIs, self).__init__("_any_caller_is") + + def invoke(self, name, nframes = 1): + if nframes < 0: + raise ValueError("nframes must be >= 0") + frame = gdb.selected_frame() + while nframes >= 0: + if frame.name() == name.string(): + return True + frame = frame.older() + if frame is None: + return False + nframes = nframes - 1 + return False + +class AnyCallerMatches(gdb.Function): + """Compare all calling function's names with a regexp. + +Usage: $_any_caller_matches (REGEX [, NUMBER-OF-FRAMES]) + +Arguments: + + REGEX: The regular expression to compare the function's name with. + + NUMBER-OF-FRAMES: How many stack frames to traverse back from the currently + selected frame to compare with. If the value is greater than the depth of + the stack from that point then the result is False. + The default is 1. + +Returns: + True if any function's name matches REGEX.""" + + def __init__(self): + super(AnyCallerMatches, self).__init__("_any_caller_matches") + + def invoke(self, name, nframes = 1): + if nframes < 0: + raise ValueError("nframes must be >= 0") + frame = gdb.selected_frame() + name_re = re.compile(name.string()) + while nframes >= 0: + if name_re.match(frame.name()) is not None: + return True + frame = frame.older() + if frame is None: + return False + nframes = nframes - 1 + return False + +CallerIs() +CallerMatches() +AnyCallerIs() +AnyCallerMatches() diff --git a/tools/msys/mingw64/share/gdb/python/gdb/function/strfns.py b/tools/msys/mingw64/share/gdb/python/gdb/function/strfns.py new file mode 100644 index 0000000000000000000000000000000000000000..7fc7909a381daa1c4417f3d5bd3f84d0392f8bf3 --- /dev/null +++ b/tools/msys/mingw64/share/gdb/python/gdb/function/strfns.py @@ -0,0 +1,100 @@ +# Useful gdb string convenience functions. +# Copyright (C) 2012-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""$_memeq, $_strlen, $_streq, $_regex""" + +import gdb +import re + + +class _MemEq(gdb.Function): + """$_memeq - compare bytes of memory. + +Usage: $_memeq (A, B, LEN) + +Returns: + True if LEN bytes at A and B compare equally.""" + def __init__(self): + super(_MemEq, self).__init__("_memeq") + + def invoke(self, a, b, length): + if length < 0: + raise ValueError("length must be non-negative") + if length == 0: + return True + # The argument(s) to vector are [low_bound,]high_bound. + byte_vector = gdb.lookup_type("char").vector(length - 1) + ptr_byte_vector = byte_vector.pointer() + a_ptr = a.reinterpret_cast(ptr_byte_vector) + b_ptr = b.reinterpret_cast(ptr_byte_vector) + return a_ptr.dereference() == b_ptr.dereference() + + +class _StrLen(gdb.Function): + """$_strlen - compute string length. + +Usage: $_strlen (A) + +Returns: + Length of string A, assumed to be a string in the current language.""" + def __init__(self): + super(_StrLen, self).__init__("_strlen") + + def invoke(self, a): + s = a.string() + return len(s) + + +class _StrEq(gdb.Function): + """$_streq - check string equality. + +Usage: $_streq (A, B) + +Returns: + True if A and B are identical strings in the current language. + +Example (amd64-linux): + catch syscall open + cond $bpnum $_streq((char*) $rdi, "foo")""" + def __init__(self): + super(_StrEq, self).__init__("_streq") + + def invoke(self, a, b): + return a.string() == b.string() + + +class _RegEx(gdb.Function): + """$_regex - check if a string matches a regular expression. + +Usage: $_regex (STRING, REGEX) + +Returns: + True if string STRING (in the current language) matches the + regular expression REGEX.""" + def __init__(self): + super(_RegEx, self).__init__("_regex") + + def invoke(self, string, regex): + s = string.string() + r = re.compile(regex.string()) + return bool(r.match(s)) + + +# GDB will import us automagically via gdb/__init__.py. +_MemEq() +_StrLen() +_StrEq() +_RegEx() diff --git a/tools/msys/mingw64/share/gdb/python/gdb/printer/__init__.py b/tools/msys/mingw64/share/gdb/python/gdb/printer/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..0260aee76382b49feec47e403b324ad93c48880d --- /dev/null +++ b/tools/msys/mingw64/share/gdb/python/gdb/printer/__init__.py @@ -0,0 +1,14 @@ +# Copyright (C) 2014-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. diff --git a/tools/msys/mingw64/share/gdb/python/gdb/printer/bound_registers.py b/tools/msys/mingw64/share/gdb/python/gdb/printer/bound_registers.py new file mode 100644 index 0000000000000000000000000000000000000000..1eb0e8136d32ad4d42dae6d9cc159ac2de109a7e --- /dev/null +++ b/tools/msys/mingw64/share/gdb/python/gdb/printer/bound_registers.py @@ -0,0 +1,43 @@ +# Pretty-printers for bounds registers. +# Copyright (C) 2013-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import sys + +import gdb.printing + +if sys.version_info[0] > 2: + # Python 3 removed basestring and long + basestring = str + long = int + +class MpxBound128Printer: + """Adds size field to a mpx __gdb_builtin_type_bound128 type.""" + + def __init__ (self, val): + self.val = val + + def to_string (self): + upper = self.val["ubound"] + lower = self.val["lbound"] + size = (long) ((upper) - (lower)) + if size > -1: + size = size + 1 + result = '{lbound = %s, ubound = %s} : size %s' % (lower, upper, size) + return result + +gdb.printing.add_builtin_pretty_printer ('mpx_bound128', + '^builtin_type_bound128', + MpxBound128Printer) diff --git a/tools/msys/mingw64/share/gdb/python/gdb/printing.py b/tools/msys/mingw64/share/gdb/python/gdb/printing.py new file mode 100644 index 0000000000000000000000000000000000000000..9367b439a08f6e2de92ae113077070acae5141c7 --- /dev/null +++ b/tools/msys/mingw64/share/gdb/python/gdb/printing.py @@ -0,0 +1,285 @@ +# Pretty-printer utilities. +# Copyright (C) 2010-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""Utilities for working with pretty-printers.""" + +import gdb +import gdb.types +import re +import sys + +if sys.version_info[0] > 2: + # Python 3 removed basestring and long + basestring = str + long = int + +class PrettyPrinter(object): + """A basic pretty-printer. + + Attributes: + name: A unique string among all printers for the context in which + it is defined (objfile, progspace, or global(gdb)), and should + meaningfully describe what can be pretty-printed. + E.g., "StringPiece" or "protobufs". + subprinters: An iterable object with each element having a `name' + attribute, and, potentially, "enabled" attribute. + Or this is None if there are no subprinters. + enabled: A boolean indicating if the printer is enabled. + + Subprinters are for situations where "one" pretty-printer is actually a + collection of several printers. E.g., The libstdc++ pretty-printer has + a pretty-printer for each of several different types, based on regexps. + """ + + # While one might want to push subprinters into the subclass, it's + # present here to formalize such support to simplify + # commands/pretty_printers.py. + + def __init__(self, name, subprinters=None): + self.name = name + self.subprinters = subprinters + self.enabled = True + + def __call__(self, val): + # The subclass must define this. + raise NotImplementedError("PrettyPrinter __call__") + + +class SubPrettyPrinter(object): + """Baseclass for sub-pretty-printers. + + Sub-pretty-printers needn't use this, but it formalizes what's needed. + + Attributes: + name: The name of the subprinter. + enabled: A boolean indicating if the subprinter is enabled. + """ + + def __init__(self, name): + self.name = name + self.enabled = True + + +def register_pretty_printer(obj, printer, replace=False): + """Register pretty-printer PRINTER with OBJ. + + The printer is added to the front of the search list, thus one can override + an existing printer if one needs to. Use a different name when overriding + an existing printer, otherwise an exception will be raised; multiple + printers with the same name are disallowed. + + Arguments: + obj: Either an objfile, progspace, or None (in which case the printer + is registered globally). + printer: Either a function of one argument (old way) or any object + which has attributes: name, enabled, __call__. + replace: If True replace any existing copy of the printer. + Otherwise if the printer already exists raise an exception. + + Returns: + Nothing. + + Raises: + TypeError: A problem with the type of the printer. + ValueError: The printer's name contains a semicolon ";". + RuntimeError: A printer with the same name is already registered. + + If the caller wants the printer to be listable and disableable, it must + follow the PrettyPrinter API. This applies to the old way (functions) too. + If printer is an object, __call__ is a method of two arguments: + self, and the value to be pretty-printed. See PrettyPrinter. + """ + + # Watch for both __name__ and name. + # Functions get the former for free, but we don't want to use an + # attribute named __foo__ for pretty-printers-as-objects. + # If printer has both, we use `name'. + if not hasattr(printer, "__name__") and not hasattr(printer, "name"): + raise TypeError("printer missing attribute: name") + if hasattr(printer, "name") and not hasattr(printer, "enabled"): + raise TypeError("printer missing attribute: enabled") + if not hasattr(printer, "__call__"): + raise TypeError("printer missing attribute: __call__") + + if hasattr(printer, "name"): + name = printer.name + else: + name = printer.__name__ + if obj is None or obj is gdb: + if gdb.parameter("verbose"): + gdb.write("Registering global %s pretty-printer ...\n" % name) + obj = gdb + else: + if gdb.parameter("verbose"): + gdb.write("Registering %s pretty-printer for %s ...\n" % ( + name, obj.filename)) + + # Printers implemented as functions are old-style. In order to not risk + # breaking anything we do not check __name__ here. + if hasattr(printer, "name"): + if not isinstance(printer.name, basestring): + raise TypeError("printer name is not a string") + # If printer provides a name, make sure it doesn't contain ";". + # Semicolon is used by the info/enable/disable pretty-printer commands + # to delimit subprinters. + if printer.name.find(";") >= 0: + raise ValueError("semicolon ';' in printer name") + # Also make sure the name is unique. + # Alas, we can't do the same for functions and __name__, they could + # all have a canonical name like "lookup_function". + # PERF: gdb records printers in a list, making this inefficient. + i = 0 + for p in obj.pretty_printers: + if hasattr(p, "name") and p.name == printer.name: + if replace: + del obj.pretty_printers[i] + break + else: + raise RuntimeError("pretty-printer already registered: %s" % + printer.name) + i = i + 1 + + obj.pretty_printers.insert(0, printer) + + +class RegexpCollectionPrettyPrinter(PrettyPrinter): + """Class for implementing a collection of regular-expression based pretty-printers. + + Intended usage: + + pretty_printer = RegexpCollectionPrettyPrinter("my_library") + pretty_printer.add_printer("myclass1", "^myclass1$", MyClass1Printer) + ... + pretty_printer.add_printer("myclassN", "^myclassN$", MyClassNPrinter) + register_pretty_printer(obj, pretty_printer) + """ + + class RegexpSubprinter(SubPrettyPrinter): + def __init__(self, name, regexp, gen_printer): + super(RegexpCollectionPrettyPrinter.RegexpSubprinter, self).__init__(name) + self.regexp = regexp + self.gen_printer = gen_printer + self.compiled_re = re.compile(regexp) + + def __init__(self, name): + super(RegexpCollectionPrettyPrinter, self).__init__(name, []) + + def add_printer(self, name, regexp, gen_printer): + """Add a printer to the list. + + The printer is added to the end of the list. + + Arguments: + name: The name of the subprinter. + regexp: The regular expression, as a string. + gen_printer: A function/method that given a value returns an + object to pretty-print it. + + Returns: + Nothing. + """ + + # NOTE: A previous version made the name of each printer the regexp. + # That makes it awkward to pass to the enable/disable commands (it's + # cumbersome to make a regexp of a regexp). So now the name is a + # separate parameter. + + self.subprinters.append(self.RegexpSubprinter(name, regexp, + gen_printer)) + + def __call__(self, val): + """Lookup the pretty-printer for the provided value.""" + + # Get the type name. + typename = gdb.types.get_basic_type(val.type).tag + if not typename: + typename = val.type.name + if not typename: + return None + + # Iterate over table of type regexps to determine + # if a printer is registered for that type. + # Return an instantiation of the printer if found. + for printer in self.subprinters: + if printer.enabled and printer.compiled_re.search(typename): + return printer.gen_printer(val) + + # Cannot find a pretty printer. Return None. + return None + +# A helper class for printing enum types. This class is instantiated +# with a list of enumerators to print a particular Value. +class _EnumInstance: + def __init__(self, enumerators, val): + self.enumerators = enumerators + self.val = val + + def to_string(self): + flag_list = [] + v = long(self.val) + any_found = False + for (e_name, e_value) in self.enumerators: + if v & e_value != 0: + flag_list.append(e_name) + v = v & ~e_value + any_found = True + if not any_found or v != 0: + # Leftover value. + flag_list.append('<unknown: 0x%x>' % v) + return "0x%x [%s]" % (int(self.val), " | ".join(flag_list)) + +class FlagEnumerationPrinter(PrettyPrinter): + """A pretty-printer which can be used to print a flag-style enumeration. + A flag-style enumeration is one where the enumerators are or'd + together to create values. The new printer will print these + symbolically using '|' notation. The printer must be registered + manually. This printer is most useful when an enum is flag-like, + but has some overlap. GDB's built-in printing will not handle + this case, but this printer will attempt to.""" + + def __init__(self, enum_type): + super(FlagEnumerationPrinter, self).__init__(enum_type) + self.initialized = False + + def __call__(self, val): + if not self.initialized: + self.initialized = True + flags = gdb.lookup_type(self.name) + self.enumerators = [] + for field in flags.fields(): + self.enumerators.append((field.name, field.enumval)) + # Sorting the enumerators by value usually does the right + # thing. + self.enumerators.sort(key = lambda x: x[1]) + + if self.enabled: + return _EnumInstance(self.enumerators, val) + else: + return None + + +# Builtin pretty-printers. +# The set is defined as empty, and files in printing/*.py add their printers +# to this with add_builtin_pretty_printer. + +_builtin_pretty_printers = RegexpCollectionPrettyPrinter("builtin") + +register_pretty_printer(None, _builtin_pretty_printers) + +# Add a builtin pretty-printer. + +def add_builtin_pretty_printer(name, regexp, printer): + _builtin_pretty_printers.add_printer(name, regexp, printer) diff --git a/tools/msys/mingw64/share/gdb/python/gdb/prompt.py b/tools/msys/mingw64/share/gdb/python/gdb/prompt.py new file mode 100644 index 0000000000000000000000000000000000000000..a299674d0b9b23f3a3fa944066433aa0c91f79d6 --- /dev/null +++ b/tools/msys/mingw64/share/gdb/python/gdb/prompt.py @@ -0,0 +1,148 @@ +# Extended prompt utilities. +# Copyright (C) 2011-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +""" Extended prompt library functions.""" + +import gdb +import os + +def _prompt_pwd(ignore): + "The current working directory." + return os.getcwd() + +def _prompt_object_attr(func, what, attr, nattr): + """Internal worker for fetching GDB attributes.""" + if attr is None: + attr = nattr + try: + obj = func() + except gdb.error: + return '<no %s>' % what + if hasattr(obj, attr): + result = getattr(obj, attr) + if callable(result): + result = result() + return result + else: + return '<no attribute %s on current %s>' % (attr, what) + +def _prompt_frame(attr): + "The selected frame; an argument names a frame parameter." + return _prompt_object_attr(gdb.selected_frame, 'frame', attr, 'name') + +def _prompt_thread(attr): + "The selected thread; an argument names a thread parameter." + return _prompt_object_attr(gdb.selected_thread, 'thread', attr, 'num') + +def _prompt_version(attr): + "The version of GDB." + return gdb.VERSION + +def _prompt_esc(attr): + "The ESC character." + return '\033' + +def _prompt_bs(attr): + "A backslash." + return '\\' + +def _prompt_n(attr): + "A newline." + return '\n' + +def _prompt_r(attr): + "A carriage return." + return '\r' + +def _prompt_param(attr): + "A parameter's value; the argument names the parameter." + return gdb.parameter(attr) + +def _prompt_noprint_begin(attr): + "Begins a sequence of non-printing characters." + return '\001' + +def _prompt_noprint_end(attr): + "Ends a sequence of non-printing characters." + return '\002' + +prompt_substitutions = { + 'e': _prompt_esc, + '\\': _prompt_bs, + 'n': _prompt_n, + 'r': _prompt_r, + 'v': _prompt_version, + 'w': _prompt_pwd, + 'f': _prompt_frame, + 't': _prompt_thread, + 'p': _prompt_param, + '[': _prompt_noprint_begin, + ']': _prompt_noprint_end +} + +def prompt_help(): + """Generate help dynamically from the __doc__ strings of attribute + functions.""" + + result = '' + keys = sorted (prompt_substitutions.keys()) + for key in keys: + result += ' \\%s\t%s\n' % (key, prompt_substitutions[key].__doc__) + result += """ +A substitution can be used in a simple form, like "\\f". +An argument can also be passed to it, like "\\f{name}". +The meaning of the argument depends on the particular substitution.""" + return result + +def substitute_prompt(prompt): + "Perform substitutions on PROMPT." + + result = '' + plen = len(prompt) + i = 0 + while i < plen: + if prompt[i] == '\\': + i = i + 1 + if i >= plen: + break + cmdch = prompt[i] + + if cmdch in prompt_substitutions: + cmd = prompt_substitutions[cmdch] + + if i + 1 < plen and prompt[i + 1] == '{': + j = i + 1 + while j < plen and prompt[j] != '}': + j = j + 1 + # Just ignore formatting errors. + if j >= plen or prompt[j] != '}': + arg = None + else: + arg = prompt[i + 2 : j] + i = j + else: + arg = None + result += str(cmd(arg)) + else: + # Unrecognized escapes are turned into the escaped + # character itself. + result += prompt[i] + else: + result += prompt[i] + + i = i + 1 + + return result diff --git a/tools/msys/mingw64/share/gdb/python/gdb/types.py b/tools/msys/mingw64/share/gdb/python/gdb/types.py new file mode 100644 index 0000000000000000000000000000000000000000..8d37f12070e6999efed8603dd37c56246f689a32 --- /dev/null +++ b/tools/msys/mingw64/share/gdb/python/gdb/types.py @@ -0,0 +1,178 @@ +# Type utilities. +# Copyright (C) 2010-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""Utilities for working with gdb.Types.""" + +import gdb + + +def get_basic_type(type_): + """Return the "basic" type of a type. + + Arguments: + type_: The type to reduce to its basic type. + + Returns: + type_ with const/volatile is stripped away, + and typedefs/references converted to the underlying type. + """ + + while (type_.code == gdb.TYPE_CODE_REF or + type_.code == gdb.TYPE_CODE_RVALUE_REF or + type_.code == gdb.TYPE_CODE_TYPEDEF): + if (type_.code == gdb.TYPE_CODE_REF or + type_.code == gdb.TYPE_CODE_RVALUE_REF): + type_ = type_.target() + else: + type_ = type_.strip_typedefs() + return type_.unqualified() + + +def has_field(type_, field): + """Return True if a type has the specified field. + + Arguments: + type_: The type to examine. + It must be one of gdb.TYPE_CODE_STRUCT, gdb.TYPE_CODE_UNION. + field: The name of the field to look up. + + Returns: + True if the field is present either in type_ or any baseclass. + + Raises: + TypeError: The type is not a struct or union. + """ + + type_ = get_basic_type(type_) + if (type_.code != gdb.TYPE_CODE_STRUCT and + type_.code != gdb.TYPE_CODE_UNION): + raise TypeError("not a struct or union") + for f in type_.fields(): + if f.is_base_class: + if has_field(f.type, field): + return True + else: + # NOTE: f.name could be None + if f.name == field: + return True + return False + + +def make_enum_dict(enum_type): + """Return a dictionary from a program's enum type. + + Arguments: + enum_type: The enum to compute the dictionary for. + + Returns: + The dictionary of the enum. + + Raises: + TypeError: The type is not an enum. + """ + + if enum_type.code != gdb.TYPE_CODE_ENUM: + raise TypeError("not an enum type") + enum_dict = {} + for field in enum_type.fields(): + # The enum's value is stored in "enumval". + enum_dict[field.name] = field.enumval + return enum_dict + + +def deep_items (type_): + """Return an iterator that recursively traverses anonymous fields. + + Arguments: + type_: The type to traverse. It should be one of + gdb.TYPE_CODE_STRUCT or gdb.TYPE_CODE_UNION. + + Returns: + an iterator similar to gdb.Type.iteritems(), i.e., it returns + pairs of key, value, but for any anonymous struct or union + field that field is traversed recursively, depth-first. + """ + for k, v in type_.iteritems (): + if k: + yield k, v + else: + for i in deep_items (v.type): + yield i + +class TypePrinter(object): + """The base class for type printers. + + Instances of this type can be used to substitute type names during + 'ptype'. + + A type printer must have at least 'name' and 'enabled' attributes, + and supply an 'instantiate' method. + + The 'instantiate' method must either return None, or return an + object which has a 'recognize' method. This method must accept a + gdb.Type argument and either return None, meaning that the type + was not recognized, or a string naming the type. + """ + + def __init__(self, name): + self.name = name + self.enabled = True + + def instantiate(self): + return None + +# Helper function for computing the list of type recognizers. +def _get_some_type_recognizers(result, plist): + for printer in plist: + if printer.enabled: + inst = printer.instantiate() + if inst is not None: + result.append(inst) + return None + +def get_type_recognizers(): + "Return a list of the enabled type recognizers for the current context." + result = [] + + # First try the objfiles. + for objfile in gdb.objfiles(): + _get_some_type_recognizers(result, objfile.type_printers) + # Now try the program space. + _get_some_type_recognizers(result, gdb.current_progspace().type_printers) + # Finally, globals. + _get_some_type_recognizers(result, gdb.type_printers) + + return result + +def apply_type_recognizers(recognizers, type_obj): + """Apply the given list of type recognizers to the type TYPE_OBJ. + If any recognizer in the list recognizes TYPE_OBJ, returns the name + given by the recognizer. Otherwise, this returns None.""" + for r in recognizers: + result = r.recognize(type_obj) + if result is not None: + return result + return None + +def register_type_printer(locus, printer): + """Register a type printer. + PRINTER is the type printer instance. + LOCUS is either an objfile, a program space, or None, indicating + global registration.""" + + if locus is None: + locus = gdb + locus.type_printers.insert(0, printer) diff --git a/tools/msys/mingw64/share/gdb/python/gdb/unwinder.py b/tools/msys/mingw64/share/gdb/python/gdb/unwinder.py new file mode 100644 index 0000000000000000000000000000000000000000..7eadbd646b6fe5fcbedd00f30b1608290bc53978 --- /dev/null +++ b/tools/msys/mingw64/share/gdb/python/gdb/unwinder.py @@ -0,0 +1,95 @@ +# Copyright (C) 2015-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""Unwinder class and register_unwinder function.""" + +import gdb + + +class Unwinder(object): + """Base class (or a template) for frame unwinders written in Python. + + An unwinder has a single method __call__ and the attributes + described below. + + Attributes: + name: The name of the unwinder. + enabled: A boolean indicating whether the unwinder is enabled. + """ + + def __init__(self, name): + """Constructor. + + Args: + name: An identifying name for the unwinder. + """ + self.name = name + self.enabled = True + + def __call__(self, pending_frame): + """GDB calls this method to unwind a frame. + + Arguments: + pending_frame: gdb.PendingFrame instance. + + Returns: + gdb.UnwindInfo instance. + """ + raise NotImplementedError("Unwinder __call__.") + + +def register_unwinder(locus, unwinder, replace=False): + """Register unwinder in given locus. + + The unwinder is prepended to the locus's unwinders list. Unwinder + name should be unique. + + Arguments: + locus: Either an objfile, progspace, or None (in which case + the unwinder is registered globally). + unwinder: An object of a gdb.Unwinder subclass + replace: If True, replaces existing unwinder with the same name. + Otherwise, raises exception if unwinder with the same + name already exists. + + Returns: + Nothing. + + Raises: + RuntimeError: Unwinder name is not unique + TypeError: Bad locus type + """ + if locus is None: + if gdb.parameter("verbose"): + gdb.write("Registering global %s unwinder ...\n" % unwinder.name) + locus = gdb + elif isinstance(locus, gdb.Objfile) or isinstance(locus, gdb.Progspace): + if gdb.parameter("verbose"): + gdb.write("Registering %s unwinder for %s ...\n" % + (unwinder.name, locus.filename)) + else: + raise TypeError("locus should be gdb.Objfile or gdb.Progspace or None") + + i = 0 + for needle in locus.frame_unwinders: + if needle.name == unwinder.name: + if replace: + del locus.frame_unwinders[i] + else: + raise RuntimeError("Unwinder %s already exists." % + unwinder.name) + i += 1 + locus.frame_unwinders.insert(0, unwinder) + gdb.invalidate_cached_frames() diff --git a/tools/msys/mingw64/share/gdb/python/gdb/xmethod.py b/tools/msys/mingw64/share/gdb/python/gdb/xmethod.py new file mode 100644 index 0000000000000000000000000000000000000000..afc12a07d756a4589e04a9d43fef2f46474551ce --- /dev/null +++ b/tools/msys/mingw64/share/gdb/python/gdb/xmethod.py @@ -0,0 +1,275 @@ +# Python side of the support for xmethods. +# Copyright (C) 2013-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""Utilities for defining xmethods""" + +import gdb +import re +import sys + + +if sys.version_info[0] > 2: + # Python 3 removed basestring and long + basestring = str + long = int + + +class XMethod(object): + """Base class (or a template) for an xmethod description. + + Currently, the description requires only the 'name' and 'enabled' + attributes. Description objects are managed by 'XMethodMatcher' + objects (see below). Note that this is only a template for the + interface of the XMethodMatcher.methods objects. One could use + this class or choose to use an object which supports this exact same + interface. Also, an XMethodMatcher can choose not use it 'methods' + attribute. In such cases this class (or an equivalent) is not used. + + Attributes: + name: The name of the xmethod. + enabled: A boolean indicating if the xmethod is enabled. + """ + + def __init__(self, name): + self.name = name + self.enabled = True + + +class XMethodMatcher(object): + """Abstract base class for matching an xmethod. + + When looking for xmethods, GDB invokes the `match' method of a + registered xmethod matcher to match the object type and method name. + The `match' method in concrete classes derived from this class should + return an `XMethodWorker' object, or a list of `XMethodWorker' + objects if there is a match (see below for 'XMethodWorker' class). + + Attributes: + name: The name of the matcher. + enabled: A boolean indicating if the matcher is enabled. + methods: A sequence of objects of type 'XMethod', or objects + which have at least the attributes of an 'XMethod' object. + This list is used by the 'enable'/'disable'/'info' commands to + enable/disable/list the xmethods registered with GDB. See + the 'match' method below to know how this sequence is used. + This attribute is None if the matcher chooses not have any + xmethods managed by it. + """ + + def __init__(self, name): + """ + Args: + name: An identifying name for the xmethod or the group of + xmethods returned by the `match' method. + """ + self.name = name + self.enabled = True + self.methods = None + + def match(self, class_type, method_name): + """Match class type and method name. + + In derived classes, it should return an XMethodWorker object, or a + sequence of 'XMethodWorker' objects. Only those xmethod workers + whose corresponding 'XMethod' descriptor object is enabled should be + returned. + + Args: + class_type: The class type (gdb.Type object) to match. + method_name: The name (string) of the method to match. + """ + raise NotImplementedError("XMethodMatcher match") + + +class XMethodWorker(object): + """Base class for all xmethod workers defined in Python. + + An xmethod worker is an object which matches the method arguments, and + invokes the method when GDB wants it to. Internally, GDB first invokes the + 'get_arg_types' method to perform overload resolution. If GDB selects to + invoke this Python xmethod, then it invokes it via the overridden + '__call__' method. The 'get_result_type' method is used to implement + 'ptype' on the xmethod. + + Derived classes should override the 'get_arg_types', 'get_result_type' + and '__call__' methods. + """ + + def get_arg_types(self): + """Return arguments types of an xmethod. + + A sequence of gdb.Type objects corresponding to the arguments of the + xmethod are returned. If the xmethod takes no arguments, then 'None' + or an empty sequence is returned. If the xmethod takes only a single + argument, then a gdb.Type object or a sequence with a single gdb.Type + element is returned. + """ + raise NotImplementedError("XMethodWorker get_arg_types") + + def get_result_type(self, *args): + """Return the type of the result of the xmethod. + + Args: + args: Arguments to the method. Each element of the tuple is a + gdb.Value object. The first element is the 'this' pointer + value. These are the same arguments passed to '__call__'. + + Returns: + A gdb.Type object representing the type of the result of the + xmethod. + """ + raise NotImplementedError("XMethodWorker get_result_type") + + def __call__(self, *args): + """Invoke the xmethod. + + Args: + args: Arguments to the method. Each element of the tuple is a + gdb.Value object. The first element is the 'this' pointer + value. + + Returns: + A gdb.Value corresponding to the value returned by the xmethod. + Returns 'None' if the method does not return anything. + """ + raise NotImplementedError("XMethodWorker __call__") + + +class SimpleXMethodMatcher(XMethodMatcher): + """A utility class to implement simple xmethod mathers and workers. + + See the __init__ method below for information on how instances of this + class can be used. + + For simple classes and methods, one can choose to use this class. For + complex xmethods, which need to replace/implement template methods on + possibly template classes, one should implement their own xmethod + matchers and workers. See py-xmethods.py in testsuite/gdb.python + directory of the GDB source tree for examples. + """ + + class SimpleXMethodWorker(XMethodWorker): + def __init__(self, method_function, arg_types): + self._arg_types = arg_types + self._method_function = method_function + + def get_arg_types(self): + return self._arg_types + + def __call__(self, *args): + return self._method_function(*args) + + + def __init__(self, name, class_matcher, method_matcher, method_function, + *arg_types): + """ + Args: + name: Name of the xmethod matcher. + class_matcher: A regular expression used to match the name of the + class whose method this xmethod is implementing/replacing. + method_matcher: A regular expression used to match the name of the + method this xmethod is implementing/replacing. + method_function: A Python callable which would be called via the + 'invoke' method of the worker returned by the objects of this + class. This callable should accept the object (*this) as the + first argument followed by the rest of the arguments to the + method. All arguments to this function should be gdb.Value + objects. + arg_types: The gdb.Type objects corresponding to the arguments that + this xmethod takes. It can be None, or an empty sequence, + or a single gdb.Type object, or a sequence of gdb.Type objects. + """ + XMethodMatcher.__init__(self, name) + assert callable(method_function), ( + "The 'method_function' argument to 'SimpleXMethodMatcher' " + "__init__ method should be a callable.") + self._method_function = method_function + self._class_matcher = class_matcher + self._method_matcher = method_matcher + self._arg_types = arg_types + + def match(self, class_type, method_name): + cm = re.match(self._class_matcher, str(class_type.unqualified().tag)) + mm = re.match(self._method_matcher, method_name) + if cm and mm: + return SimpleXMethodMatcher.SimpleXMethodWorker( + self._method_function, self._arg_types) + + +# A helper function for register_xmethod_matcher which returns an error +# object if MATCHER is not having the requisite attributes in the proper +# format. + +def _validate_xmethod_matcher(matcher): + if not hasattr(matcher, "match"): + return TypeError("Xmethod matcher is missing method: match") + if not hasattr(matcher, "name"): + return TypeError("Xmethod matcher is missing attribute: name") + if not hasattr(matcher, "enabled"): + return TypeError("Xmethod matcher is missing attribute: enabled") + if not isinstance(matcher.name, basestring): + return TypeError("Attribute 'name' of xmethod matcher is not a " + "string") + if matcher.name.find(";") >= 0: + return ValueError("Xmethod matcher name cannot contain ';' in it") + + +# A helper function for register_xmethod_matcher which looks up an +# xmethod matcher with NAME in LOCUS. Returns the index of the xmethod +# matcher in 'xmethods' sequence attribute of the LOCUS. If NAME is not +# found in LOCUS, then -1 is returned. + +def _lookup_xmethod_matcher(locus, name): + for i in range(0, len(locus.xmethods)): + if locus.xmethods[i].name == name: + return i + return -1 + + +def register_xmethod_matcher(locus, matcher, replace=False): + """Registers a xmethod matcher MATCHER with a LOCUS. + + Arguments: + locus: The locus in which the xmethods should be registered. + It can be 'None' to indicate that the xmethods should be + registered globally. Or, it could be a gdb.Objfile or a + gdb.Progspace object in which the xmethods should be + registered. + matcher: The xmethod matcher to register with the LOCUS. It + should be an instance of 'XMethodMatcher' class. + replace: If True, replace any existing xmethod matcher with the + same name in the locus. Otherwise, if a matcher with the same name + exists in the locus, raise an exception. + """ + err = _validate_xmethod_matcher(matcher) + if err: + raise err + if not locus: + locus = gdb + if locus == gdb: + locus_name = "global" + else: + locus_name = locus.filename + index = _lookup_xmethod_matcher(locus, matcher.name) + if index >= 0: + if replace: + del locus.xmethods[index] + else: + raise RuntimeError("Xmethod matcher already registered with " + "%s: %s" % (locus_name, matcher.name)) + if gdb.parameter("verbose"): + gdb.write("Registering xmethod matcher '%s' with %s' ...\n") + locus.xmethods.insert(0, matcher) diff --git a/tools/msys/mingw64/share/gdb/syscalls/aarch64-linux.xml b/tools/msys/mingw64/share/gdb/syscalls/aarch64-linux.xml new file mode 100644 index 0000000000000000000000000000000000000000..2c4883a042c6860fc35235f577334fb41b99a43c --- /dev/null +++ b/tools/msys/mingw64/share/gdb/syscalls/aarch64-linux.xml @@ -0,0 +1,269 @@ +<?xml version="1.0"?> +<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd"> +<!-- Copyright (C) 2015-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. This file is offered as-is, + without any warranty. --> +<syscalls_info> + <syscall name="io_setup" number="0"/> + <syscall name="io_destroy" number="1"/> + <syscall name="io_submit" number="2"/> + <syscall name="io_cancel" number="3"/> + <syscall name="io_getevents" number="4"/> + <syscall name="setxattr" number="5" groups="file"/> + <syscall name="lsetxattr" number="6" groups="file"/> + <syscall name="fsetxattr" number="7" groups="descriptor"/> + <syscall name="getxattr" number="8" groups="file"/> + <syscall name="lgetxattr" number="9" groups="file"/> + <syscall name="fgetxattr" number="10" groups="descriptor"/> + <syscall name="listxattr" number="11" groups="file"/> + <syscall name="llistxattr" number="12" groups="file"/> + <syscall name="flistxattr" number="13" groups="descriptor"/> + <syscall name="removexattr" number="14" groups="file"/> + <syscall name="lremovexattr" number="15" groups="file"/> + <syscall name="fremovexattr" number="16" groups="descriptor"/> + <syscall name="getcwd" number="17" groups="file"/> + <syscall name="lookup_dcookie" number="18"/> + <syscall name="eventfd2" number="19" groups="descriptor"/> + <syscall name="epoll_create1" number="20" groups="descriptor"/> + <syscall name="epoll_ctl" number="21" groups="descriptor"/> + <syscall name="epoll_pwait" number="22" groups="descriptor"/> + <syscall name="dup" number="23" groups="descriptor"/> + <syscall name="dup3" number="24" groups="descriptor"/> + <syscall name="fcntl" number="25" groups="descriptor"/> + <syscall name="inotify_init1" number="26" groups="descriptor"/> + <syscall name="inotify_add_watch" number="27" groups="descriptor"/> + <syscall name="inotify_rm_watch" number="28" groups="descriptor"/> + <syscall name="ioctl" number="29" groups="descriptor"/> + <syscall name="ioprio_set" number="30"/> + <syscall name="ioprio_get" number="31"/> + <syscall name="flock" number="32" groups="descriptor"/> + <syscall name="mknodat" number="33" groups="descriptor,file"/> + <syscall name="mkdirat" number="34" groups="descriptor,file"/> + <syscall name="unlinkat" number="35" groups="descriptor,file"/> + <syscall name="symlinkat" number="36" groups="descriptor,file"/> + <syscall name="linkat" number="37" groups="descriptor,file"/> + <syscall name="renameat" number="38" groups="descriptor,file"/> + <syscall name="umount2" number="39" groups="file"/> + <syscall name="mount" number="40" groups="file"/> + <syscall name="pivot_root" number="41" groups="file"/> + <syscall name="nfsservctl" number="42"/> + <syscall name="statfs" number="43" groups="file"/> + <syscall name="fstatfs" number="44" groups="descriptor"/> + <syscall name="truncate" number="45" groups="file"/> + <syscall name="ftruncate" number="46" groups="descriptor"/> + <syscall name="fallocate" number="47" groups="descriptor"/> + <syscall name="faccessat" number="48" groups="descriptor,file"/> + <syscall name="chdir" number="49" groups="file"/> + <syscall name="fchdir" number="50" groups="descriptor"/> + <syscall name="chroot" number="51" groups="file"/> + <syscall name="fchmod" number="52" groups="descriptor"/> + <syscall name="fchmodat" number="53" groups="descriptor,file"/> + <syscall name="fchownat" number="54" groups="descriptor,file"/> + <syscall name="fchown" number="55" groups="descriptor"/> + <syscall name="openat" number="56" groups="descriptor,file"/> + <syscall name="close" number="57" groups="descriptor"/> + <syscall name="vhangup" number="58"/> + <syscall name="pipe2" number="59" groups="descriptor"/> + <syscall name="quotactl" number="60" groups="file"/> + <syscall name="getdents64" number="61" groups="descriptor"/> + <syscall name="lseek" number="62" groups="descriptor"/> + <syscall name="read" number="63" groups="descriptor"/> + <syscall name="write" number="64" groups="descriptor"/> + <syscall name="readv" number="65" groups="descriptor"/> + <syscall name="writev" number="66" groups="descriptor"/> + <syscall name="pread64" number="67" groups="descriptor"/> + <syscall name="pwrite64" number="68" groups="descriptor"/> + <syscall name="preadv" number="69" groups="descriptor"/> + <syscall name="pwritev" number="70" groups="descriptor"/> + <syscall name="sendfile" number="71" groups="descriptor,network"/> + <syscall name="pselect6" number="72" groups="descriptor"/> + <syscall name="ppoll" number="73" groups="descriptor"/> + <syscall name="signalfd4" number="74" groups="descriptor,signal"/> + <syscall name="vmsplice" number="75" groups="descriptor"/> + <syscall name="splice" number="76" groups="descriptor"/> + <syscall name="tee" number="77" groups="descriptor"/> + <syscall name="readlinkat" number="78" groups="descriptor,file"/> + <syscall name="newfstatat" number="79" groups="descriptor,file"/> + <syscall name="fstat" number="80" groups="descriptor"/> + <syscall name="sync" number="81"/> + <syscall name="fsync" number="82" groups="descriptor"/> + <syscall name="fdatasync" number="83" groups="descriptor"/> + <syscall name="sync_file_range" number="84" groups="descriptor"/> + <syscall name="timerfd_create" number="85" groups="descriptor"/> + <syscall name="timerfd_settime" number="86" groups="descriptor"/> + <syscall name="timerfd_gettime" number="87" groups="descriptor"/> + <syscall name="utimensat" number="88" groups="descriptor,file"/> + <syscall name="acct" number="89" groups="file"/> + <syscall name="capget" number="90"/> + <syscall name="capset" number="91"/> + <syscall name="personality" number="92"/> + <syscall name="exit" number="93" groups="process"/> + <syscall name="exit_group" number="94" groups="process"/> + <syscall name="waitid" number="95" groups="process"/> + <syscall name="set_tid_address" number="96"/> + <syscall name="unshare" number="97" groups="process"/> + <syscall name="futex" number="98"/> + <syscall name="set_robust_list" number="99"/> + <syscall name="get_robust_list" number="100"/> + <syscall name="nanosleep" number="101"/> + <syscall name="getitimer" number="102"/> + <syscall name="setitimer" number="103"/> + <syscall name="kexec_load" number="104"/> + <syscall name="init_module" number="105"/> + <syscall name="delete_module" number="106"/> + <syscall name="timer_create" number="107"/> + <syscall name="timer_gettime" number="108"/> + <syscall name="timer_getoverrun" number="109"/> + <syscall name="timer_settime" number="110"/> + <syscall name="timer_delete" number="111"/> + <syscall name="clock_settime" number="112"/> + <syscall name="clock_gettime" number="113"/> + <syscall name="clock_getres" number="114"/> + <syscall name="clock_nanosleep" number="115"/> + <syscall name="syslog" number="116"/> + <syscall name="ptrace" number="117"/> + <syscall name="sched_setparam" number="118"/> + <syscall name="sched_setscheduler" number="119"/> + <syscall name="sched_getscheduler" number="120"/> + <syscall name="sched_getparam" number="121"/> + <syscall name="sched_setaffinity" number="122"/> + <syscall name="sched_getaffinity" number="123"/> + <syscall name="sched_yield" number="124"/> + <syscall name="sched_get_priority_max" number="125"/> + <syscall name="sched_get_priority_min" number="126"/> + <syscall name="sched_rr_get_interval" number="127"/> + <syscall name="restart_syscall" number="128"/> + <syscall name="kill" number="129" groups="signal"/> + <syscall name="tkill" number="130" groups="signal"/> + <syscall name="tgkill" number="131" groups="signal"/> + <syscall name="sigaltstack" number="132" groups="signal"/> + <syscall name="rt_sigsuspend" number="133" groups="signal"/> + <syscall name="rt_sigaction" number="134" groups="signal"/> + <syscall name="rt_sigprocmask" number="135" groups="signal"/> + <syscall name="rt_sigpending" number="136" groups="signal"/> + <syscall name="rt_sigtimedwait" number="137" groups="signal"/> + <syscall name="rt_sigqueueinfo" number="138" groups="signal"/> + <syscall name="rt_sigreturn" number="139" groups="signal"/> + <syscall name="setpriority" number="140"/> + <syscall name="getpriority" number="141"/> + <syscall name="reboot" number="142"/> + <syscall name="setregid" number="143"/> + <syscall name="setgid" number="144"/> + <syscall name="setreuid" number="145"/> + <syscall name="setuid" number="146"/> + <syscall name="setresuid" number="147"/> + <syscall name="getresuid" number="148"/> + <syscall name="setresgid" number="149"/> + <syscall name="getresgid" number="150"/> + <syscall name="setfsuid" number="151"/> + <syscall name="setfsgid" number="152"/> + <syscall name="times" number="153"/> + <syscall name="setpgid" number="154"/> + <syscall name="getpgid" number="155"/> + <syscall name="getsid" number="156"/> + <syscall name="setsid" number="157"/> + <syscall name="getgroups" number="158"/> + <syscall name="setgroups" number="159"/> + <syscall name="uname" number="160"/> + <syscall name="sethostname" number="161"/> + <syscall name="setdomainname" number="162"/> + <syscall name="getrlimit" number="163"/> + <syscall name="setrlimit" number="164"/> + <syscall name="getrusage" number="165"/> + <syscall name="umask" number="166"/> + <syscall name="prctl" number="167"/> + <syscall name="getcpu" number="168"/> + <syscall name="gettimeofday" number="169"/> + <syscall name="settimeofday" number="170"/> + <syscall name="adjtimex" number="171"/> + <syscall name="getpid" number="172"/> + <syscall name="getppid" number="173"/> + <syscall name="getuid" number="174"/> + <syscall name="geteuid" number="175"/> + <syscall name="getgid" number="176"/> + <syscall name="getegid" number="177"/> + <syscall name="gettid" number="178"/> + <syscall name="sysinfo" number="179"/> + <syscall name="mq_open" number="180"/> + <syscall name="mq_unlink" number="181"/> + <syscall name="mq_timedsend" number="182"/> + <syscall name="mq_timedreceive" number="183"/> + <syscall name="mq_notify" number="184"/> + <syscall name="mq_getsetattr" number="185"/> + <syscall name="msgget" number="186" groups="ipc"/> + <syscall name="msgctl" number="187" groups="ipc"/> + <syscall name="msgrcv" number="188" groups="ipc"/> + <syscall name="msgsnd" number="189" groups="ipc"/> + <syscall name="semget" number="190" groups="ipc"/> + <syscall name="semctl" number="191" groups="ipc"/> + <syscall name="semtimedop" number="192" groups="ipc"/> + <syscall name="semop" number="193" groups="ipc"/> + <syscall name="shmget" number="194" groups="ipc"/> + <syscall name="shmctl" number="195" groups="ipc"/> + <syscall name="shmat" number="196" groups="ipc,memory"/> + <syscall name="shmdt" number="197" groups="ipc,memory"/> + <syscall name="socket" number="198" groups="network"/> + <syscall name="socketpair" number="199" groups="network"/> + <syscall name="bind" number="200" groups="network"/> + <syscall name="listen" number="201" groups="network"/> + <syscall name="accept" number="202" groups="network"/> + <syscall name="connect" number="203" groups="network"/> + <syscall name="getsockname" number="204" groups="network"/> + <syscall name="getpeername" number="205" groups="network"/> + <syscall name="sendto" number="206" groups="network"/> + <syscall name="recvfrom" number="207" groups="network"/> + <syscall name="setsockopt" number="208" groups="network"/> + <syscall name="getsockopt" number="209" groups="network"/> + <syscall name="shutdown" number="210" groups="network"/> + <syscall name="sendmsg" number="211" groups="network"/> + <syscall name="recvmsg" number="212" groups="network"/> + <syscall name="readahead" number="213" groups="descriptor"/> + <syscall name="brk" number="214" groups="memory"/> + <syscall name="munmap" number="215" groups="memory"/> + <syscall name="mremap" number="216" groups="memory"/> + <syscall name="add_key" number="217"/> + <syscall name="request_key" number="218"/> + <syscall name="keyctl" number="219"/> + <syscall name="clone" number="220" groups="process"/> + <syscall name="execve" number="221" groups="file,process"/> + <syscall name="mmap" number="222" groups="descriptor,memory"/> + <syscall name="fadvise64" number="223" groups="descriptor"/> + <syscall name="swapon" number="224" groups="file"/> + <syscall name="swapoff" number="225" groups="file"/> + <syscall name="mprotect" number="226" groups="memory"/> + <syscall name="msync" number="227" groups="memory"/> + <syscall name="mlock" number="228" groups="memory"/> + <syscall name="munlock" number="229" groups="memory"/> + <syscall name="mlockall" number="230" groups="memory"/> + <syscall name="munlockall" number="231" groups="memory"/> + <syscall name="mincore" number="232" groups="memory"/> + <syscall name="madvise" number="233" groups="memory"/> + <syscall name="remap_file_pages" number="234" groups="memory"/> + <syscall name="mbind" number="235" groups="memory"/> + <syscall name="get_mempolicy" number="236" groups="memory"/> + <syscall name="set_mempolicy" number="237" groups="memory"/> + <syscall name="migrate_pages" number="238" groups="memory"/> + <syscall name="move_pages" number="239" groups="memory"/> + <syscall name="rt_tgsigqueueinfo" number="240" groups="process,signal"/> + <syscall name="perf_event_open" number="241" groups="descriptor"/> + <syscall name="accept4" number="242" groups="network"/> + <syscall name="recvmmsg" number="243" groups="network"/> + <syscall name="arch_specific_syscall" number="244"/> + <syscall name="wait4" number="260" groups="process"/> + <syscall name="prlimit64" number="261"/> + <syscall name="fanotify_init" number="262" groups="descriptor"/> + <syscall name="fanotify_mark" number="263" groups="descriptor,file"/> + <syscall name="name_to_handle_at" number="264" groups="descriptor,file"/> + <syscall name="open_by_handle_at" number="265" groups="descriptor"/> + <syscall name="clock_adjtime" number="266"/> + <syscall name="syncfs" number="267" groups="descriptor"/> + <syscall name="setns" number="268" groups="descriptor"/> + <syscall name="sendmmsg" number="269" groups="network"/> + <syscall name="process_vm_readv" number="270"/> + <syscall name="process_vm_writev" number="271"/> + <syscall name="kcmp" number="272"/> + <syscall name="syscalls" number="273"/> +</syscalls_info> diff --git a/tools/msys/mingw64/share/gdb/syscalls/amd64-linux.xml b/tools/msys/mingw64/share/gdb/syscalls/amd64-linux.xml new file mode 100644 index 0000000000000000000000000000000000000000..24d25d039d6e2054db496e3e1d1ede23cadcd1d1 --- /dev/null +++ b/tools/msys/mingw64/share/gdb/syscalls/amd64-linux.xml @@ -0,0 +1,311 @@ +<?xml version="1.0"?> +<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd"> +<!-- Copyright (C) 2009-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> +<!-- This file was generated using the following file: + + /usr/src/linux/arch/x86/include/asm/unistd_64.h + + The file mentioned above belongs to the Linux Kernel. --> +<syscalls_info> + <syscall name="read" number="0" groups="descriptor"/> + <syscall name="write" number="1" groups="descriptor"/> + <syscall name="open" number="2" groups="descriptor,file"/> + <syscall name="close" number="3" groups="descriptor"/> + <syscall name="stat" number="4" groups="file"/> + <syscall name="fstat" number="5" groups="descriptor"/> + <syscall name="lstat" number="6" groups="file"/> + <syscall name="poll" number="7" groups="descriptor"/> + <syscall name="lseek" number="8" groups="descriptor"/> + <syscall name="mmap" number="9" groups="descriptor,memory"/> + <syscall name="mprotect" number="10" groups="memory"/> + <syscall name="munmap" number="11" groups="memory"/> + <syscall name="brk" number="12" groups="memory"/> + <syscall name="rt_sigaction" number="13" groups="signal"/> + <syscall name="rt_sigprocmask" number="14" groups="signal"/> + <syscall name="rt_sigreturn" number="15" groups="signal"/> + <syscall name="ioctl" number="16" groups="descriptor"/> + <syscall name="pread64" number="17" groups="descriptor"/> + <syscall name="pwrite64" number="18" groups="descriptor"/> + <syscall name="readv" number="19" groups="descriptor"/> + <syscall name="writev" number="20" groups="descriptor"/> + <syscall name="access" number="21" groups="file"/> + <syscall name="pipe" number="22" groups="descriptor"/> + <syscall name="select" number="23" groups="descriptor"/> + <syscall name="sched_yield" number="24"/> + <syscall name="mremap" number="25" groups="memory"/> + <syscall name="msync" number="26" groups="memory"/> + <syscall name="mincore" number="27" groups="memory"/> + <syscall name="madvise" number="28" groups="memory"/> + <syscall name="shmget" number="29" groups="ipc"/> + <syscall name="shmat" number="30" groups="ipc,memory"/> + <syscall name="shmctl" number="31" groups="ipc"/> + <syscall name="dup" number="32" groups="descriptor"/> + <syscall name="dup2" number="33" groups="descriptor"/> + <syscall name="pause" number="34" groups="signal"/> + <syscall name="nanosleep" number="35"/> + <syscall name="getitimer" number="36"/> + <syscall name="alarm" number="37"/> + <syscall name="setitimer" number="38"/> + <syscall name="getpid" number="39"/> + <syscall name="sendfile" number="40" groups="descriptor,network"/> + <syscall name="socket" number="41" groups="network"/> + <syscall name="connect" number="42" groups="network"/> + <syscall name="accept" number="43" groups="network"/> + <syscall name="sendto" number="44" groups="network"/> + <syscall name="recvfrom" number="45" groups="network"/> + <syscall name="sendmsg" number="46" groups="network"/> + <syscall name="recvmsg" number="47" groups="network"/> + <syscall name="shutdown" number="48" groups="network"/> + <syscall name="bind" number="49" groups="network"/> + <syscall name="listen" number="50" groups="network"/> + <syscall name="getsockname" number="51" groups="network"/> + <syscall name="getpeername" number="52" groups="network"/> + <syscall name="socketpair" number="53" groups="network"/> + <syscall name="setsockopt" number="54" groups="network"/> + <syscall name="getsockopt" number="55" groups="network"/> + <syscall name="clone" number="56" groups="process"/> + <syscall name="fork" number="57" groups="process"/> + <syscall name="vfork" number="58" groups="process"/> + <syscall name="execve" number="59" groups="file,process"/> + <syscall name="exit" number="60" groups="process"/> + <syscall name="wait4" number="61" groups="process"/> + <syscall name="kill" number="62" groups="signal"/> + <syscall name="uname" number="63"/> + <syscall name="semget" number="64" groups="ipc"/> + <syscall name="semop" number="65" groups="ipc"/> + <syscall name="semctl" number="66" groups="ipc"/> + <syscall name="shmdt" number="67" groups="ipc,memory"/> + <syscall name="msgget" number="68" groups="ipc"/> + <syscall name="msgsnd" number="69" groups="ipc"/> + <syscall name="msgrcv" number="70" groups="ipc"/> + <syscall name="msgctl" number="71" groups="ipc"/> + <syscall name="fcntl" number="72" groups="descriptor"/> + <syscall name="flock" number="73" groups="descriptor"/> + <syscall name="fsync" number="74" groups="descriptor"/> + <syscall name="fdatasync" number="75" groups="descriptor"/> + <syscall name="truncate" number="76" groups="file"/> + <syscall name="ftruncate" number="77" groups="descriptor"/> + <syscall name="getdents" number="78" groups="descriptor"/> + <syscall name="getcwd" number="79" groups="file"/> + <syscall name="chdir" number="80" groups="file"/> + <syscall name="fchdir" number="81" groups="descriptor"/> + <syscall name="rename" number="82" groups="file"/> + <syscall name="mkdir" number="83" groups="file"/> + <syscall name="rmdir" number="84" groups="file"/> + <syscall name="creat" number="85" groups="descriptor,file"/> + <syscall name="link" number="86" groups="file"/> + <syscall name="unlink" number="87" groups="file"/> + <syscall name="symlink" number="88" groups="file"/> + <syscall name="readlink" number="89" groups="file"/> + <syscall name="chmod" number="90" groups="file"/> + <syscall name="fchmod" number="91" groups="descriptor"/> + <syscall name="chown" number="92" groups="file"/> + <syscall name="fchown" number="93" groups="descriptor"/> + <syscall name="lchown" number="94" groups="file"/> + <syscall name="umask" number="95"/> + <syscall name="gettimeofday" number="96"/> + <syscall name="getrlimit" number="97"/> + <syscall name="getrusage" number="98"/> + <syscall name="sysinfo" number="99"/> + <syscall name="times" number="100"/> + <syscall name="ptrace" number="101"/> + <syscall name="getuid" number="102"/> + <syscall name="syslog" number="103"/> + <syscall name="getgid" number="104"/> + <syscall name="setuid" number="105"/> + <syscall name="setgid" number="106"/> + <syscall name="geteuid" number="107"/> + <syscall name="getegid" number="108"/> + <syscall name="setpgid" number="109"/> + <syscall name="getppid" number="110"/> + <syscall name="getpgrp" number="111"/> + <syscall name="setsid" number="112"/> + <syscall name="setreuid" number="113"/> + <syscall name="setregid" number="114"/> + <syscall name="getgroups" number="115"/> + <syscall name="setgroups" number="116"/> + <syscall name="setresuid" number="117"/> + <syscall name="getresuid" number="118"/> + <syscall name="setresgid" number="119"/> + <syscall name="getresgid" number="120"/> + <syscall name="getpgid" number="121"/> + <syscall name="setfsuid" number="122"/> + <syscall name="setfsgid" number="123"/> + <syscall name="getsid" number="124"/> + <syscall name="capget" number="125"/> + <syscall name="capset" number="126"/> + <syscall name="rt_sigpending" number="127" groups="signal"/> + <syscall name="rt_sigtimedwait" number="128" groups="signal"/> + <syscall name="rt_sigqueueinfo" number="129" groups="signal"/> + <syscall name="rt_sigsuspend" number="130" groups="signal"/> + <syscall name="sigaltstack" number="131" groups="signal"/> + <syscall name="utime" number="132" groups="file"/> + <syscall name="mknod" number="133" groups="file"/> + <syscall name="uselib" number="134" groups="file"/> + <syscall name="personality" number="135"/> + <syscall name="ustat" number="136"/> + <syscall name="statfs" number="137" groups="file"/> + <syscall name="fstatfs" number="138" groups="descriptor"/> + <syscall name="sysfs" number="139"/> + <syscall name="getpriority" number="140"/> + <syscall name="setpriority" number="141"/> + <syscall name="sched_setparam" number="142"/> + <syscall name="sched_getparam" number="143"/> + <syscall name="sched_setscheduler" number="144"/> + <syscall name="sched_getscheduler" number="145"/> + <syscall name="sched_get_priority_max" number="146"/> + <syscall name="sched_get_priority_min" number="147"/> + <syscall name="sched_rr_get_interval" number="148"/> + <syscall name="mlock" number="149" groups="memory"/> + <syscall name="munlock" number="150" groups="memory"/> + <syscall name="mlockall" number="151" groups="memory"/> + <syscall name="munlockall" number="152" groups="memory"/> + <syscall name="vhangup" number="153"/> + <syscall name="modify_ldt" number="154"/> + <syscall name="pivot_root" number="155" groups="file"/> + <syscall name="_sysctl" number="156"/> + <syscall name="prctl" number="157"/> + <syscall name="arch_prctl" number="158" groups="process"/> + <syscall name="adjtimex" number="159"/> + <syscall name="setrlimit" number="160"/> + <syscall name="chroot" number="161" groups="file"/> + <syscall name="sync" number="162"/> + <syscall name="acct" number="163" groups="file"/> + <syscall name="settimeofday" number="164"/> + <syscall name="mount" number="165" groups="file"/> + <syscall name="umount2" number="166" groups="file"/> + <syscall name="swapon" number="167" groups="file"/> + <syscall name="swapoff" number="168" groups="file"/> + <syscall name="reboot" number="169"/> + <syscall name="sethostname" number="170"/> + <syscall name="setdomainname" number="171"/> + <syscall name="iopl" number="172"/> + <syscall name="ioperm" number="173"/> + <syscall name="create_module" number="174"/> + <syscall name="init_module" number="175"/> + <syscall name="delete_module" number="176"/> + <syscall name="get_kernel_syms" number="177"/> + <syscall name="query_module" number="178"/> + <syscall name="quotactl" number="179" groups="file"/> + <syscall name="nfsservctl" number="180"/> + <syscall name="getpmsg" number="181"/> + <syscall name="putpmsg" number="182"/> + <syscall name="afs_syscall" number="183"/> + <syscall name="tuxcall" number="184"/> + <syscall name="security" number="185"/> + <syscall name="gettid" number="186"/> + <syscall name="readahead" number="187" groups="descriptor"/> + <syscall name="setxattr" number="188" groups="file"/> + <syscall name="lsetxattr" number="189" groups="file"/> + <syscall name="fsetxattr" number="190" groups="descriptor"/> + <syscall name="getxattr" number="191" groups="file"/> + <syscall name="lgetxattr" number="192" groups="file"/> + <syscall name="fgetxattr" number="193" groups="descriptor"/> + <syscall name="listxattr" number="194" groups="file"/> + <syscall name="llistxattr" number="195" groups="file"/> + <syscall name="flistxattr" number="196" groups="descriptor"/> + <syscall name="removexattr" number="197" groups="file"/> + <syscall name="lremovexattr" number="198" groups="file"/> + <syscall name="fremovexattr" number="199" groups="descriptor"/> + <syscall name="tkill" number="200" groups="signal"/> + <syscall name="time" number="201"/> + <syscall name="futex" number="202"/> + <syscall name="sched_setaffinity" number="203"/> + <syscall name="sched_getaffinity" number="204"/> + <syscall name="set_thread_area" number="205"/> + <syscall name="io_setup" number="206"/> + <syscall name="io_destroy" number="207"/> + <syscall name="io_getevents" number="208"/> + <syscall name="io_submit" number="209"/> + <syscall name="io_cancel" number="210"/> + <syscall name="get_thread_area" number="211"/> + <syscall name="lookup_dcookie" number="212"/> + <syscall name="epoll_create" number="213" groups="descriptor"/> + <syscall name="epoll_ctl_old" number="214"/> + <syscall name="epoll_wait_old" number="215"/> + <syscall name="remap_file_pages" number="216" groups="memory"/> + <syscall name="getdents64" number="217" groups="descriptor"/> + <syscall name="set_tid_address" number="218"/> + <syscall name="restart_syscall" number="219"/> + <syscall name="semtimedop" number="220" groups="ipc"/> + <syscall name="fadvise64" number="221" groups="descriptor"/> + <syscall name="timer_create" number="222"/> + <syscall name="timer_settime" number="223"/> + <syscall name="timer_gettime" number="224"/> + <syscall name="timer_getoverrun" number="225"/> + <syscall name="timer_delete" number="226"/> + <syscall name="clock_settime" number="227"/> + <syscall name="clock_gettime" number="228"/> + <syscall name="clock_getres" number="229"/> + <syscall name="clock_nanosleep" number="230"/> + <syscall name="exit_group" number="231" groups="process"/> + <syscall name="epoll_wait" number="232" groups="descriptor"/> + <syscall name="epoll_ctl" number="233" groups="descriptor"/> + <syscall name="tgkill" number="234" groups="signal"/> + <syscall name="utimes" number="235" groups="file"/> + <syscall name="vserver" number="236"/> + <syscall name="mbind" number="237" groups="memory"/> + <syscall name="set_mempolicy" number="238" groups="memory"/> + <syscall name="get_mempolicy" number="239" groups="memory"/> + <syscall name="mq_open" number="240"/> + <syscall name="mq_unlink" number="241"/> + <syscall name="mq_timedsend" number="242"/> + <syscall name="mq_timedreceive" number="243"/> + <syscall name="mq_notify" number="244"/> + <syscall name="mq_getsetattr" number="245"/> + <syscall name="kexec_load" number="246"/> + <syscall name="waitid" number="247" groups="process"/> + <syscall name="add_key" number="248"/> + <syscall name="request_key" number="249"/> + <syscall name="keyctl" number="250"/> + <syscall name="ioprio_set" number="251"/> + <syscall name="ioprio_get" number="252"/> + <syscall name="inotify_init" number="253" groups="descriptor"/> + <syscall name="inotify_add_watch" number="254" groups="descriptor"/> + <syscall name="inotify_rm_watch" number="255" groups="descriptor"/> + <syscall name="migrate_pages" number="256" groups="memory"/> + <syscall name="openat" number="257" groups="descriptor,file"/> + <syscall name="mkdirat" number="258" groups="descriptor,file"/> + <syscall name="mknodat" number="259" groups="descriptor,file"/> + <syscall name="fchownat" number="260" groups="descriptor,file"/> + <syscall name="futimesat" number="261" groups="descriptor,file"/> + <syscall name="newfstatat" number="262" groups="descriptor,file"/> + <syscall name="unlinkat" number="263" groups="descriptor,file"/> + <syscall name="renameat" number="264" groups="descriptor,file"/> + <syscall name="linkat" number="265" groups="descriptor,file"/> + <syscall name="symlinkat" number="266" groups="descriptor,file"/> + <syscall name="readlinkat" number="267" groups="descriptor,file"/> + <syscall name="fchmodat" number="268" groups="descriptor,file"/> + <syscall name="faccessat" number="269" groups="descriptor,file"/> + <syscall name="pselect6" number="270" groups="descriptor"/> + <syscall name="ppoll" number="271" groups="descriptor"/> + <syscall name="unshare" number="272" groups="process"/> + <syscall name="set_robust_list" number="273"/> + <syscall name="get_robust_list" number="274"/> + <syscall name="splice" number="275" groups="descriptor"/> + <syscall name="tee" number="276" groups="descriptor"/> + <syscall name="sync_file_range" number="277" groups="descriptor"/> + <syscall name="vmsplice" number="278" groups="descriptor"/> + <syscall name="move_pages" number="279" groups="memory"/> + <syscall name="utimensat" number="280" groups="descriptor,file"/> + <syscall name="epoll_pwait" number="281" groups="descriptor"/> + <syscall name="signalfd" number="282" groups="descriptor,signal"/> + <syscall name="timerfd_create" number="283" groups="descriptor"/> + <syscall name="eventfd" number="284" groups="descriptor"/> + <syscall name="fallocate" number="285" groups="descriptor"/> + <syscall name="timerfd_settime" number="286" groups="descriptor"/> + <syscall name="timerfd_gettime" number="287" groups="descriptor"/> + <syscall name="accept4" number="288" groups="network"/> + <syscall name="signalfd4" number="289" groups="descriptor,signal"/> + <syscall name="eventfd2" number="290" groups="descriptor"/> + <syscall name="epoll_create1" number="291" groups="descriptor"/> + <syscall name="dup3" number="292" groups="descriptor"/> + <syscall name="pipe2" number="293" groups="descriptor"/> + <syscall name="inotify_init1" number="294" groups="descriptor"/> + <syscall name="preadv" number="295" groups="descriptor"/> + <syscall name="pwritev" number="296" groups="descriptor"/> +</syscalls_info> diff --git a/tools/msys/mingw64/share/gdb/syscalls/arm-linux.xml b/tools/msys/mingw64/share/gdb/syscalls/arm-linux.xml new file mode 100644 index 0000000000000000000000000000000000000000..d136e46248764b9d5898cd0846e964ab50318e13 --- /dev/null +++ b/tools/msys/mingw64/share/gdb/syscalls/arm-linux.xml @@ -0,0 +1,395 @@ +<?xml version="1.0"?> +<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd"> +<!-- Copyright (C) 2009-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. This file is offered as-is, + without any warranty. --> +<!-- This file was generated using the following file: + + linux/arch/arm/include/uapi/asm/unistd.h + + The file mentioned above belongs to the Linux Kernel. + Some small hand-edits were made. --> +<syscalls_info> + <syscall name="restart_syscall" number="0"/> + <syscall name="exit" number="1" groups="process"/> + <syscall name="fork" number="2" groups="process"/> + <syscall name="read" number="3" groups="descriptor"/> + <syscall name="write" number="4" groups="descriptor"/> + <syscall name="open" number="5" groups="descriptor,file"/> + <syscall name="close" number="6" groups="descriptor"/> + <syscall name="waitpid" number="7" groups="process"/> <!-- removed --> + <syscall name="creat" number="8" groups="descriptor,file"/> + <syscall name="link" number="9" groups="file"/> + <syscall name="unlink" number="10" groups="file"/> + <syscall name="execve" number="11" groups="file,process"/> + <syscall name="chdir" number="12" groups="file"/> + <syscall name="time" number="13"/> + <syscall name="mknod" number="14" groups="file"/> + <syscall name="chmod" number="15" groups="file"/> + <syscall name="lchown" number="16" groups="file"/> + <syscall name="break" number="17" groups="memory"/> <!-- removed --> + <syscall name="oldstat" number="18" groups="file"/> <!-- removed --> + <syscall name="lseek" number="19" groups="descriptor"/> + <syscall name="getpid" number="20"/> + <syscall name="mount" number="21" groups="file"/> + <syscall name="umount" number="22" groups="file"/> + <syscall name="setuid" number="23"/> + <syscall name="getuid" number="24"/> + <syscall name="stime" number="25"/> + <syscall name="ptrace" number="26"/> + <syscall name="alarm" number="27"/> + <syscall name="oldfstat" number="28" groups="descriptor"/> <!-- removed --> + <syscall name="pause" number="29" groups="signal"/> + <syscall name="utime" number="30" groups="file"/> + <syscall name="stty" number="31"/> <!-- removed --> + <syscall name="gtty" number="32"/> <!-- removed --> + <syscall name="access" number="33" groups="file"/> + <syscall name="nice" number="34"/> + <syscall name="ftime" number="35"/> <!-- removed --> + <syscall name="sync" number="36"/> + <syscall name="kill" number="37" groups="signal"/> + <syscall name="rename" number="38" groups="file"/> + <syscall name="mkdir" number="39" groups="file"/> + <syscall name="rmdir" number="40" groups="file"/> + <syscall name="dup" number="41" groups="descriptor"/> + <syscall name="pipe" number="42" groups="descriptor"/> + <syscall name="times" number="43"/> + <syscall name="prof" number="44"/> <!-- removed --> + <syscall name="brk" number="45" groups="memory"/> + <syscall name="setgid" number="46"/> + <syscall name="getgid" number="47"/> + <syscall name="signal" number="48" groups="signal"/> <!-- removed --> + <syscall name="geteuid" number="49"/> + <syscall name="getegid" number="50"/> + <syscall name="acct" number="51" groups="file"/> + <syscall name="umount2" number="52" groups="file"/> + <syscall name="lock" number="53"/> <!-- removed --> + <syscall name="ioctl" number="54" groups="descriptor"/> + <syscall name="fcntl" number="55" groups="descriptor"/> + <syscall name="mpx" number="56"/> <!-- removed --> + <syscall name="setpgid" number="57"/> + <syscall name="ulimit" number="58"/> <!-- removed --> + <syscall name="oldolduname" number="59"/> <!-- removed --> + <syscall name="umask" number="60"/> + <syscall name="chroot" number="61" groups="file"/> + <syscall name="ustat" number="62"/> + <syscall name="dup2" number="63" groups="descriptor"/> + <syscall name="getppid" number="64"/> + <syscall name="getpgrp" number="65"/> + <syscall name="setsid" number="66"/> + <syscall name="sigaction" number="67" groups="signal"/> + <syscall name="sgetmask" number="68" groups="signal"/> <!-- removed --> + <syscall name="ssetmask" number="69" groups="signal"/> <!-- removed --> + <syscall name="setreuid" number="70"/> + <syscall name="setregid" number="71"/> + <syscall name="sigsuspend" number="72" groups="signal"/> + <syscall name="sigpending" number="73" groups="signal"/> + <syscall name="sethostname" number="74"/> + <syscall name="setrlimit" number="75"/> + <syscall name="getrlimit" number="76"/> + <syscall name="getrusage" number="77"/> + <syscall name="gettimeofday" number="78"/> + <syscall name="settimeofday" number="79"/> + <syscall name="getgroups" number="80"/> + <syscall name="setgroups" number="81"/> + <syscall name="select" number="82" groups="descriptor"/> + <syscall name="symlink" number="83" groups="file"/> + <syscall name="oldlstat" number="84" groups="file"/> <!-- removed --> + <syscall name="readlink" number="85" groups="file"/> + <syscall name="uselib" number="86" groups="file"/> + <syscall name="swapon" number="87" groups="file"/> + <syscall name="reboot" number="88"/> + <syscall name="readdir" number="89" groups="descriptor"/> + <syscall name="mmap" number="90" groups="descriptor,memory"/> + <syscall name="munmap" number="91" groups="memory"/> + <syscall name="truncate" number="92" groups="file"/> + <syscall name="ftruncate" number="93" groups="descriptor"/> + <syscall name="fchmod" number="94" groups="descriptor"/> + <syscall name="fchown" number="95" groups="descriptor"/> + <syscall name="getpriority" number="96"/> + <syscall name="setpriority" number="97"/> + <syscall name="profil" number="98"/> <!-- removed --> + <syscall name="statfs" number="99" groups="file"/> + <syscall name="fstatfs" number="100" groups="descriptor"/> + <syscall name="ioperm" number="101"/> <!-- removed --> + <syscall name="socketcall" number="102" groups="descriptor"/> + <syscall name="syslog" number="103"/> + <syscall name="setitimer" number="104"/> + <syscall name="getitimer" number="105"/> + <syscall name="stat" number="106" groups="file"/> + <syscall name="lstat" number="107" groups="file"/> + <syscall name="fstat" number="108" groups="descriptor"/> + <syscall name="olduname" number="109"/> <!-- removed --> + <syscall name="iopl" number="110"/> <!-- removed --> + <syscall name="vhangup" number="111"/> + <syscall name="idle" number="112"/> <!-- removed --> + <syscall name="syscall" number="113"/> + <syscall name="wait4" number="114" groups="process"/> + <syscall name="swapoff" number="115" groups="file"/> + <syscall name="sysinfo" number="116"/> + <syscall name="ipc" number="117" groups="ipc"/> + <syscall name="fsync" number="118" groups="descriptor"/> + <syscall name="sigreturn" number="119" groups="signal"/> + <syscall name="clone" number="120" groups="process"/> + <syscall name="setdomainname" number="121"/> + <syscall name="uname" number="122"/> + <syscall name="modify_ldt" number="123"/> <!-- removed --> + <syscall name="adjtimex" number="124"/> + <syscall name="mprotect" number="125" groups="memory"/> + <syscall name="sigprocmask" number="126" groups="signal"/> + <syscall name="create_module" number="127"/> <!-- removed --> + <syscall name="init_module" number="128"/> + <syscall name="delete_module" number="129"/> + <syscall name="get_kernel_syms" number="130"/> <!-- removed --> + <syscall name="quotactl" number="131" groups="file"/> + <syscall name="getpgid" number="132"/> + <syscall name="fchdir" number="133" groups="descriptor"/> + <syscall name="bdflush" number="134"/> + <syscall name="sysfs" number="135"/> + <syscall name="personality" number="136"/> + <syscall name="afs_syscall" number="137"/> <!-- removed --> + <syscall name="setfsuid" number="138"/> + <syscall name="setfsgid" number="139"/> + <syscall name="_llseek" number="140" groups="descriptor"/> + <syscall name="getdents" number="141" groups="descriptor"/> + <syscall name="_newselect" number="142" groups="descriptor"/> + <syscall name="flock" number="143" groups="descriptor"/> + <syscall name="msync" number="144" groups="memory"/> + <syscall name="readv" number="145" groups="descriptor"/> + <syscall name="writev" number="146" groups="descriptor"/> + <syscall name="getsid" number="147"/> + <syscall name="fdatasync" number="148" groups="descriptor"/> + <syscall name="_sysctl" number="149"/> + <syscall name="mlock" number="150" groups="memory"/> + <syscall name="munlock" number="151" groups="memory"/> + <syscall name="mlockall" number="152" groups="memory"/> + <syscall name="munlockall" number="153" groups="memory"/> + <syscall name="sched_setparam" number="154"/> + <syscall name="sched_getparam" number="155"/> + <syscall name="sched_setscheduler" number="156"/> + <syscall name="sched_getscheduler" number="157"/> + <syscall name="sched_yield" number="158"/> + <syscall name="sched_get_priority_max" number="159"/> + <syscall name="sched_get_priority_min" number="160"/> + <syscall name="sched_rr_get_interval" number="161"/> + <syscall name="nanosleep" number="162"/> + <syscall name="mremap" number="163" groups="memory"/> + <syscall name="setresuid" number="164"/> + <syscall name="getresuid" number="165"/> + <syscall name="vm86" number="166"/> <!-- removed --> + <syscall name="query_module" number="167"/> <!-- removed --> + <syscall name="poll" number="168" groups="descriptor"/> + <syscall name="nfsservctl" number="169"/> + <syscall name="setresgid" number="170"/> + <syscall name="getresgid" number="171"/> + <syscall name="prctl" number="172"/> + <syscall name="rt_sigreturn" number="173" groups="signal"/> + <syscall name="rt_sigaction" number="174" groups="signal"/> + <syscall name="rt_sigprocmask" number="175" groups="signal"/> + <syscall name="rt_sigpending" number="176" groups="signal"/> + <syscall name="rt_sigtimedwait" number="177" groups="signal"/> + <syscall name="rt_sigqueueinfo" number="178" groups="signal"/> + <syscall name="rt_sigsuspend" number="179" groups="signal"/> + <syscall name="pread64" number="180" groups="descriptor"/> + <syscall name="pwrite64" number="181" groups="descriptor"/> + <syscall name="chown" number="182" groups="file"/> + <syscall name="getcwd" number="183" groups="file"/> + <syscall name="capget" number="184"/> + <syscall name="capset" number="185"/> + <syscall name="sigaltstack" number="186" groups="signal"/> + <syscall name="sendfile" number="187" groups="descriptor,network"/> + <syscall name="vfork" number="190" groups="process"/> + <syscall name="ugetrlimit" number="191"/> + <syscall name="mmap2" number="192" groups="descriptor,memory"/> + <syscall name="truncate64" number="193" groups="file"/> + <syscall name="ftruncate64" number="194" groups="descriptor"/> + <syscall name="stat64" number="195" groups="file"/> + <syscall name="lstat64" number="196" groups="file"/> + <syscall name="fstat64" number="197" groups="descriptor"/> + <syscall name="lchown32" number="198" groups="file"/> + <syscall name="getuid32" number="199"/> + <syscall name="getgid32" number="200"/> + <syscall name="geteuid32" number="201"/> + <syscall name="getegid32" number="202"/> + <syscall name="setreuid32" number="203"/> + <syscall name="setregid32" number="204"/> + <syscall name="getgroups32" number="205"/> + <syscall name="setgroups32" number="206"/> + <syscall name="fchown32" number="207" groups="descriptor"/> + <syscall name="setresuid32" number="208"/> + <syscall name="getresuid32" number="209"/> + <syscall name="setresgid32" number="210"/> + <syscall name="getresgid32" number="211"/> + <syscall name="chown32" number="212" groups="file"/> + <syscall name="setuid32" number="213"/> + <syscall name="setgid32" number="214"/> + <syscall name="setfsuid32" number="215"/> + <syscall name="setfsgid32" number="216"/> + <syscall name="getdents64" number="217" groups="descriptor"/> + <syscall name="pivot_root" number="218" groups="file"/> + <syscall name="mincore" number="219" groups="memory"/> + <syscall name="madvise" number="220" groups="memory"/> + <syscall name="fcntl64" number="221" groups="descriptor"/> + <syscall name="gettid" number="224"/> + <syscall name="readahead" number="225" groups="descriptor"/> + <syscall name="setxattr" number="226" groups="file"/> + <syscall name="lsetxattr" number="227" groups="file"/> + <syscall name="fsetxattr" number="228" groups="descriptor"/> + <syscall name="getxattr" number="229" groups="file"/> + <syscall name="lgetxattr" number="230" groups="file"/> + <syscall name="fgetxattr" number="231" groups="descriptor"/> + <syscall name="listxattr" number="232" groups="file"/> + <syscall name="llistxattr" number="233" groups="file"/> + <syscall name="flistxattr" number="234" groups="descriptor"/> + <syscall name="removexattr" number="235" groups="file"/> + <syscall name="lremovexattr" number="236" groups="file"/> + <syscall name="fremovexattr" number="237" groups="descriptor"/> + <syscall name="tkill" number="238" groups="signal"/> + <syscall name="sendfile64" number="239" groups="descriptor,network"/> + <syscall name="futex" number="240"/> + <syscall name="sched_setaffinity" number="241"/> + <syscall name="sched_getaffinity" number="242"/> + <syscall name="io_setup" number="243"/> + <syscall name="io_destroy" number="244"/> + <syscall name="io_getevents" number="245"/> + <syscall name="io_submit" number="246"/> + <syscall name="io_cancel" number="247"/> + <syscall name="exit_group" number="248" groups="process"/> + <syscall name="lookup_dcookie" number="249"/> + <syscall name="epoll_create" number="250" groups="descriptor"/> + <syscall name="epoll_ctl" number="251" groups="descriptor"/> + <syscall name="epoll_wait" number="252" groups="descriptor"/> + <syscall name="remap_file_pages" number="253" groups="memory"/> + <syscall name="set_tid_address" number="256"/> + <syscall name="timer_create" number="257"/> + <syscall name="timer_settime" number="258"/> + <syscall name="timer_gettime" number="259"/> + <syscall name="timer_getoverrun" number="260"/> + <syscall name="timer_delete" number="261"/> + <syscall name="clock_settime" number="262"/> + <syscall name="clock_gettime" number="263"/> + <syscall name="clock_getres" number="264"/> + <syscall name="clock_nanosleep" number="265"/> + <syscall name="statfs64" number="266" groups="file"/> + <syscall name="fstatfs64" number="267" groups="descriptor"/> + <syscall name="tgkill" number="268" groups="signal"/> + <syscall name="utimes" number="269" groups="file"/> + <syscall name="arm_fadvise64_64" number="270"/> + <syscall name="pciconfig_iobase" number="271"/> + <syscall name="pciconfig_read" number="272"/> + <syscall name="pciconfig_write" number="273"/> + <syscall name="mq_open" number="274"/> + <syscall name="mq_unlink" number="275"/> + <syscall name="mq_timedsend" number="276"/> + <syscall name="mq_timedreceive" number="277"/> + <syscall name="mq_notify" number="278"/> + <syscall name="mq_getsetattr" number="279"/> + <syscall name="waitid" number="280" groups="process"/> + <syscall name="socket" number="281" groups="network"/> + <syscall name="bind" number="282" groups="network"/> + <syscall name="connect" number="283" groups="network"/> + <syscall name="listen" number="284" groups="network"/> + <syscall name="accept" number="285" groups="network"/> + <syscall name="getsockname" number="286" groups="network"/> + <syscall name="getpeername" number="287" groups="network"/> + <syscall name="socketpair" number="288" groups="network"/> + <syscall name="send" number="289" groups="network"/> + <syscall name="sendto" number="290" groups="network"/> + <syscall name="recv" number="291" groups="network"/> + <syscall name="recvfrom" number="292" groups="network"/> + <syscall name="shutdown" number="293" groups="network"/> + <syscall name="setsockopt" number="294" groups="network"/> + <syscall name="getsockopt" number="295" groups="network"/> + <syscall name="sendmsg" number="296" groups="network"/> + <syscall name="recvmsg" number="297" groups="network"/> + <syscall name="semop" number="298" groups="ipc"/> + <syscall name="semget" number="299" groups="ipc"/> + <syscall name="semctl" number="300" groups="ipc"/> + <syscall name="msgsnd" number="301" groups="ipc"/> + <syscall name="msgrcv" number="302" groups="ipc"/> + <syscall name="msgget" number="303" groups="ipc"/> + <syscall name="msgctl" number="304" groups="ipc"/> + <syscall name="shmat" number="305" groups="ipc,memory"/> + <syscall name="shmdt" number="306" groups="ipc,memory"/> + <syscall name="shmget" number="307" groups="ipc"/> + <syscall name="shmctl" number="308" groups="ipc"/> + <syscall name="add_key" number="309"/> + <syscall name="request_key" number="310"/> + <syscall name="keyctl" number="311"/> + <syscall name="semtimedop" number="312" groups="ipc"/> + <syscall name="vserver" number="313"/> + <syscall name="ioprio_set" number="314"/> + <syscall name="ioprio_get" number="315"/> + <syscall name="inotify_init" number="316" groups="descriptor"/> + <syscall name="inotify_add_watch" number="317" groups="descriptor"/> + <syscall name="inotify_rm_watch" number="318" groups="descriptor"/> + <syscall name="mbind" number="319" groups="memory"/> + <syscall name="get_mempolicy" number="320" groups="memory"/> + <syscall name="set_mempolicy" number="321" groups="memory"/> + <syscall name="openat" number="322" groups="descriptor,file"/> + <syscall name="mkdirat" number="323" groups="descriptor,file"/> + <syscall name="mknodat" number="324" groups="descriptor,file"/> + <syscall name="fchownat" number="325" groups="descriptor,file"/> + <syscall name="futimesat" number="326" groups="descriptor,file"/> + <syscall name="fstatat64" number="327" groups="descriptor,file"/> + <syscall name="unlinkat" number="328" groups="descriptor,file"/> + <syscall name="renameat" number="329" groups="descriptor,file"/> + <syscall name="linkat" number="330" groups="descriptor,file"/> + <syscall name="symlinkat" number="331" groups="descriptor,file"/> + <syscall name="readlinkat" number="332" groups="descriptor,file"/> + <syscall name="fchmodat" number="333" groups="descriptor,file"/> + <syscall name="faccessat" number="334" groups="descriptor,file"/> + <syscall name="pselect6" number="335" groups="descriptor"/> + <syscall name="ppoll" number="336" groups="descriptor"/> + <syscall name="unshare" number="337" groups="process"/> + <syscall name="set_robust_list" number="338"/> + <syscall name="get_robust_list" number="339"/> + <syscall name="splice" number="340" groups="descriptor"/> + <syscall name="arm_sync_file_range" number="341"/> + <syscall name="tee" number="342" groups="descriptor"/> + <syscall name="vmsplice" number="343" groups="descriptor"/> + <syscall name="move_pages" number="344" groups="memory"/> + <syscall name="getcpu" number="345"/> + <syscall name="epoll_pwait" number="346" groups="descriptor"/> + <syscall name="kexec_load" number="347"/> + <syscall name="utimensat" number="348" groups="descriptor,file"/> + <syscall name="signalfd" number="349" groups="descriptor,signal"/> + <syscall name="timerfd_create" number="350" groups="descriptor"/> + <syscall name="eventfd" number="351" groups="descriptor"/> + <syscall name="fallocate" number="352" groups="descriptor"/> + <syscall name="timerfd_settime" number="353" groups="descriptor"/> + <syscall name="timerfd_gettime" number="354" groups="descriptor"/> + <syscall name="signalfd4" number="355" groups="descriptor,signal"/> + <syscall name="eventfd2" number="356" groups="descriptor"/> + <syscall name="epoll_create1" number="357" groups="descriptor"/> + <syscall name="dup3" number="358" groups="descriptor"/> + <syscall name="pipe2" number="359" groups="descriptor"/> + <syscall name="inotify_init1" number="360" groups="descriptor"/> + <syscall name="preadv" number="361" groups="descriptor"/> + <syscall name="pwritev" number="362" groups="descriptor"/> + <syscall name="rt_tgsigqueueinfo" number="363" groups="process,signal"/> + <syscall name="perf_event_open" number="364" groups="descriptor"/> + <syscall name="recvmmsg" number="365" groups="network"/> + <syscall name="accept4" number="366" groups="network"/> + <syscall name="fanotify_init" number="367" groups="descriptor"/> + <syscall name="fanotify_mark" number="368" groups="descriptor,file"/> + <syscall name="prlimit64" number="369"/> + <syscall name="name_to_handle_at" number="370" groups="descriptor,file"/> + <syscall name="open_by_handle_at" number="371" groups="descriptor"/> + <syscall name="clock_adjtime" number="372"/> + <syscall name="syncfs" number="373" groups="descriptor"/> + <syscall name="sendmmsg" number="374" groups="network"/> + <syscall name="setns" number="375" groups="descriptor"/> + <syscall name="process_vm_readv" number="376"/> + <syscall name="process_vm_writev" number="377"/> + <syscall name="kcmp" number="378"/> + <syscall name="finit_module" number="379" groups="descriptor"/> + <syscall name="ARM_breakpoint" number="983041"/> + <syscall name="ARM_cacheflush" number="983042"/> + <syscall name="ARM_usr26" number="983043"/> + <syscall name="ARM_usr32" number="983044"/> + <syscall name="ARM_set_tls" number="983045"/> +</syscalls_info> diff --git a/tools/msys/mingw64/share/gdb/syscalls/freebsd.xml b/tools/msys/mingw64/share/gdb/syscalls/freebsd.xml new file mode 100644 index 0000000000000000000000000000000000000000..c9655e4890d70228baff34cf11b65e76201fc27d --- /dev/null +++ b/tools/msys/mingw64/share/gdb/syscalls/freebsd.xml @@ -0,0 +1,474 @@ +<?xml version="1.0"?> <!-- THIS FILE IS GENERATED -*- buffer-read-only: t -*- --> +<!-- vi:set ro: --> +<!-- Copyright (C) 2009-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> + +<!DOCTYPE feature SYSTEM "gdb-syscalls.dtd"> + +<!-- This file was generated using the following file: + + /usr/src/sys/sys/syscall.h + + The file mentioned above belongs to the FreeBSD Kernel. --> + +<syscalls_info> + <syscall name="syscall" number="0"/> + <syscall name="exit" number="1"/> + <syscall name="fork" number="2"/> + <syscall name="read" number="3"/> + <syscall name="write" number="4"/> + <syscall name="open" number="5"/> + <syscall name="close" number="6"/> + <syscall name="wait4" number="7"/> + <syscall name="link" number="9"/> + <syscall name="unlink" number="10"/> + <syscall name="execv" number="11"/> + <syscall name="chdir" number="12"/> + <syscall name="fchdir" number="13"/> + <syscall name="freebsd11_mknod" number="14" alias="mknod"/> + <syscall name="chmod" number="15"/> + <syscall name="chown" number="16"/> + <syscall name="break" number="17"/> + <syscall name="freebsd4_getfsstat" number="18" alias="getfsstat"/> + <syscall name="getpid" number="20"/> + <syscall name="mount" number="21"/> + <syscall name="unmount" number="22"/> + <syscall name="setuid" number="23"/> + <syscall name="getuid" number="24"/> + <syscall name="geteuid" number="25"/> + <syscall name="ptrace" number="26"/> + <syscall name="recvmsg" number="27"/> + <syscall name="sendmsg" number="28"/> + <syscall name="recvfrom" number="29"/> + <syscall name="accept" number="30"/> + <syscall name="getpeername" number="31"/> + <syscall name="getsockname" number="32"/> + <syscall name="access" number="33"/> + <syscall name="chflags" number="34"/> + <syscall name="fchflags" number="35"/> + <syscall name="sync" number="36"/> + <syscall name="kill" number="37"/> + <syscall name="getppid" number="39"/> + <syscall name="dup" number="41"/> + <syscall name="freebsd10_pipe" number="42" alias="pipe"/> + <syscall name="getegid" number="43"/> + <syscall name="profil" number="44"/> + <syscall name="ktrace" number="45"/> + <syscall name="getgid" number="47"/> + <syscall name="getlogin" number="49"/> + <syscall name="setlogin" number="50"/> + <syscall name="acct" number="51"/> + <syscall name="sigaltstack" number="53"/> + <syscall name="ioctl" number="54"/> + <syscall name="reboot" number="55"/> + <syscall name="revoke" number="56"/> + <syscall name="symlink" number="57"/> + <syscall name="readlink" number="58"/> + <syscall name="execve" number="59"/> + <syscall name="umask" number="60"/> + <syscall name="chroot" number="61"/> + <syscall name="msync" number="65"/> + <syscall name="vfork" number="66"/> + <syscall name="vread" number="67"/> + <syscall name="vwrite" number="68"/> + <syscall name="sbrk" number="69"/> + <syscall name="sstk" number="70"/> + <syscall name="freebsd11_vadvise" number="72" alias="vadvise"/> + <syscall name="munmap" number="73"/> + <syscall name="mprotect" number="74"/> + <syscall name="madvise" number="75"/> + <syscall name="vhangup" number="76"/> + <syscall name="vlimit" number="77"/> + <syscall name="mincore" number="78"/> + <syscall name="getgroups" number="79"/> + <syscall name="setgroups" number="80"/> + <syscall name="getpgrp" number="81"/> + <syscall name="setpgid" number="82"/> + <syscall name="setitimer" number="83"/> + <syscall name="swapon" number="85"/> + <syscall name="getitimer" number="86"/> + <syscall name="getdtablesize" number="89"/> + <syscall name="dup2" number="90"/> + <syscall name="fcntl" number="92"/> + <syscall name="select" number="93"/> + <syscall name="fsync" number="95"/> + <syscall name="setpriority" number="96"/> + <syscall name="socket" number="97"/> + <syscall name="connect" number="98"/> + <syscall name="getpriority" number="100"/> + <syscall name="bind" number="104"/> + <syscall name="setsockopt" number="105"/> + <syscall name="listen" number="106"/> + <syscall name="vtimes" number="107"/> + <syscall name="vtrace" number="115"/> + <syscall name="gettimeofday" number="116"/> + <syscall name="getrusage" number="117"/> + <syscall name="getsockopt" number="118"/> + <syscall name="readv" number="120"/> + <syscall name="writev" number="121"/> + <syscall name="settimeofday" number="122"/> + <syscall name="fchown" number="123"/> + <syscall name="fchmod" number="124"/> + <syscall name="setreuid" number="126"/> + <syscall name="setregid" number="127"/> + <syscall name="rename" number="128"/> + <syscall name="flock" number="131"/> + <syscall name="mkfifo" number="132"/> + <syscall name="sendto" number="133"/> + <syscall name="shutdown" number="134"/> + <syscall name="socketpair" number="135"/> + <syscall name="mkdir" number="136"/> + <syscall name="rmdir" number="137"/> + <syscall name="utimes" number="138"/> + <syscall name="adjtime" number="140"/> + <syscall name="setsid" number="147"/> + <syscall name="quotactl" number="148"/> + <syscall name="nlm_syscall" number="154"/> + <syscall name="nfssvc" number="155"/> + <syscall name="freebsd4_statfs" number="157" alias="statfs"/> + <syscall name="freebsd4_fstatfs" number="158" alias="fstatfs"/> + <syscall name="lgetfh" number="160"/> + <syscall name="getfh" number="161"/> + <syscall name="freebsd4_getdomainname" number="162" alias="getdomainname"/> + <syscall name="freebsd4_setdomainname" number="163" alias="setdomainname"/> + <syscall name="freebsd4_uname" number="164" alias="uname"/> + <syscall name="sysarch" number="165"/> + <syscall name="rtprio" number="166"/> + <syscall name="semsys" number="169"/> + <syscall name="msgsys" number="170"/> + <syscall name="shmsys" number="171"/> + <syscall name="freebsd6_pread" number="173" alias="pread"/> + <syscall name="freebsd6_pwrite" number="174" alias="pwrite"/> + <syscall name="setfib" number="175"/> + <syscall name="ntp_adjtime" number="176"/> + <syscall name="setgid" number="181"/> + <syscall name="setegid" number="182"/> + <syscall name="seteuid" number="183"/> + <syscall name="lfs_bmapv" number="184"/> + <syscall name="lfs_markv" number="185"/> + <syscall name="lfs_segclean" number="186"/> + <syscall name="lfs_segwait" number="187"/> + <syscall name="freebsd11_stat" number="188" alias="stat"/> + <syscall name="freebsd11_fstat" number="189" alias="fstat"/> + <syscall name="freebsd11_lstat" number="190" alias="lstat"/> + <syscall name="pathconf" number="191"/> + <syscall name="fpathconf" number="192"/> + <syscall name="getrlimit" number="194"/> + <syscall name="setrlimit" number="195"/> + <syscall name="freebsd11_getdirentries" number="196" alias="getdirentries"/> + <syscall name="freebsd6_mmap" number="197" alias="mmap"/> + <syscall name="__syscall" number="198"/> + <syscall name="freebsd6_lseek" number="199" alias="lseek"/> + <syscall name="freebsd6_truncate" number="200" alias="truncate"/> + <syscall name="freebsd6_ftruncate" number="201" alias="ftruncate"/> + <syscall name="__sysctl" number="202"/> + <syscall name="mlock" number="203"/> + <syscall name="munlock" number="204"/> + <syscall name="undelete" number="205"/> + <syscall name="futimes" number="206"/> + <syscall name="getpgid" number="207"/> + <syscall name="poll" number="209"/> + <syscall name="freebsd7___semctl" number="220" alias="__semctl"/> + <syscall name="semget" number="221"/> + <syscall name="semop" number="222"/> + <syscall name="semconfig" number="223"/> + <syscall name="freebsd7_msgctl" number="224" alias="msgctl"/> + <syscall name="msgget" number="225"/> + <syscall name="msgsnd" number="226"/> + <syscall name="msgrcv" number="227"/> + <syscall name="shmat" number="228"/> + <syscall name="freebsd7_shmctl" number="229" alias="shmctl"/> + <syscall name="shmdt" number="230"/> + <syscall name="shmget" number="231"/> + <syscall name="clock_gettime" number="232"/> + <syscall name="clock_settime" number="233"/> + <syscall name="clock_getres" number="234"/> + <syscall name="ktimer_create" number="235"/> + <syscall name="ktimer_delete" number="236"/> + <syscall name="ktimer_settime" number="237"/> + <syscall name="ktimer_gettime" number="238"/> + <syscall name="ktimer_getoverrun" number="239"/> + <syscall name="nanosleep" number="240"/> + <syscall name="ffclock_getcounter" number="241"/> + <syscall name="ffclock_setestimate" number="242"/> + <syscall name="ffclock_getestimate" number="243"/> + <syscall name="clock_nanosleep" number="244"/> + <syscall name="clock_getcpuclockid2" number="247"/> + <syscall name="ntp_gettime" number="248"/> + <syscall name="minherit" number="250"/> + <syscall name="rfork" number="251"/> + <syscall name="openbsd_poll" number="252"/> + <syscall name="issetugid" number="253"/> + <syscall name="lchown" number="254"/> + <syscall name="aio_read" number="255"/> + <syscall name="aio_write" number="256"/> + <syscall name="lio_listio" number="257"/> + <syscall name="freebsd11_getdents" number="272" alias="getdents"/> + <syscall name="lchmod" number="274"/> + <syscall name="netbsd_lchown" number="275"/> + <syscall name="lutimes" number="276"/> + <syscall name="netbsd_msync" number="277"/> + <syscall name="freebsd11_nstat" number="278" alias="nstat"/> + <syscall name="freebsd11_nfstat" number="279" alias="nfstat"/> + <syscall name="freebsd11_nlstat" number="280" alias="nlstat"/> + <syscall name="preadv" number="289"/> + <syscall name="pwritev" number="290"/> + <syscall name="freebsd4_fhstatfs" number="297" alias="fhstatfs"/> + <syscall name="fhopen" number="298"/> + <syscall name="freebsd11_fhstat" number="299" alias="fhstat"/> + <syscall name="modnext" number="300"/> + <syscall name="modstat" number="301"/> + <syscall name="modfnext" number="302"/> + <syscall name="modfind" number="303"/> + <syscall name="kldload" number="304"/> + <syscall name="kldunload" number="305"/> + <syscall name="kldfind" number="306"/> + <syscall name="kldnext" number="307"/> + <syscall name="kldstat" number="308"/> + <syscall name="kldfirstmod" number="309"/> + <syscall name="getsid" number="310"/> + <syscall name="setresuid" number="311"/> + <syscall name="setresgid" number="312"/> + <syscall name="signanosleep" number="313"/> + <syscall name="aio_return" number="314"/> + <syscall name="aio_suspend" number="315"/> + <syscall name="aio_cancel" number="316"/> + <syscall name="aio_error" number="317"/> + <syscall name="freebsd6_aio_read" number="318" alias="aio_read"/> + <syscall name="freebsd6_aio_write" number="319" alias="aio_write"/> + <syscall name="freebsd6_lio_listio" number="320" alias="lio_listio"/> + <syscall name="yield" number="321"/> + <syscall name="thr_sleep" number="322"/> + <syscall name="thr_wakeup" number="323"/> + <syscall name="mlockall" number="324"/> + <syscall name="munlockall" number="325"/> + <syscall name="__getcwd" number="326"/> + <syscall name="sched_setparam" number="327"/> + <syscall name="sched_getparam" number="328"/> + <syscall name="sched_setscheduler" number="329"/> + <syscall name="sched_getscheduler" number="330"/> + <syscall name="sched_yield" number="331"/> + <syscall name="sched_get_priority_max" number="332"/> + <syscall name="sched_get_priority_min" number="333"/> + <syscall name="sched_rr_get_interval" number="334"/> + <syscall name="utrace" number="335"/> + <syscall name="freebsd4_sendfile" number="336" alias="sendfile"/> + <syscall name="kldsym" number="337"/> + <syscall name="jail" number="338"/> + <syscall name="nnpfs_syscall" number="339"/> + <syscall name="sigprocmask" number="340"/> + <syscall name="sigsuspend" number="341"/> + <syscall name="freebsd4_sigaction" number="342" alias="sigaction"/> + <syscall name="sigpending" number="343"/> + <syscall name="freebsd4_sigreturn" number="344" alias="sigreturn"/> + <syscall name="sigtimedwait" number="345"/> + <syscall name="sigwaitinfo" number="346"/> + <syscall name="__acl_get_file" number="347"/> + <syscall name="__acl_set_file" number="348"/> + <syscall name="__acl_get_fd" number="349"/> + <syscall name="__acl_set_fd" number="350"/> + <syscall name="__acl_delete_file" number="351"/> + <syscall name="__acl_delete_fd" number="352"/> + <syscall name="__acl_aclcheck_file" number="353"/> + <syscall name="__acl_aclcheck_fd" number="354"/> + <syscall name="extattrctl" number="355"/> + <syscall name="extattr_set_file" number="356"/> + <syscall name="extattr_get_file" number="357"/> + <syscall name="extattr_delete_file" number="358"/> + <syscall name="aio_waitcomplete" number="359"/> + <syscall name="getresuid" number="360"/> + <syscall name="getresgid" number="361"/> + <syscall name="kqueue" number="362"/> + <syscall name="freebsd11_kevent" number="363" alias="kevent"/> + <syscall name="__cap_get_proc" number="364"/> + <syscall name="__cap_set_proc" number="365"/> + <syscall name="__cap_get_fd" number="366"/> + <syscall name="__cap_get_file" number="367"/> + <syscall name="__cap_set_fd" number="368"/> + <syscall name="__cap_set_file" number="369"/> + <syscall name="extattr_set_fd" number="371"/> + <syscall name="extattr_get_fd" number="372"/> + <syscall name="extattr_delete_fd" number="373"/> + <syscall name="__setugid" number="374"/> + <syscall name="nfsclnt" number="375"/> + <syscall name="eaccess" number="376"/> + <syscall name="afs3_syscall" number="377"/> + <syscall name="nmount" number="378"/> + <syscall name="kse_exit" number="379"/> + <syscall name="kse_wakeup" number="380"/> + <syscall name="kse_create" number="381"/> + <syscall name="kse_thr_interrupt" number="382"/> + <syscall name="kse_release" number="383"/> + <syscall name="__mac_get_proc" number="384"/> + <syscall name="__mac_set_proc" number="385"/> + <syscall name="__mac_get_fd" number="386"/> + <syscall name="__mac_get_file" number="387"/> + <syscall name="__mac_set_fd" number="388"/> + <syscall name="__mac_set_file" number="389"/> + <syscall name="kenv" number="390"/> + <syscall name="lchflags" number="391"/> + <syscall name="uuidgen" number="392"/> + <syscall name="sendfile" number="393"/> + <syscall name="mac_syscall" number="394"/> + <syscall name="freebsd11_getfsstat" number="395" alias="getfsstat"/> + <syscall name="freebsd11_statfs" number="396" alias="statfs"/> + <syscall name="freebsd11_fstatfs" number="397" alias="fstatfs"/> + <syscall name="freebsd11_fhstatfs" number="398" alias="fhstatfs"/> + <syscall name="ksem_close" number="400"/> + <syscall name="ksem_post" number="401"/> + <syscall name="ksem_wait" number="402"/> + <syscall name="ksem_trywait" number="403"/> + <syscall name="ksem_init" number="404"/> + <syscall name="ksem_open" number="405"/> + <syscall name="ksem_unlink" number="406"/> + <syscall name="ksem_getvalue" number="407"/> + <syscall name="ksem_destroy" number="408"/> + <syscall name="__mac_get_pid" number="409"/> + <syscall name="__mac_get_link" number="410"/> + <syscall name="__mac_set_link" number="411"/> + <syscall name="extattr_set_link" number="412"/> + <syscall name="extattr_get_link" number="413"/> + <syscall name="extattr_delete_link" number="414"/> + <syscall name="__mac_execve" number="415"/> + <syscall name="sigaction" number="416"/> + <syscall name="sigreturn" number="417"/> + <syscall name="getcontext" number="421"/> + <syscall name="setcontext" number="422"/> + <syscall name="swapcontext" number="423"/> + <syscall name="swapoff" number="424"/> + <syscall name="__acl_get_link" number="425"/> + <syscall name="__acl_set_link" number="426"/> + <syscall name="__acl_delete_link" number="427"/> + <syscall name="__acl_aclcheck_link" number="428"/> + <syscall name="sigwait" number="429"/> + <syscall name="thr_create" number="430"/> + <syscall name="thr_exit" number="431"/> + <syscall name="thr_self" number="432"/> + <syscall name="thr_kill" number="433"/> + <syscall name="jail_attach" number="436"/> + <syscall name="extattr_list_fd" number="437"/> + <syscall name="extattr_list_file" number="438"/> + <syscall name="extattr_list_link" number="439"/> + <syscall name="kse_switchin" number="440"/> + <syscall name="ksem_timedwait" number="441"/> + <syscall name="thr_suspend" number="442"/> + <syscall name="thr_wake" number="443"/> + <syscall name="kldunloadf" number="444"/> + <syscall name="audit" number="445"/> + <syscall name="auditon" number="446"/> + <syscall name="getauid" number="447"/> + <syscall name="setauid" number="448"/> + <syscall name="getaudit" number="449"/> + <syscall name="setaudit" number="450"/> + <syscall name="getaudit_addr" number="451"/> + <syscall name="setaudit_addr" number="452"/> + <syscall name="auditctl" number="453"/> + <syscall name="_umtx_op" number="454"/> + <syscall name="thr_new" number="455"/> + <syscall name="sigqueue" number="456"/> + <syscall name="kmq_open" number="457"/> + <syscall name="kmq_setattr" number="458"/> + <syscall name="kmq_timedreceive" number="459"/> + <syscall name="kmq_timedsend" number="460"/> + <syscall name="kmq_notify" number="461"/> + <syscall name="kmq_unlink" number="462"/> + <syscall name="abort2" number="463"/> + <syscall name="thr_set_name" number="464"/> + <syscall name="aio_fsync" number="465"/> + <syscall name="rtprio_thread" number="466"/> + <syscall name="sctp_peeloff" number="471"/> + <syscall name="sctp_generic_sendmsg" number="472"/> + <syscall name="sctp_generic_sendmsg_iov" number="473"/> + <syscall name="sctp_generic_recvmsg" number="474"/> + <syscall name="pread" number="475"/> + <syscall name="pwrite" number="476"/> + <syscall name="mmap" number="477"/> + <syscall name="lseek" number="478"/> + <syscall name="truncate" number="479"/> + <syscall name="ftruncate" number="480"/> + <syscall name="thr_kill2" number="481"/> + <syscall name="shm_open" number="482"/> + <syscall name="shm_unlink" number="483"/> + <syscall name="cpuset" number="484"/> + <syscall name="cpuset_setid" number="485"/> + <syscall name="cpuset_getid" number="486"/> + <syscall name="cpuset_getaffinity" number="487"/> + <syscall name="cpuset_setaffinity" number="488"/> + <syscall name="faccessat" number="489"/> + <syscall name="fchmodat" number="490"/> + <syscall name="fchownat" number="491"/> + <syscall name="fexecve" number="492"/> + <syscall name="freebsd11_fstatat" number="493" alias="fstatat"/> + <syscall name="futimesat" number="494"/> + <syscall name="linkat" number="495"/> + <syscall name="mkdirat" number="496"/> + <syscall name="mkfifoat" number="497"/> + <syscall name="freebsd11_mknodat" number="498" alias="mknodat"/> + <syscall name="openat" number="499"/> + <syscall name="readlinkat" number="500"/> + <syscall name="renameat" number="501"/> + <syscall name="symlinkat" number="502"/> + <syscall name="unlinkat" number="503"/> + <syscall name="posix_openpt" number="504"/> + <syscall name="gssd_syscall" number="505"/> + <syscall name="jail_get" number="506"/> + <syscall name="jail_set" number="507"/> + <syscall name="jail_remove" number="508"/> + <syscall name="closefrom" number="509"/> + <syscall name="__semctl" number="510"/> + <syscall name="msgctl" number="511"/> + <syscall name="shmctl" number="512"/> + <syscall name="lpathconf" number="513"/> + <syscall name="cap_new" number="514"/> + <syscall name="__cap_rights_get" number="515"/> + <syscall name="cap_enter" number="516"/> + <syscall name="cap_getmode" number="517"/> + <syscall name="pdfork" number="518"/> + <syscall name="pdkill" number="519"/> + <syscall name="pdgetpid" number="520"/> + <syscall name="pselect" number="522"/> + <syscall name="getloginclass" number="523"/> + <syscall name="setloginclass" number="524"/> + <syscall name="rctl_get_racct" number="525"/> + <syscall name="rctl_get_rules" number="526"/> + <syscall name="rctl_get_limits" number="527"/> + <syscall name="rctl_add_rule" number="528"/> + <syscall name="rctl_remove_rule" number="529"/> + <syscall name="posix_fallocate" number="530"/> + <syscall name="posix_fadvise" number="531"/> + <syscall name="wait6" number="532"/> + <syscall name="cap_rights_limit" number="533"/> + <syscall name="cap_ioctls_limit" number="534"/> + <syscall name="cap_ioctls_get" number="535"/> + <syscall name="cap_fcntls_limit" number="536"/> + <syscall name="cap_fcntls_get" number="537"/> + <syscall name="bindat" number="538"/> + <syscall name="connectat" number="539"/> + <syscall name="chflagsat" number="540"/> + <syscall name="accept4" number="541"/> + <syscall name="pipe2" number="542"/> + <syscall name="aio_mlock" number="543"/> + <syscall name="procctl" number="544"/> + <syscall name="ppoll" number="545"/> + <syscall name="futimens" number="546"/> + <syscall name="utimensat" number="547"/> + <syscall name="numa_getaffinity" number="548"/> + <syscall name="numa_setaffinity" number="549"/> + <syscall name="fdatasync" number="550"/> + <syscall name="fstat" number="551"/> + <syscall name="fstatat" number="552"/> + <syscall name="fhstat" number="553"/> + <syscall name="getdirentries" number="554"/> + <syscall name="statfs" number="555"/> + <syscall name="fstatfs" number="556"/> + <syscall name="getfsstat" number="557"/> + <syscall name="fhstatfs" number="558"/> + <syscall name="mknodat" number="559"/> + <syscall name="kevent" number="560"/> + <syscall name="cpuset_getdomain" number="561"/> + <syscall name="cpuset_setdomain" number="562"/> + <syscall name="getrandom" number="563"/> +</syscalls_info> diff --git a/tools/msys/mingw64/share/gdb/syscalls/gdb-syscalls.dtd b/tools/msys/mingw64/share/gdb/syscalls/gdb-syscalls.dtd new file mode 100644 index 0000000000000000000000000000000000000000..d7d83f7fbbd7c5ad63d497cd918f1f9a74003857 --- /dev/null +++ b/tools/msys/mingw64/share/gdb/syscalls/gdb-syscalls.dtd @@ -0,0 +1,16 @@ +<!-- Copyright (C) 2009-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> + +<!-- The root element of a syscall info is <syscalls-info>. --> + +<!ELEMENT syscalls-info (syscall*)> + +<!ELEMENT syscall EMPTY> +<!ATTLIST syscall + name CDATA #REQUIRED + number CDATA #REQUIRED + alias CDATA #IMPLIED + groups CDATA #IMPLIED> diff --git a/tools/msys/mingw64/share/gdb/syscalls/i386-linux.xml b/tools/msys/mingw64/share/gdb/syscalls/i386-linux.xml new file mode 100644 index 0000000000000000000000000000000000000000..55bff9f3b7a6353396e72df23434d854535fc494 --- /dev/null +++ b/tools/msys/mingw64/share/gdb/syscalls/i386-linux.xml @@ -0,0 +1,337 @@ +<?xml version="1.0"?> +<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd"> +<!-- Copyright (C) 2009-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> +<!-- This file was generated using the following file: + + /usr/src/linux/arch/x86/include/asm/unistd_32.h + + The file mentioned above belongs to the Linux Kernel. --> +<syscalls_info> + <syscall name="restart_syscall" number="0"/> + <syscall name="exit" number="1" groups="process"/> + <syscall name="fork" number="2" groups="process"/> + <syscall name="read" number="3" groups="descriptor"/> + <syscall name="write" number="4" groups="descriptor"/> + <syscall name="open" number="5" groups="descriptor,file"/> + <syscall name="close" number="6" groups="descriptor"/> + <syscall name="waitpid" number="7" groups="process"/> + <syscall name="creat" number="8" groups="descriptor,file"/> + <syscall name="link" number="9" groups="file"/> + <syscall name="unlink" number="10" groups="file"/> + <syscall name="execve" number="11" groups="file,process"/> + <syscall name="chdir" number="12" groups="file"/> + <syscall name="time" number="13"/> + <syscall name="mknod" number="14" groups="file"/> + <syscall name="chmod" number="15" groups="file"/> + <syscall name="lchown" number="16" groups="file"/> + <syscall name="break" number="17" groups="memory"/> + <syscall name="oldstat" number="18" groups="file"/> + <syscall name="lseek" number="19" groups="descriptor"/> + <syscall name="getpid" number="20"/> + <syscall name="mount" number="21" groups="file"/> + <syscall name="umount" number="22" groups="file"/> + <syscall name="setuid" number="23"/> + <syscall name="getuid" number="24"/> + <syscall name="stime" number="25"/> + <syscall name="ptrace" number="26"/> + <syscall name="alarm" number="27"/> + <syscall name="oldfstat" number="28" groups="descriptor"/> + <syscall name="pause" number="29" groups="signal"/> + <syscall name="utime" number="30" groups="file"/> + <syscall name="stty" number="31"/> + <syscall name="gtty" number="32"/> + <syscall name="access" number="33" groups="file"/> + <syscall name="nice" number="34"/> + <syscall name="ftime" number="35"/> + <syscall name="sync" number="36"/> + <syscall name="kill" number="37" groups="signal"/> + <syscall name="rename" number="38" groups="file"/> + <syscall name="mkdir" number="39" groups="file"/> + <syscall name="rmdir" number="40" groups="file"/> + <syscall name="dup" number="41" groups="descriptor"/> + <syscall name="pipe" number="42" groups="descriptor"/> + <syscall name="times" number="43"/> + <syscall name="prof" number="44"/> + <syscall name="brk" number="45" groups="memory"/> + <syscall name="setgid" number="46"/> + <syscall name="getgid" number="47"/> + <syscall name="signal" number="48" groups="signal"/> + <syscall name="geteuid" number="49"/> + <syscall name="getegid" number="50"/> + <syscall name="acct" number="51" groups="file"/> + <syscall name="umount2" number="52" groups="file"/> + <syscall name="lock" number="53"/> + <syscall name="ioctl" number="54" groups="descriptor"/> + <syscall name="fcntl" number="55" groups="descriptor"/> + <syscall name="mpx" number="56"/> + <syscall name="setpgid" number="57"/> + <syscall name="ulimit" number="58"/> + <syscall name="oldolduname" number="59"/> + <syscall name="umask" number="60"/> + <syscall name="chroot" number="61" groups="file"/> + <syscall name="ustat" number="62"/> + <syscall name="dup2" number="63" groups="descriptor"/> + <syscall name="getppid" number="64"/> + <syscall name="getpgrp" number="65"/> + <syscall name="setsid" number="66"/> + <syscall name="sigaction" number="67" groups="signal"/> + <syscall name="sgetmask" number="68" groups="signal"/> + <syscall name="ssetmask" number="69" groups="signal"/> + <syscall name="setreuid" number="70"/> + <syscall name="setregid" number="71"/> + <syscall name="sigsuspend" number="72" groups="signal"/> + <syscall name="sigpending" number="73" groups="signal"/> + <syscall name="sethostname" number="74"/> + <syscall name="setrlimit" number="75"/> + <syscall name="getrlimit" number="76"/> + <syscall name="getrusage" number="77"/> + <syscall name="gettimeofday" number="78"/> + <syscall name="settimeofday" number="79"/> + <syscall name="getgroups" number="80"/> + <syscall name="setgroups" number="81"/> + <syscall name="select" number="82" groups="descriptor"/> + <syscall name="symlink" number="83" groups="file"/> + <syscall name="oldlstat" number="84" groups="file"/> + <syscall name="readlink" number="85" groups="file"/> + <syscall name="uselib" number="86" groups="file"/> + <syscall name="swapon" number="87" groups="file"/> + <syscall name="reboot" number="88"/> + <syscall name="readdir" number="89" groups="descriptor"/> + <syscall name="mmap" number="90" groups="descriptor,memory"/> + <syscall name="munmap" number="91" groups="memory"/> + <syscall name="truncate" number="92" groups="file"/> + <syscall name="ftruncate" number="93" groups="descriptor"/> + <syscall name="fchmod" number="94" groups="descriptor"/> + <syscall name="fchown" number="95" groups="descriptor"/> + <syscall name="getpriority" number="96"/> + <syscall name="setpriority" number="97"/> + <syscall name="profil" number="98"/> + <syscall name="statfs" number="99" groups="file"/> + <syscall name="fstatfs" number="100" groups="descriptor"/> + <syscall name="ioperm" number="101"/> + <syscall name="socketcall" number="102" groups="descriptor"/> + <syscall name="syslog" number="103"/> + <syscall name="setitimer" number="104"/> + <syscall name="getitimer" number="105"/> + <syscall name="stat" number="106" groups="file"/> + <syscall name="lstat" number="107" groups="file"/> + <syscall name="fstat" number="108" groups="descriptor"/> + <syscall name="olduname" number="109"/> + <syscall name="iopl" number="110"/> + <syscall name="vhangup" number="111"/> + <syscall name="idle" number="112"/> + <syscall name="vm86old" number="113"/> + <syscall name="wait4" number="114" groups="process"/> + <syscall name="swapoff" number="115" groups="file"/> + <syscall name="sysinfo" number="116"/> + <syscall name="ipc" number="117" groups="ipc"/> + <syscall name="fsync" number="118" groups="descriptor"/> + <syscall name="sigreturn" number="119" groups="signal"/> + <syscall name="clone" number="120" groups="process"/> + <syscall name="setdomainname" number="121"/> + <syscall name="uname" number="122"/> + <syscall name="modify_ldt" number="123"/> + <syscall name="adjtimex" number="124"/> + <syscall name="mprotect" number="125" groups="memory"/> + <syscall name="sigprocmask" number="126" groups="signal"/> + <syscall name="create_module" number="127"/> + <syscall name="init_module" number="128"/> + <syscall name="delete_module" number="129"/> + <syscall name="get_kernel_syms" number="130"/> + <syscall name="quotactl" number="131" groups="file"/> + <syscall name="getpgid" number="132"/> + <syscall name="fchdir" number="133" groups="descriptor"/> + <syscall name="bdflush" number="134"/> + <syscall name="sysfs" number="135"/> + <syscall name="personality" number="136"/> + <syscall name="afs_syscall" number="137"/> + <syscall name="setfsuid" number="138"/> + <syscall name="setfsgid" number="139"/> + <syscall name="_llseek" number="140" groups="descriptor"/> + <syscall name="getdents" number="141" groups="descriptor"/> + <syscall name="_newselect" number="142" groups="descriptor"/> + <syscall name="flock" number="143" groups="descriptor"/> + <syscall name="msync" number="144" groups="memory"/> + <syscall name="readv" number="145" groups="descriptor"/> + <syscall name="writev" number="146" groups="descriptor"/> + <syscall name="getsid" number="147"/> + <syscall name="fdatasync" number="148" groups="descriptor"/> + <syscall name="_sysctl" number="149"/> + <syscall name="mlock" number="150" groups="memory"/> + <syscall name="munlock" number="151" groups="memory"/> + <syscall name="mlockall" number="152" groups="memory"/> + <syscall name="munlockall" number="153" groups="memory"/> + <syscall name="sched_setparam" number="154"/> + <syscall name="sched_getparam" number="155"/> + <syscall name="sched_setscheduler" number="156"/> + <syscall name="sched_getscheduler" number="157"/> + <syscall name="sched_yield" number="158"/> + <syscall name="sched_get_priority_max" number="159"/> + <syscall name="sched_get_priority_min" number="160"/> + <syscall name="sched_rr_get_interval" number="161"/> + <syscall name="nanosleep" number="162"/> + <syscall name="mremap" number="163" groups="memory"/> + <syscall name="setresuid" number="164"/> + <syscall name="getresuid" number="165"/> + <syscall name="vm86" number="166"/> + <syscall name="query_module" number="167"/> + <syscall name="poll" number="168" groups="descriptor"/> + <syscall name="nfsservctl" number="169"/> + <syscall name="setresgid" number="170"/> + <syscall name="getresgid" number="171"/> + <syscall name="prctl" number="172"/> + <syscall name="rt_sigreturn" number="173" groups="signal"/> + <syscall name="rt_sigaction" number="174" groups="signal"/> + <syscall name="rt_sigprocmask" number="175" groups="signal"/> + <syscall name="rt_sigpending" number="176" groups="signal"/> + <syscall name="rt_sigtimedwait" number="177" groups="signal"/> + <syscall name="rt_sigqueueinfo" number="178" groups="signal"/> + <syscall name="rt_sigsuspend" number="179" groups="signal"/> + <syscall name="pread64" number="180" groups="descriptor"/> + <syscall name="pwrite64" number="181" groups="descriptor"/> + <syscall name="chown" number="182" groups="file"/> + <syscall name="getcwd" number="183" groups="file"/> + <syscall name="capget" number="184"/> + <syscall name="capset" number="185"/> + <syscall name="sigaltstack" number="186" groups="signal"/> + <syscall name="sendfile" number="187" groups="descriptor,network"/> + <syscall name="getpmsg" number="188"/> + <syscall name="putpmsg" number="189"/> + <syscall name="vfork" number="190" groups="process"/> + <syscall name="ugetrlimit" number="191"/> + <syscall name="mmap2" number="192" groups="descriptor,memory"/> + <syscall name="truncate64" number="193" groups="file"/> + <syscall name="ftruncate64" number="194" groups="descriptor"/> + <syscall name="stat64" number="195" groups="file"/> + <syscall name="lstat64" number="196" groups="file"/> + <syscall name="fstat64" number="197" groups="descriptor"/> + <syscall name="lchown32" number="198" groups="file"/> + <syscall name="getuid32" number="199"/> + <syscall name="getgid32" number="200"/> + <syscall name="geteuid32" number="201"/> + <syscall name="getegid32" number="202"/> + <syscall name="setreuid32" number="203"/> + <syscall name="setregid32" number="204"/> + <syscall name="getgroups32" number="205"/> + <syscall name="setgroups32" number="206"/> + <syscall name="fchown32" number="207" groups="descriptor"/> + <syscall name="setresuid32" number="208"/> + <syscall name="getresuid32" number="209"/> + <syscall name="setresgid32" number="210"/> + <syscall name="getresgid32" number="211"/> + <syscall name="chown32" number="212" groups="file"/> + <syscall name="setuid32" number="213"/> + <syscall name="setgid32" number="214"/> + <syscall name="setfsuid32" number="215"/> + <syscall name="setfsgid32" number="216"/> + <syscall name="pivot_root" number="217" groups="file"/> + <syscall name="mincore" number="218" groups="memory"/> + <syscall name="madvise" number="219" groups="memory"/> + <syscall name="madvise1" number="220"/> + <syscall name="getdents64" number="221" groups="descriptor"/> + <syscall name="fcntl64" number="222" groups="descriptor"/> + <syscall name="gettid" number="224"/> + <syscall name="readahead" number="225" groups="descriptor"/> + <syscall name="setxattr" number="226" groups="file"/> + <syscall name="lsetxattr" number="227" groups="file"/> + <syscall name="fsetxattr" number="228" groups="descriptor"/> + <syscall name="getxattr" number="229" groups="file"/> + <syscall name="lgetxattr" number="230" groups="file"/> + <syscall name="fgetxattr" number="231" groups="descriptor"/> + <syscall name="listxattr" number="232" groups="file"/> + <syscall name="llistxattr" number="233" groups="file"/> + <syscall name="flistxattr" number="234" groups="descriptor"/> + <syscall name="removexattr" number="235" groups="file"/> + <syscall name="lremovexattr" number="236" groups="file"/> + <syscall name="fremovexattr" number="237" groups="descriptor"/> + <syscall name="tkill" number="238" groups="signal"/> + <syscall name="sendfile64" number="239" groups="descriptor,network"/> + <syscall name="futex" number="240"/> + <syscall name="sched_setaffinity" number="241"/> + <syscall name="sched_getaffinity" number="242"/> + <syscall name="set_thread_area" number="243"/> + <syscall name="get_thread_area" number="244"/> + <syscall name="io_setup" number="245"/> + <syscall name="io_destroy" number="246"/> + <syscall name="io_getevents" number="247"/> + <syscall name="io_submit" number="248"/> + <syscall name="io_cancel" number="249"/> + <syscall name="fadvise64" number="250" groups="descriptor"/> + <syscall name="exit_group" number="252" groups="process"/> + <syscall name="lookup_dcookie" number="253"/> + <syscall name="epoll_create" number="254" groups="descriptor"/> + <syscall name="epoll_ctl" number="255" groups="descriptor"/> + <syscall name="epoll_wait" number="256" groups="descriptor"/> + <syscall name="remap_file_pages" number="257" groups="memory"/> + <syscall name="set_tid_address" number="258"/> + <syscall name="timer_create" number="259"/> + <syscall name="timer_settime" number="260"/> + <syscall name="timer_gettime" number="261"/> + <syscall name="timer_getoverrun" number="262"/> + <syscall name="timer_delete" number="263"/> + <syscall name="clock_settime" number="264"/> + <syscall name="clock_gettime" number="265"/> + <syscall name="clock_getres" number="266"/> + <syscall name="clock_nanosleep" number="267"/> + <syscall name="statfs64" number="268" groups="file"/> + <syscall name="fstatfs64" number="269" groups="descriptor"/> + <syscall name="tgkill" number="270" groups="signal"/> + <syscall name="utimes" number="271" groups="file"/> + <syscall name="fadvise64_64" number="272" groups="descriptor"/> + <syscall name="vserver" number="273"/> + <syscall name="mbind" number="274" groups="memory"/> + <syscall name="get_mempolicy" number="275" groups="memory"/> + <syscall name="set_mempolicy" number="276" groups="memory"/> + <syscall name="mq_open" number="277"/> + <syscall name="mq_unlink" number="278"/> + <syscall name="mq_timedsend" number="279"/> + <syscall name="mq_timedreceive" number="280"/> + <syscall name="mq_notify" number="281"/> + <syscall name="mq_getsetattr" number="282"/> + <syscall name="kexec_load" number="283"/> + <syscall name="waitid" number="284" groups="process"/> + <syscall name="add_key" number="286"/> + <syscall name="request_key" number="287"/> + <syscall name="keyctl" number="288"/> + <syscall name="ioprio_set" number="289"/> + <syscall name="ioprio_get" number="290"/> + <syscall name="inotify_init" number="291" groups="descriptor"/> + <syscall name="inotify_add_watch" number="292" groups="descriptor"/> + <syscall name="inotify_rm_watch" number="293" groups="descriptor"/> + <syscall name="migrate_pages" number="294" groups="memory"/> + <syscall name="openat" number="295" groups="descriptor,file"/> + <syscall name="mkdirat" number="296" groups="descriptor,file"/> + <syscall name="mknodat" number="297" groups="descriptor,file"/> + <syscall name="fchownat" number="298" groups="descriptor,file"/> + <syscall name="futimesat" number="299" groups="descriptor,file"/> + <syscall name="fstatat64" number="300" groups="descriptor,file"/> + <syscall name="unlinkat" number="301" groups="descriptor,file"/> + <syscall name="renameat" number="302" groups="descriptor,file"/> + <syscall name="linkat" number="303" groups="descriptor,file"/> + <syscall name="symlinkat" number="304" groups="descriptor,file"/> + <syscall name="readlinkat" number="305" groups="descriptor,file"/> + <syscall name="fchmodat" number="306" groups="descriptor,file"/> + <syscall name="faccessat" number="307" groups="descriptor,file"/> + <syscall name="pselect6" number="308" groups="descriptor"/> + <syscall name="ppoll" number="309" groups="descriptor"/> + <syscall name="unshare" number="310" groups="process"/> + <syscall name="set_robust_list" number="311"/> + <syscall name="get_robust_list" number="312"/> + <syscall name="splice" number="313" groups="descriptor"/> + <syscall name="sync_file_range" number="314" groups="descriptor"/> + <syscall name="tee" number="315" groups="descriptor"/> + <syscall name="vmsplice" number="316" groups="descriptor"/> + <syscall name="move_pages" number="317" groups="memory"/> + <syscall name="getcpu" number="318"/> + <syscall name="epoll_pwait" number="319" groups="descriptor"/> + <syscall name="utimensat" number="320" groups="descriptor,file"/> + <syscall name="signalfd" number="321" groups="descriptor,signal"/> + <syscall name="timerfd_create" number="322" groups="descriptor"/> + <syscall name="eventfd" number="323" groups="descriptor"/> + <syscall name="fallocate" number="324" groups="descriptor"/> + <syscall name="timerfd_settime" number="325" groups="descriptor"/> +</syscalls_info> diff --git a/tools/msys/mingw64/share/gdb/syscalls/mips-n32-linux.xml b/tools/msys/mingw64/share/gdb/syscalls/mips-n32-linux.xml new file mode 100644 index 0000000000000000000000000000000000000000..810922f313048cb83fc8cfd83c5bfde48b8d9e62 --- /dev/null +++ b/tools/msys/mingw64/share/gdb/syscalls/mips-n32-linux.xml @@ -0,0 +1,316 @@ +<?xml version="1.0"?> +<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd"> +<!-- Copyright (C) 2011-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> +<!-- This file was generated using the following file: + + /usr/src/linux/arch/mips/include/asm/unistd.h + + The file mentioned above belongs to the Linux Kernel. --> +<syscalls_info> + <syscall name="read" number="6000" groups="descriptor"/> + <syscall name="write" number="6001" groups="descriptor"/> + <syscall name="open" number="6002" groups="descriptor,file"/> + <syscall name="close" number="6003" groups="descriptor"/> + <syscall name="stat" number="6004" groups="file"/> + <syscall name="fstat" number="6005" groups="descriptor"/> + <syscall name="lstat" number="6006" groups="file"/> + <syscall name="poll" number="6007" groups="descriptor"/> + <syscall name="lseek" number="6008" groups="descriptor"/> + <syscall name="mmap" number="6009" groups="descriptor,memory"/> + <syscall name="mprotect" number="6010" groups="memory"/> + <syscall name="munmap" number="6011" groups="memory"/> + <syscall name="brk" number="6012" groups="memory"/> + <syscall name="rt_sigaction" number="6013" groups="signal"/> + <syscall name="rt_sigprocmask" number="6014" groups="signal"/> + <syscall name="ioctl" number="6015" groups="descriptor"/> + <syscall name="pread64" number="6016" groups="descriptor"/> + <syscall name="pwrite64" number="6017" groups="descriptor"/> + <syscall name="readv" number="6018" groups="descriptor"/> + <syscall name="writev" number="6019" groups="descriptor"/> + <syscall name="access" number="6020" groups="file"/> + <syscall name="pipe" number="6021" groups="descriptor"/> + <syscall name="_newselect" number="6022" groups="descriptor"/> + <syscall name="sched_yield" number="6023"/> + <syscall name="mremap" number="6024" groups="memory"/> + <syscall name="msync" number="6025" groups="memory"/> + <syscall name="mincore" number="6026" groups="memory"/> + <syscall name="madvise" number="6027" groups="memory"/> + <syscall name="shmget" number="6028" groups="ipc"/> + <syscall name="shmat" number="6029" groups="ipc,memory"/> + <syscall name="shmctl" number="6030" groups="ipc"/> + <syscall name="dup" number="6031" groups="descriptor"/> + <syscall name="dup2" number="6032" groups="descriptor"/> + <syscall name="pause" number="6033" groups="signal"/> + <syscall name="nanosleep" number="6034"/> + <syscall name="getitimer" number="6035"/> + <syscall name="setitimer" number="6036"/> + <syscall name="alarm" number="6037"/> + <syscall name="getpid" number="6038"/> + <syscall name="sendfile" number="6039" groups="descriptor,network"/> + <syscall name="socket" number="6040" groups="network"/> + <syscall name="connect" number="6041" groups="network"/> + <syscall name="accept" number="6042" groups="network"/> + <syscall name="sendto" number="6043" groups="network"/> + <syscall name="recvfrom" number="6044" groups="network"/> + <syscall name="sendmsg" number="6045" groups="network"/> + <syscall name="recvmsg" number="6046" groups="network"/> + <syscall name="shutdown" number="6047" groups="network"/> + <syscall name="bind" number="6048" groups="network"/> + <syscall name="listen" number="6049" groups="network"/> + <syscall name="getsockname" number="6050" groups="network"/> + <syscall name="getpeername" number="6051" groups="network"/> + <syscall name="socketpair" number="6052" groups="network"/> + <syscall name="setsockopt" number="6053" groups="network"/> + <syscall name="getsockopt" number="6054" groups="network"/> + <syscall name="clone" number="6055" groups="process"/> + <syscall name="fork" number="6056" groups="process"/> + <syscall name="execve" number="6057" groups="file,process"/> + <syscall name="exit" number="6058" groups="process"/> + <syscall name="wait4" number="6059" groups="process"/> + <syscall name="kill" number="6060" groups="signal"/> + <syscall name="uname" number="6061"/> + <syscall name="semget" number="6062" groups="ipc"/> + <syscall name="semop" number="6063" groups="ipc"/> + <syscall name="semctl" number="6064" groups="ipc"/> + <syscall name="shmdt" number="6065" groups="ipc,memory"/> + <syscall name="msgget" number="6066" groups="ipc"/> + <syscall name="msgsnd" number="6067" groups="ipc"/> + <syscall name="msgrcv" number="6068" groups="ipc"/> + <syscall name="msgctl" number="6069" groups="ipc"/> + <syscall name="fcntl" number="6070" groups="descriptor"/> + <syscall name="flock" number="6071" groups="descriptor"/> + <syscall name="fsync" number="6072" groups="descriptor"/> + <syscall name="fdatasync" number="6073" groups="descriptor"/> + <syscall name="truncate" number="6074" groups="file"/> + <syscall name="ftruncate" number="6075" groups="descriptor"/> + <syscall name="getdents" number="6076" groups="descriptor"/> + <syscall name="getcwd" number="6077" groups="file"/> + <syscall name="chdir" number="6078" groups="file"/> + <syscall name="fchdir" number="6079" groups="descriptor"/> + <syscall name="rename" number="6080" groups="file"/> + <syscall name="mkdir" number="6081" groups="file"/> + <syscall name="rmdir" number="6082" groups="file"/> + <syscall name="creat" number="6083" groups="descriptor,file"/> + <syscall name="link" number="6084" groups="file"/> + <syscall name="unlink" number="6085" groups="file"/> + <syscall name="symlink" number="6086" groups="file"/> + <syscall name="readlink" number="6087" groups="file"/> + <syscall name="chmod" number="6088" groups="file"/> + <syscall name="fchmod" number="6089" groups="descriptor"/> + <syscall name="chown" number="6090" groups="file"/> + <syscall name="fchown" number="6091" groups="descriptor"/> + <syscall name="lchown" number="6092" groups="file"/> + <syscall name="umask" number="6093"/> + <syscall name="gettimeofday" number="6094"/> + <syscall name="getrlimit" number="6095"/> + <syscall name="getrusage" number="6096"/> + <syscall name="sysinfo" number="6097"/> + <syscall name="times" number="6098"/> + <syscall name="ptrace" number="6099"/> + <syscall name="getuid" number="6100"/> + <syscall name="syslog" number="6101"/> + <syscall name="getgid" number="6102"/> + <syscall name="setuid" number="6103"/> + <syscall name="setgid" number="6104"/> + <syscall name="geteuid" number="6105"/> + <syscall name="getegid" number="6106"/> + <syscall name="setpgid" number="6107"/> + <syscall name="getppid" number="6108"/> + <syscall name="getpgrp" number="6109"/> + <syscall name="setsid" number="6110"/> + <syscall name="setreuid" number="6111"/> + <syscall name="setregid" number="6112"/> + <syscall name="getgroups" number="6113"/> + <syscall name="setgroups" number="6114"/> + <syscall name="setresuid" number="6115"/> + <syscall name="getresuid" number="6116"/> + <syscall name="setresgid" number="6117"/> + <syscall name="getresgid" number="6118"/> + <syscall name="getpgid" number="6119"/> + <syscall name="setfsuid" number="6120"/> + <syscall name="setfsgid" number="6121"/> + <syscall name="getsid" number="6122"/> + <syscall name="capget" number="6123"/> + <syscall name="capset" number="6124"/> + <syscall name="rt_sigpending" number="6125" groups="signal"/> + <syscall name="rt_sigtimedwait" number="6126" groups="signal"/> + <syscall name="rt_sigqueueinfo" number="6127" groups="signal"/> + <syscall name="rt_sigsuspend" number="6128" groups="signal"/> + <syscall name="sigaltstack" number="6129" groups="signal"/> + <syscall name="utime" number="6130" groups="file"/> + <syscall name="mknod" number="6131" groups="file"/> + <syscall name="personality" number="6132"/> + <syscall name="ustat" number="6133"/> + <syscall name="statfs" number="6134" groups="file"/> + <syscall name="fstatfs" number="6135" groups="descriptor"/> + <syscall name="sysfs" number="6136"/> + <syscall name="getpriority" number="6137"/> + <syscall name="setpriority" number="6138"/> + <syscall name="sched_setparam" number="6139"/> + <syscall name="sched_getparam" number="6140"/> + <syscall name="sched_setscheduler" number="6141"/> + <syscall name="sched_getscheduler" number="6142"/> + <syscall name="sched_get_priority_max" number="6143"/> + <syscall name="sched_get_priority_min" number="6144"/> + <syscall name="sched_rr_get_interval" number="6145"/> + <syscall name="mlock" number="6146" groups="memory"/> + <syscall name="munlock" number="6147" groups="memory"/> + <syscall name="mlockall" number="6148" groups="memory"/> + <syscall name="munlockall" number="6149" groups="memory"/> + <syscall name="vhangup" number="6150"/> + <syscall name="pivot_root" number="6151" groups="file"/> + <syscall name="_sysctl" number="6152"/> + <syscall name="prctl" number="6153"/> + <syscall name="adjtimex" number="6154"/> + <syscall name="setrlimit" number="6155"/> + <syscall name="chroot" number="6156" groups="file"/> + <syscall name="sync" number="6157"/> + <syscall name="acct" number="6158" groups="file"/> + <syscall name="settimeofday" number="6159"/> + <syscall name="mount" number="6160" groups="file"/> + <syscall name="umount2" number="6161" groups="file"/> + <syscall name="swapon" number="6162" groups="file"/> + <syscall name="swapoff" number="6163" groups="file"/> + <syscall name="reboot" number="6164"/> + <syscall name="sethostname" number="6165"/> + <syscall name="setdomainname" number="6166"/> + <syscall name="create_module" number="6167"/> + <syscall name="init_module" number="6168"/> + <syscall name="delete_module" number="6169"/> + <syscall name="get_kernel_syms" number="6170"/> + <syscall name="query_module" number="6171"/> + <syscall name="quotactl" number="6172" groups="file"/> + <syscall name="nfsservctl" number="6173"/> + <syscall name="getpmsg" number="6174"/> + <syscall name="putpmsg" number="6175"/> + <syscall name="afs_syscall" number="6176"/> + <syscall name="reserved177" number="6177"/> + <syscall name="gettid" number="6178"/> + <syscall name="readahead" number="6179" groups="descriptor"/> + <syscall name="setxattr" number="6180" groups="file"/> + <syscall name="lsetxattr" number="6181" groups="file"/> + <syscall name="fsetxattr" number="6182" groups="descriptor"/> + <syscall name="getxattr" number="6183" groups="file"/> + <syscall name="lgetxattr" number="6184" groups="file"/> + <syscall name="fgetxattr" number="6185" groups="descriptor"/> + <syscall name="listxattr" number="6186" groups="file"/> + <syscall name="llistxattr" number="6187" groups="file"/> + <syscall name="flistxattr" number="6188" groups="descriptor"/> + <syscall name="removexattr" number="6189" groups="file"/> + <syscall name="lremovexattr" number="6190" groups="file"/> + <syscall name="fremovexattr" number="6191" groups="descriptor"/> + <syscall name="tkill" number="6192" groups="signal"/> + <syscall name="reserved193" number="6193"/> + <syscall name="futex" number="6194"/> + <syscall name="sched_setaffinity" number="6195"/> + <syscall name="sched_getaffinity" number="6196"/> + <syscall name="cacheflush" number="6197"/> + <syscall name="cachectl" number="6198"/> + <syscall name="sysmips" number="6199"/> + <syscall name="io_setup" number="6200"/> + <syscall name="io_destroy" number="6201"/> + <syscall name="io_getevents" number="6202"/> + <syscall name="io_submit" number="6203"/> + <syscall name="io_cancel" number="6204"/> + <syscall name="exit_group" number="6205" groups="process"/> + <syscall name="lookup_dcookie" number="6206"/> + <syscall name="epoll_create" number="6207" groups="descriptor"/> + <syscall name="epoll_ctl" number="6208" groups="descriptor"/> + <syscall name="epoll_wait" number="6209" groups="descriptor"/> + <syscall name="remap_file_pages" number="6210" groups="memory"/> + <syscall name="rt_sigreturn" number="6211" groups="signal"/> + <syscall name="fcntl64" number="6212" groups="descriptor"/> + <syscall name="set_tid_address" number="6213"/> + <syscall name="restart_syscall" number="6214"/> + <syscall name="semtimedop" number="6215" groups="ipc"/> + <syscall name="fadvise64" number="6216" groups="descriptor"/> + <syscall name="statfs64" number="6217" groups="file"/> + <syscall name="fstatfs64" number="6218" groups="descriptor"/> + <syscall name="sendfile64" number="6219" groups="descriptor,network"/> + <syscall name="timer_create" number="6220"/> + <syscall name="timer_settime" number="6221"/> + <syscall name="timer_gettime" number="6222"/> + <syscall name="timer_getoverrun" number="6223"/> + <syscall name="timer_delete" number="6224"/> + <syscall name="clock_settime" number="6225"/> + <syscall name="clock_gettime" number="6226"/> + <syscall name="clock_getres" number="6227"/> + <syscall name="clock_nanosleep" number="6228"/> + <syscall name="tgkill" number="6229" groups="signal"/> + <syscall name="utimes" number="6230" groups="file"/> + <syscall name="mbind" number="6231" groups="memory"/> + <syscall name="get_mempolicy" number="6232" groups="memory"/> + <syscall name="set_mempolicy" number="6233" groups="memory"/> + <syscall name="mq_open" number="6234"/> + <syscall name="mq_unlink" number="6235"/> + <syscall name="mq_timedsend" number="6236"/> + <syscall name="mq_timedreceive" number="6237"/> + <syscall name="mq_notify" number="6238"/> + <syscall name="mq_getsetattr" number="6239"/> + <syscall name="vserver" number="6240"/> + <syscall name="waitid" number="6241" groups="process"/> + <syscall name="add_key" number="6243"/> + <syscall name="request_key" number="6244"/> + <syscall name="keyctl" number="6245"/> + <syscall name="set_thread_area" number="6246"/> + <syscall name="inotify_init" number="6247" groups="descriptor"/> + <syscall name="inotify_add_watch" number="6248" groups="descriptor"/> + <syscall name="inotify_rm_watch" number="6249" groups="descriptor"/> + <syscall name="migrate_pages" number="6250" groups="memory"/> + <syscall name="openat" number="6251" groups="descriptor,file"/> + <syscall name="mkdirat" number="6252" groups="descriptor,file"/> + <syscall name="mknodat" number="6253" groups="descriptor,file"/> + <syscall name="fchownat" number="6254" groups="descriptor,file"/> + <syscall name="futimesat" number="6255" groups="descriptor,file"/> + <syscall name="newfstatat" number="6256" groups="descriptor,file"/> + <syscall name="unlinkat" number="6257" groups="descriptor,file"/> + <syscall name="renameat" number="6258" groups="descriptor,file"/> + <syscall name="linkat" number="6259" groups="descriptor,file"/> + <syscall name="symlinkat" number="6260" groups="descriptor,file"/> + <syscall name="readlinkat" number="6261" groups="descriptor,file"/> + <syscall name="fchmodat" number="6262" groups="descriptor,file"/> + <syscall name="faccessat" number="6263" groups="descriptor,file"/> + <syscall name="pselect6" number="6264" groups="descriptor"/> + <syscall name="ppoll" number="6265" groups="descriptor"/> + <syscall name="unshare" number="6266" groups="process"/> + <syscall name="splice" number="6267" groups="descriptor"/> + <syscall name="sync_file_range" number="6268" groups="descriptor"/> + <syscall name="tee" number="6269" groups="descriptor"/> + <syscall name="vmsplice" number="6270" groups="descriptor"/> + <syscall name="move_pages" number="6271" groups="memory"/> + <syscall name="set_robust_list" number="6272"/> + <syscall name="get_robust_list" number="6273"/> + <syscall name="kexec_load" number="6274"/> + <syscall name="getcpu" number="6275"/> + <syscall name="epoll_pwait" number="6276" groups="descriptor"/> + <syscall name="ioprio_set" number="6277"/> + <syscall name="ioprio_get" number="6278"/> + <syscall name="utimensat" number="6279" groups="descriptor,file"/> + <syscall name="signalfd" number="6280" groups="descriptor,signal"/> + <syscall name="timerfd" number="6281" groups="descriptor"/> + <syscall name="eventfd" number="6282" groups="descriptor"/> + <syscall name="fallocate" number="6283" groups="descriptor"/> + <syscall name="timerfd_create" number="6284" groups="descriptor"/> + <syscall name="timerfd_gettime" number="6285" groups="descriptor"/> + <syscall name="timerfd_settime" number="6286" groups="descriptor"/> + <syscall name="signalfd4" number="6287" groups="descriptor,signal"/> + <syscall name="eventfd2" number="6288" groups="descriptor"/> + <syscall name="epoll_create1" number="6289" groups="descriptor"/> + <syscall name="dup3" number="6290" groups="descriptor"/> + <syscall name="pipe2" number="6291" groups="descriptor"/> + <syscall name="inotify_init1" number="6292" groups="descriptor"/> + <syscall name="preadv" number="6293" groups="descriptor"/> + <syscall name="pwritev" number="6294" groups="descriptor"/> + <syscall name="rt_tgsigqueueinfo" number="6295" groups="process,signal"/> + <syscall name="perf_event_open" number="6296" groups="descriptor"/> + <syscall name="accept4" number="6297" groups="network"/> + <syscall name="recvmmsg" number="6298" groups="network"/> + <syscall name="getdents64" number="6299" groups="descriptor"/> + <syscall name="fanotify_init" number="6300" groups="descriptor"/> + <syscall name="fanotify_mark" number="6301" groups="descriptor,file"/> + <syscall name="prlimit64" number="6302"/> +</syscalls_info> diff --git a/tools/msys/mingw64/share/gdb/syscalls/mips-n64-linux.xml b/tools/msys/mingw64/share/gdb/syscalls/mips-n64-linux.xml new file mode 100644 index 0000000000000000000000000000000000000000..18ba610a7ec5efb7448f7b457811c84216aabdfb --- /dev/null +++ b/tools/msys/mingw64/share/gdb/syscalls/mips-n64-linux.xml @@ -0,0 +1,309 @@ +<?xml version="1.0"?> +<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd"> +<!-- Copyright (C) 2011-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> +<!-- This file was generated using the following file: + + /usr/src/linux/arch/mips/include/asm/unistd.h + + The file mentioned above belongs to the Linux Kernel. --> +<syscalls_info> + <syscall name="read" number="5000" groups="descriptor"/> + <syscall name="write" number="5001" groups="descriptor"/> + <syscall name="open" number="5002" groups="descriptor,file"/> + <syscall name="close" number="5003" groups="descriptor"/> + <syscall name="stat" number="5004" groups="file"/> + <syscall name="fstat" number="5005" groups="descriptor"/> + <syscall name="lstat" number="5006" groups="file"/> + <syscall name="poll" number="5007" groups="descriptor"/> + <syscall name="lseek" number="5008" groups="descriptor"/> + <syscall name="mmap" number="5009" groups="descriptor,memory"/> + <syscall name="mprotect" number="5010" groups="memory"/> + <syscall name="munmap" number="5011" groups="memory"/> + <syscall name="brk" number="5012" groups="memory"/> + <syscall name="rt_sigaction" number="5013" groups="signal"/> + <syscall name="rt_sigprocmask" number="5014" groups="signal"/> + <syscall name="ioctl" number="5015" groups="descriptor"/> + <syscall name="pread64" number="5016" groups="descriptor"/> + <syscall name="pwrite64" number="5017" groups="descriptor"/> + <syscall name="readv" number="5018" groups="descriptor"/> + <syscall name="writev" number="5019" groups="descriptor"/> + <syscall name="access" number="5020" groups="file"/> + <syscall name="pipe" number="5021" groups="descriptor"/> + <syscall name="_newselect" number="5022" groups="descriptor"/> + <syscall name="sched_yield" number="5023"/> + <syscall name="mremap" number="5024" groups="memory"/> + <syscall name="msync" number="5025" groups="memory"/> + <syscall name="mincore" number="5026" groups="memory"/> + <syscall name="madvise" number="5027" groups="memory"/> + <syscall name="shmget" number="5028" groups="ipc"/> + <syscall name="shmat" number="5029" groups="ipc,memory"/> + <syscall name="shmctl" number="5030" groups="ipc"/> + <syscall name="dup" number="5031" groups="descriptor"/> + <syscall name="dup2" number="5032" groups="descriptor"/> + <syscall name="pause" number="5033" groups="signal"/> + <syscall name="nanosleep" number="5034"/> + <syscall name="getitimer" number="5035"/> + <syscall name="setitimer" number="5036"/> + <syscall name="alarm" number="5037"/> + <syscall name="getpid" number="5038"/> + <syscall name="sendfile" number="5039" groups="descriptor,network"/> + <syscall name="socket" number="5040" groups="network"/> + <syscall name="connect" number="5041" groups="network"/> + <syscall name="accept" number="5042" groups="network"/> + <syscall name="sendto" number="5043" groups="network"/> + <syscall name="recvfrom" number="5044" groups="network"/> + <syscall name="sendmsg" number="5045" groups="network"/> + <syscall name="recvmsg" number="5046" groups="network"/> + <syscall name="shutdown" number="5047" groups="network"/> + <syscall name="bind" number="5048" groups="network"/> + <syscall name="listen" number="5049" groups="network"/> + <syscall name="getsockname" number="5050" groups="network"/> + <syscall name="getpeername" number="5051" groups="network"/> + <syscall name="socketpair" number="5052" groups="network"/> + <syscall name="setsockopt" number="5053" groups="network"/> + <syscall name="getsockopt" number="5054" groups="network"/> + <syscall name="clone" number="5055" groups="process"/> + <syscall name="fork" number="5056" groups="process"/> + <syscall name="execve" number="5057" groups="file,process"/> + <syscall name="exit" number="5058" groups="process"/> + <syscall name="wait4" number="5059" groups="process"/> + <syscall name="kill" number="5060" groups="signal"/> + <syscall name="uname" number="5061"/> + <syscall name="semget" number="5062" groups="ipc"/> + <syscall name="semop" number="5063" groups="ipc"/> + <syscall name="semctl" number="5064" groups="ipc"/> + <syscall name="shmdt" number="5065" groups="ipc,memory"/> + <syscall name="msgget" number="5066" groups="ipc"/> + <syscall name="msgsnd" number="5067" groups="ipc"/> + <syscall name="msgrcv" number="5068" groups="ipc"/> + <syscall name="msgctl" number="5069" groups="ipc"/> + <syscall name="fcntl" number="5070" groups="descriptor"/> + <syscall name="flock" number="5071" groups="descriptor"/> + <syscall name="fsync" number="5072" groups="descriptor"/> + <syscall name="fdatasync" number="5073" groups="descriptor"/> + <syscall name="truncate" number="5074" groups="file"/> + <syscall name="ftruncate" number="5075" groups="descriptor"/> + <syscall name="getdents" number="5076" groups="descriptor"/> + <syscall name="getcwd" number="5077" groups="file"/> + <syscall name="chdir" number="5078" groups="file"/> + <syscall name="fchdir" number="5079" groups="descriptor"/> + <syscall name="rename" number="5080" groups="file"/> + <syscall name="mkdir" number="5081" groups="file"/> + <syscall name="rmdir" number="5082" groups="file"/> + <syscall name="creat" number="5083" groups="descriptor,file"/> + <syscall name="link" number="5084" groups="file"/> + <syscall name="unlink" number="5085" groups="file"/> + <syscall name="symlink" number="5086" groups="file"/> + <syscall name="readlink" number="5087" groups="file"/> + <syscall name="chmod" number="5088" groups="file"/> + <syscall name="fchmod" number="5089" groups="descriptor"/> + <syscall name="chown" number="5090" groups="file"/> + <syscall name="fchown" number="5091" groups="descriptor"/> + <syscall name="lchown" number="5092" groups="file"/> + <syscall name="umask" number="5093"/> + <syscall name="gettimeofday" number="5094"/> + <syscall name="getrlimit" number="5095"/> + <syscall name="getrusage" number="5096"/> + <syscall name="sysinfo" number="5097"/> + <syscall name="times" number="5098"/> + <syscall name="ptrace" number="5099"/> + <syscall name="getuid" number="5100"/> + <syscall name="syslog" number="5101"/> + <syscall name="getgid" number="5102"/> + <syscall name="setuid" number="5103"/> + <syscall name="setgid" number="5104"/> + <syscall name="geteuid" number="5105"/> + <syscall name="getegid" number="5106"/> + <syscall name="setpgid" number="5107"/> + <syscall name="getppid" number="5108"/> + <syscall name="getpgrp" number="5109"/> + <syscall name="setsid" number="5110"/> + <syscall name="setreuid" number="5111"/> + <syscall name="setregid" number="5112"/> + <syscall name="getgroups" number="5113"/> + <syscall name="setgroups" number="5114"/> + <syscall name="setresuid" number="5115"/> + <syscall name="getresuid" number="5116"/> + <syscall name="setresgid" number="5117"/> + <syscall name="getresgid" number="5118"/> + <syscall name="getpgid" number="5119"/> + <syscall name="setfsuid" number="5120"/> + <syscall name="setfsgid" number="5121"/> + <syscall name="getsid" number="5122"/> + <syscall name="capget" number="5123"/> + <syscall name="capset" number="5124"/> + <syscall name="rt_sigpending" number="5125" groups="signal"/> + <syscall name="rt_sigtimedwait" number="5126" groups="signal"/> + <syscall name="rt_sigqueueinfo" number="5127" groups="signal"/> + <syscall name="rt_sigsuspend" number="5128" groups="signal"/> + <syscall name="sigaltstack" number="5129" groups="signal"/> + <syscall name="utime" number="5130" groups="file"/> + <syscall name="mknod" number="5131" groups="file"/> + <syscall name="personality" number="5132"/> + <syscall name="ustat" number="5133"/> + <syscall name="statfs" number="5134" groups="file"/> + <syscall name="fstatfs" number="5135" groups="descriptor"/> + <syscall name="sysfs" number="5136"/> + <syscall name="getpriority" number="5137"/> + <syscall name="setpriority" number="5138"/> + <syscall name="sched_setparam" number="5139"/> + <syscall name="sched_getparam" number="5140"/> + <syscall name="sched_setscheduler" number="5141"/> + <syscall name="sched_getscheduler" number="5142"/> + <syscall name="sched_get_priority_max" number="5143"/> + <syscall name="sched_get_priority_min" number="5144"/> + <syscall name="sched_rr_get_interval" number="5145"/> + <syscall name="mlock" number="5146" groups="memory"/> + <syscall name="munlock" number="5147" groups="memory"/> + <syscall name="mlockall" number="5148" groups="memory"/> + <syscall name="munlockall" number="5149" groups="memory"/> + <syscall name="vhangup" number="5150"/> + <syscall name="pivot_root" number="5151" groups="file"/> + <syscall name="_sysctl" number="5152"/> + <syscall name="prctl" number="5153"/> + <syscall name="adjtimex" number="5154"/> + <syscall name="setrlimit" number="5155"/> + <syscall name="chroot" number="5156" groups="file"/> + <syscall name="sync" number="5157"/> + <syscall name="acct" number="5158" groups="file"/> + <syscall name="settimeofday" number="5159"/> + <syscall name="mount" number="5160" groups="file"/> + <syscall name="umount2" number="5161" groups="file"/> + <syscall name="swapon" number="5162" groups="file"/> + <syscall name="swapoff" number="5163" groups="file"/> + <syscall name="reboot" number="5164"/> + <syscall name="sethostname" number="5165"/> + <syscall name="setdomainname" number="5166"/> + <syscall name="create_module" number="5167"/> + <syscall name="init_module" number="5168"/> + <syscall name="delete_module" number="5169"/> + <syscall name="get_kernel_syms" number="5170"/> + <syscall name="query_module" number="5171"/> + <syscall name="quotactl" number="5172" groups="file"/> + <syscall name="nfsservctl" number="5173"/> + <syscall name="getpmsg" number="5174"/> + <syscall name="putpmsg" number="5175"/> + <syscall name="afs_syscall" number="5176"/> + <syscall name="gettid" number="5178"/> + <syscall name="readahead" number="5179" groups="descriptor"/> + <syscall name="setxattr" number="5180" groups="file"/> + <syscall name="lsetxattr" number="5181" groups="file"/> + <syscall name="fsetxattr" number="5182" groups="descriptor"/> + <syscall name="getxattr" number="5183" groups="file"/> + <syscall name="lgetxattr" number="5184" groups="file"/> + <syscall name="fgetxattr" number="5185" groups="descriptor"/> + <syscall name="listxattr" number="5186" groups="file"/> + <syscall name="llistxattr" number="5187" groups="file"/> + <syscall name="flistxattr" number="5188" groups="descriptor"/> + <syscall name="removexattr" number="5189" groups="file"/> + <syscall name="lremovexattr" number="5190" groups="file"/> + <syscall name="fremovexattr" number="5191" groups="descriptor"/> + <syscall name="tkill" number="5192" groups="signal"/> + <syscall name="futex" number="5194"/> + <syscall name="sched_setaffinity" number="5195"/> + <syscall name="sched_getaffinity" number="5196"/> + <syscall name="cacheflush" number="5197"/> + <syscall name="cachectl" number="5198"/> + <syscall name="sysmips" number="5199"/> + <syscall name="io_setup" number="5200"/> + <syscall name="io_destroy" number="5201"/> + <syscall name="io_getevents" number="5202"/> + <syscall name="io_submit" number="5203"/> + <syscall name="io_cancel" number="5204"/> + <syscall name="exit_group" number="5205" groups="process"/> + <syscall name="lookup_dcookie" number="5206"/> + <syscall name="epoll_create" number="5207" groups="descriptor"/> + <syscall name="epoll_ctl" number="5208" groups="descriptor"/> + <syscall name="epoll_wait" number="5209" groups="descriptor"/> + <syscall name="remap_file_pages" number="5210" groups="memory"/> + <syscall name="rt_sigreturn" number="5211" groups="signal"/> + <syscall name="set_tid_address" number="5212"/> + <syscall name="restart_syscall" number="5213"/> + <syscall name="semtimedop" number="5214" groups="ipc"/> + <syscall name="fadvise64" number="5215" groups="descriptor"/> + <syscall name="timer_create" number="5216"/> + <syscall name="timer_settime" number="5217"/> + <syscall name="timer_gettime" number="5218"/> + <syscall name="timer_getoverrun" number="5219"/> + <syscall name="timer_delete" number="5220"/> + <syscall name="clock_settime" number="5221"/> + <syscall name="clock_gettime" number="5222"/> + <syscall name="clock_getres" number="5223"/> + <syscall name="clock_nanosleep" number="5224"/> + <syscall name="tgkill" number="5225" groups="signal"/> + <syscall name="utimes" number="5226" groups="file"/> + <syscall name="mbind" number="5227" groups="memory"/> + <syscall name="get_mempolicy" number="5228" groups="memory"/> + <syscall name="set_mempolicy" number="5229" groups="memory"/> + <syscall name="mq_open" number="5230"/> + <syscall name="mq_unlink" number="5231"/> + <syscall name="mq_timedsend" number="5232"/> + <syscall name="mq_timedreceive" number="5233"/> + <syscall name="mq_notify" number="5234"/> + <syscall name="mq_getsetattr" number="5235"/> + <syscall name="vserver" number="5236"/> + <syscall name="waitid" number="5237" groups="process"/> + <syscall name="add_key" number="5239"/> + <syscall name="request_key" number="5240"/> + <syscall name="keyctl" number="5241"/> + <syscall name="set_thread_area" number="5242"/> + <syscall name="inotify_init" number="5243" groups="descriptor"/> + <syscall name="inotify_add_watch" number="5244" groups="descriptor"/> + <syscall name="inotify_rm_watch" number="5245" groups="descriptor"/> + <syscall name="migrate_pages" number="5246" groups="memory"/> + <syscall name="openat" number="5247" groups="descriptor,file"/> + <syscall name="mkdirat" number="5248" groups="descriptor,file"/> + <syscall name="mknodat" number="5249" groups="descriptor,file"/> + <syscall name="fchownat" number="5250" groups="descriptor,file"/> + <syscall name="futimesat" number="5251" groups="descriptor,file"/> + <syscall name="newfstatat" number="5252" groups="descriptor,file"/> + <syscall name="unlinkat" number="5253" groups="descriptor,file"/> + <syscall name="renameat" number="5254" groups="descriptor,file"/> + <syscall name="linkat" number="5255" groups="descriptor,file"/> + <syscall name="symlinkat" number="5256" groups="descriptor,file"/> + <syscall name="readlinkat" number="5257" groups="descriptor,file"/> + <syscall name="fchmodat" number="5258" groups="descriptor,file"/> + <syscall name="faccessat" number="5259" groups="descriptor,file"/> + <syscall name="pselect6" number="5260" groups="descriptor"/> + <syscall name="ppoll" number="5261" groups="descriptor"/> + <syscall name="unshare" number="5262" groups="process"/> + <syscall name="splice" number="5263" groups="descriptor"/> + <syscall name="sync_file_range" number="5264" groups="descriptor"/> + <syscall name="tee" number="5265" groups="descriptor"/> + <syscall name="vmsplice" number="5266" groups="descriptor"/> + <syscall name="move_pages" number="5267" groups="memory"/> + <syscall name="set_robust_list" number="5268"/> + <syscall name="get_robust_list" number="5269"/> + <syscall name="kexec_load" number="5270"/> + <syscall name="getcpu" number="5271"/> + <syscall name="epoll_pwait" number="5272" groups="descriptor"/> + <syscall name="ioprio_set" number="5273"/> + <syscall name="ioprio_get" number="5274"/> + <syscall name="utimensat" number="5275" groups="descriptor,file"/> + <syscall name="signalfd" number="5276" groups="descriptor,signal"/> + <syscall name="timerfd" number="5277" groups="descriptor"/> + <syscall name="eventfd" number="5278" groups="descriptor"/> + <syscall name="fallocate" number="5279" groups="descriptor"/> + <syscall name="timerfd_create" number="5280" groups="descriptor"/> + <syscall name="timerfd_gettime" number="5281" groups="descriptor"/> + <syscall name="timerfd_settime" number="5282" groups="descriptor"/> + <syscall name="signalfd4" number="5283" groups="descriptor,signal"/> + <syscall name="eventfd2" number="5284" groups="descriptor"/> + <syscall name="epoll_create1" number="5285" groups="descriptor"/> + <syscall name="dup3" number="5286" groups="descriptor"/> + <syscall name="pipe2" number="5287" groups="descriptor"/> + <syscall name="inotify_init1" number="5288" groups="descriptor"/> + <syscall name="preadv" number="5289" groups="descriptor"/> + <syscall name="pwritev" number="5290" groups="descriptor"/> + <syscall name="rt_tgsigqueueinfo" number="5291" groups="process,signal"/> + <syscall name="perf_event_open" number="5292" groups="descriptor"/> + <syscall name="accept4" number="5293" groups="network"/> + <syscall name="recvmmsg" number="5294" groups="network"/> + <syscall name="fanotify_init" number="5295" groups="descriptor"/> + <syscall name="fanotify_mark" number="5296" groups="descriptor,file"/> + <syscall name="prlimit64" number="5297"/> +</syscalls_info> diff --git a/tools/msys/mingw64/share/gdb/syscalls/mips-o32-linux.xml b/tools/msys/mingw64/share/gdb/syscalls/mips-o32-linux.xml new file mode 100644 index 0000000000000000000000000000000000000000..5cc086a9a28be09edbe75d56015ffb9a0f15efbb --- /dev/null +++ b/tools/msys/mingw64/share/gdb/syscalls/mips-o32-linux.xml @@ -0,0 +1,344 @@ +<?xml version="1.0"?> +<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd"> +<!-- Copyright (C) 2011-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> +<!-- This file was generated using the following file: + + /usr/src/linux/arch/mips/include/asm/unistd.h + + The file mentioned above belongs to the Linux Kernel. --> +<syscalls_info> + <syscall name="syscall" number="4000"/> + <syscall name="exit" number="4001" groups="process"/> + <syscall name="fork" number="4002" groups="process"/> + <syscall name="read" number="4003" groups="descriptor"/> + <syscall name="write" number="4004" groups="descriptor"/> + <syscall name="open" number="4005" groups="descriptor,file"/> + <syscall name="close" number="4006" groups="descriptor"/> + <syscall name="waitpid" number="4007" groups="process"/> + <syscall name="creat" number="4008" groups="descriptor,file"/> + <syscall name="link" number="4009" groups="file"/> + <syscall name="unlink" number="4010" groups="file"/> + <syscall name="execve" number="4011" groups="file,process"/> + <syscall name="chdir" number="4012" groups="file"/> + <syscall name="time" number="4013"/> + <syscall name="mknod" number="4014" groups="file"/> + <syscall name="chmod" number="4015" groups="file"/> + <syscall name="lchown" number="4016" groups="file"/> + <syscall name="break" number="4017" groups="memory"/> + <syscall name="lseek" number="4019" groups="descriptor"/> + <syscall name="getpid" number="4020"/> + <syscall name="mount" number="4021" groups="file"/> + <syscall name="umount" number="4022" groups="file"/> + <syscall name="setuid" number="4023"/> + <syscall name="getuid" number="4024"/> + <syscall name="stime" number="4025"/> + <syscall name="ptrace" number="4026"/> + <syscall name="alarm" number="4027"/> + <syscall name="pause" number="4029" groups="signal"/> + <syscall name="utime" number="4030" groups="file"/> + <syscall name="stty" number="4031"/> + <syscall name="gtty" number="4032"/> + <syscall name="access" number="4033" groups="file"/> + <syscall name="nice" number="4034"/> + <syscall name="ftime" number="4035"/> + <syscall name="sync" number="4036"/> + <syscall name="kill" number="4037" groups="signal"/> + <syscall name="rename" number="4038" groups="file"/> + <syscall name="mkdir" number="4039" groups="file"/> + <syscall name="rmdir" number="4040" groups="file"/> + <syscall name="dup" number="4041" groups="descriptor"/> + <syscall name="pipe" number="4042" groups="descriptor"/> + <syscall name="times" number="4043"/> + <syscall name="prof" number="4044"/> + <syscall name="brk" number="4045" groups="memory"/> + <syscall name="setgid" number="4046"/> + <syscall name="getgid" number="4047"/> + <syscall name="signal" number="4048" groups="signal"/> + <syscall name="geteuid" number="4049"/> + <syscall name="getegid" number="4050"/> + <syscall name="acct" number="4051" groups="file"/> + <syscall name="umount2" number="4052" groups="file"/> + <syscall name="lock" number="4053"/> + <syscall name="ioctl" number="4054" groups="descriptor"/> + <syscall name="fcntl" number="4055" groups="descriptor"/> + <syscall name="mpx" number="4056"/> + <syscall name="setpgid" number="4057"/> + <syscall name="ulimit" number="4058"/> + <syscall name="umask" number="4060"/> + <syscall name="chroot" number="4061" groups="file"/> + <syscall name="ustat" number="4062"/> + <syscall name="dup2" number="4063" groups="descriptor"/> + <syscall name="getppid" number="4064"/> + <syscall name="getpgrp" number="4065"/> + <syscall name="setsid" number="4066"/> + <syscall name="sigaction" number="4067" groups="signal"/> + <syscall name="sgetmask" number="4068" groups="signal"/> + <syscall name="ssetmask" number="4069" groups="signal"/> + <syscall name="setreuid" number="4070"/> + <syscall name="setregid" number="4071"/> + <syscall name="sigsuspend" number="4072" groups="signal"/> + <syscall name="sigpending" number="4073" groups="signal"/> + <syscall name="sethostname" number="4074"/> + <syscall name="setrlimit" number="4075"/> + <syscall name="getrlimit" number="4076"/> + <syscall name="getrusage" number="4077"/> + <syscall name="gettimeofday" number="4078"/> + <syscall name="settimeofday" number="4079"/> + <syscall name="getgroups" number="4080"/> + <syscall name="setgroups" number="4081"/> + <syscall name="symlink" number="4083" groups="file"/> + <syscall name="readlink" number="4085" groups="file"/> + <syscall name="uselib" number="4086" groups="file"/> + <syscall name="swapon" number="4087" groups="file"/> + <syscall name="reboot" number="4088"/> + <syscall name="readdir" number="4089" groups="descriptor"/> + <syscall name="mmap" number="4090" groups="descriptor,memory"/> + <syscall name="munmap" number="4091" groups="memory"/> + <syscall name="truncate" number="4092" groups="file"/> + <syscall name="ftruncate" number="4093" groups="descriptor"/> + <syscall name="fchmod" number="4094" groups="descriptor"/> + <syscall name="fchown" number="4095" groups="descriptor"/> + <syscall name="getpriority" number="4096"/> + <syscall name="setpriority" number="4097"/> + <syscall name="profil" number="4098"/> + <syscall name="statfs" number="4099" groups="file"/> + <syscall name="fstatfs" number="4100" groups="descriptor"/> + <syscall name="ioperm" number="4101"/> + <syscall name="socketcall" number="4102" groups="descriptor"/> + <syscall name="syslog" number="4103"/> + <syscall name="setitimer" number="4104"/> + <syscall name="getitimer" number="4105"/> + <syscall name="stat" number="4106" groups="file"/> + <syscall name="lstat" number="4107" groups="file"/> + <syscall name="fstat" number="4108" groups="descriptor"/> + <syscall name="iopl" number="4110"/> + <syscall name="vhangup" number="4111"/> + <syscall name="idle" number="4112"/> + <syscall name="vm86" number="4113"/> + <syscall name="wait4" number="4114" groups="process"/> + <syscall name="swapoff" number="4115" groups="file"/> + <syscall name="sysinfo" number="4116"/> + <syscall name="ipc" number="4117" groups="ipc"/> + <syscall name="fsync" number="4118" groups="descriptor"/> + <syscall name="sigreturn" number="4119" groups="signal"/> + <syscall name="clone" number="4120" groups="process"/> + <syscall name="setdomainname" number="4121"/> + <syscall name="uname" number="4122"/> + <syscall name="modify_ldt" number="4123"/> + <syscall name="adjtimex" number="4124"/> + <syscall name="mprotect" number="4125" groups="memory"/> + <syscall name="sigprocmask" number="4126" groups="signal"/> + <syscall name="create_module" number="4127"/> + <syscall name="init_module" number="4128"/> + <syscall name="delete_module" number="4129"/> + <syscall name="get_kernel_syms" number="4130"/> + <syscall name="quotactl" number="4131" groups="file"/> + <syscall name="getpgid" number="4132"/> + <syscall name="fchdir" number="4133" groups="descriptor"/> + <syscall name="bdflush" number="4134"/> + <syscall name="sysfs" number="4135"/> + <syscall name="personality" number="4136"/> + <syscall name="afs_syscall" number="4137"/> + <syscall name="setfsuid" number="4138"/> + <syscall name="setfsgid" number="4139"/> + <syscall name="_llseek" number="4140" groups="descriptor"/> + <syscall name="getdents" number="4141" groups="descriptor"/> + <syscall name="_newselect" number="4142" groups="descriptor"/> + <syscall name="flock" number="4143" groups="descriptor"/> + <syscall name="msync" number="4144" groups="memory"/> + <syscall name="readv" number="4145" groups="descriptor"/> + <syscall name="writev" number="4146" groups="descriptor"/> + <syscall name="cacheflush" number="4147"/> + <syscall name="cachectl" number="4148"/> + <syscall name="sysmips" number="4149"/> + <syscall name="getsid" number="4151"/> + <syscall name="fdatasync" number="4152" groups="descriptor"/> + <syscall name="_sysctl" number="4153"/> + <syscall name="mlock" number="4154" groups="memory"/> + <syscall name="munlock" number="4155" groups="memory"/> + <syscall name="mlockall" number="4156" groups="memory"/> + <syscall name="munlockall" number="4157" groups="memory"/> + <syscall name="sched_setparam" number="4158"/> + <syscall name="sched_getparam" number="4159"/> + <syscall name="sched_setscheduler" number="4160"/> + <syscall name="sched_getscheduler" number="4161"/> + <syscall name="sched_yield" number="4162"/> + <syscall name="sched_get_priority_max" number="4163"/> + <syscall name="sched_get_priority_min" number="4164"/> + <syscall name="sched_rr_get_interval" number="4165"/> + <syscall name="nanosleep" number="4166"/> + <syscall name="mremap" number="4167" groups="memory"/> + <syscall name="accept" number="4168" groups="network"/> + <syscall name="bind" number="4169" groups="network"/> + <syscall name="connect" number="4170" groups="network"/> + <syscall name="getpeername" number="4171" groups="network"/> + <syscall name="getsockname" number="4172" groups="network"/> + <syscall name="getsockopt" number="4173" groups="network"/> + <syscall name="listen" number="4174" groups="network"/> + <syscall name="recv" number="4175" groups="network"/> + <syscall name="recvfrom" number="4176" groups="network"/> + <syscall name="recvmsg" number="4177" groups="network"/> + <syscall name="send" number="4178" groups="network"/> + <syscall name="sendmsg" number="4179" groups="network"/> + <syscall name="sendto" number="4180" groups="network"/> + <syscall name="setsockopt" number="4181" groups="network"/> + <syscall name="shutdown" number="4182" groups="network"/> + <syscall name="socket" number="4183" groups="network"/> + <syscall name="socketpair" number="4184" groups="network"/> + <syscall name="setresuid" number="4185"/> + <syscall name="getresuid" number="4186"/> + <syscall name="query_module" number="4187"/> + <syscall name="poll" number="4188" groups="descriptor"/> + <syscall name="nfsservctl" number="4189"/> + <syscall name="setresgid" number="4190"/> + <syscall name="getresgid" number="4191"/> + <syscall name="prctl" number="4192"/> + <syscall name="rt_sigreturn" number="4193" groups="signal"/> + <syscall name="rt_sigaction" number="4194" groups="signal"/> + <syscall name="rt_sigprocmask" number="4195" groups="signal"/> + <syscall name="rt_sigpending" number="4196" groups="signal"/> + <syscall name="rt_sigtimedwait" number="4197" groups="signal"/> + <syscall name="rt_sigqueueinfo" number="4198" groups="signal"/> + <syscall name="rt_sigsuspend" number="4199" groups="signal"/> + <syscall name="pread64" number="4200" groups="descriptor"/> + <syscall name="pwrite64" number="4201" groups="descriptor"/> + <syscall name="chown" number="4202" groups="file"/> + <syscall name="getcwd" number="4203" groups="file"/> + <syscall name="capget" number="4204"/> + <syscall name="capset" number="4205"/> + <syscall name="sigaltstack" number="4206" groups="signal"/> + <syscall name="sendfile" number="4207" groups="descriptor,network"/> + <syscall name="getpmsg" number="4208"/> + <syscall name="putpmsg" number="4209"/> + <syscall name="mmap2" number="4210" groups="descriptor,memory"/> + <syscall name="truncate64" number="4211" groups="file"/> + <syscall name="ftruncate64" number="4212" groups="descriptor"/> + <syscall name="stat64" number="4213" groups="file"/> + <syscall name="lstat64" number="4214" groups="file"/> + <syscall name="fstat64" number="4215" groups="descriptor"/> + <syscall name="pivot_root" number="4216" groups="file"/> + <syscall name="mincore" number="4217" groups="memory"/> + <syscall name="madvise" number="4218" groups="memory"/> + <syscall name="getdents64" number="4219" groups="descriptor"/> + <syscall name="fcntl64" number="4220" groups="descriptor"/> + <syscall name="gettid" number="4222"/> + <syscall name="readahead" number="4223" groups="descriptor"/> + <syscall name="setxattr" number="4224" groups="file"/> + <syscall name="lsetxattr" number="4225" groups="file"/> + <syscall name="fsetxattr" number="4226" groups="descriptor"/> + <syscall name="getxattr" number="4227" groups="file"/> + <syscall name="lgetxattr" number="4228" groups="file"/> + <syscall name="fgetxattr" number="4229" groups="descriptor"/> + <syscall name="listxattr" number="4230" groups="file"/> + <syscall name="llistxattr" number="4231" groups="file"/> + <syscall name="flistxattr" number="4232" groups="descriptor"/> + <syscall name="removexattr" number="4233" groups="file"/> + <syscall name="lremovexattr" number="4234" groups="file"/> + <syscall name="fremovexattr" number="4235" groups="descriptor"/> + <syscall name="tkill" number="4236" groups="signal"/> + <syscall name="sendfile64" number="4237" groups="descriptor,network"/> + <syscall name="futex" number="4238"/> + <syscall name="sched_setaffinity" number="4239"/> + <syscall name="sched_getaffinity" number="4240"/> + <syscall name="io_setup" number="4241"/> + <syscall name="io_destroy" number="4242"/> + <syscall name="io_getevents" number="4243"/> + <syscall name="io_submit" number="4244"/> + <syscall name="io_cancel" number="4245"/> + <syscall name="exit_group" number="4246" groups="process"/> + <syscall name="lookup_dcookie" number="4247"/> + <syscall name="epoll_create" number="4248" groups="descriptor"/> + <syscall name="epoll_ctl" number="4249" groups="descriptor"/> + <syscall name="epoll_wait" number="4250" groups="descriptor"/> + <syscall name="remap_file_pages" number="4251" groups="memory"/> + <syscall name="set_tid_address" number="4252"/> + <syscall name="restart_syscall" number="4253"/> + <syscall name="fadvise64" number="4254" groups="descriptor"/> + <syscall name="statfs64" number="4255" groups="file"/> + <syscall name="fstatfs64" number="4256" groups="descriptor"/> + <syscall name="timer_create" number="4257"/> + <syscall name="timer_settime" number="4258"/> + <syscall name="timer_gettime" number="4259"/> + <syscall name="timer_getoverrun" number="4260"/> + <syscall name="timer_delete" number="4261"/> + <syscall name="clock_settime" number="4262"/> + <syscall name="clock_gettime" number="4263"/> + <syscall name="clock_getres" number="4264"/> + <syscall name="clock_nanosleep" number="4265"/> + <syscall name="tgkill" number="4266" groups="signal"/> + <syscall name="utimes" number="4267" groups="file"/> + <syscall name="mbind" number="4268" groups="memory"/> + <syscall name="get_mempolicy" number="4269" groups="memory"/> + <syscall name="set_mempolicy" number="4270" groups="memory"/> + <syscall name="mq_open" number="4271"/> + <syscall name="mq_unlink" number="4272"/> + <syscall name="mq_timedsend" number="4273"/> + <syscall name="mq_timedreceive" number="4274"/> + <syscall name="mq_notify" number="4275"/> + <syscall name="mq_getsetattr" number="4276"/> + <syscall name="vserver" number="4277"/> + <syscall name="waitid" number="4278" groups="process"/> + <syscall name="add_key" number="4280"/> + <syscall name="request_key" number="4281"/> + <syscall name="keyctl" number="4282"/> + <syscall name="set_thread_area" number="4283"/> + <syscall name="inotify_init" number="4284" groups="descriptor"/> + <syscall name="inotify_add_watch" number="4285" groups="descriptor"/> + <syscall name="inotify_rm_watch" number="4286" groups="descriptor"/> + <syscall name="migrate_pages" number="4287" groups="memory"/> + <syscall name="openat" number="4288" groups="descriptor,file"/> + <syscall name="mkdirat" number="4289" groups="descriptor,file"/> + <syscall name="mknodat" number="4290" groups="descriptor,file"/> + <syscall name="fchownat" number="4291" groups="descriptor,file"/> + <syscall name="futimesat" number="4292" groups="descriptor,file"/> + <syscall name="fstatat64" number="4293" groups="descriptor,file"/> + <syscall name="unlinkat" number="4294" groups="descriptor,file"/> + <syscall name="renameat" number="4295" groups="descriptor,file"/> + <syscall name="linkat" number="4296" groups="descriptor,file"/> + <syscall name="symlinkat" number="4297" groups="descriptor,file"/> + <syscall name="readlinkat" number="4298" groups="descriptor,file"/> + <syscall name="fchmodat" number="4299" groups="descriptor,file"/> + <syscall name="faccessat" number="4300" groups="descriptor,file"/> + <syscall name="pselect6" number="4301" groups="descriptor"/> + <syscall name="ppoll" number="4302" groups="descriptor"/> + <syscall name="unshare" number="4303" groups="process"/> + <syscall name="splice" number="4304" groups="descriptor"/> + <syscall name="sync_file_range" number="4305" groups="descriptor"/> + <syscall name="tee" number="4306" groups="descriptor"/> + <syscall name="vmsplice" number="4307" groups="descriptor"/> + <syscall name="move_pages" number="4308" groups="memory"/> + <syscall name="set_robust_list" number="4309"/> + <syscall name="get_robust_list" number="4310"/> + <syscall name="kexec_load" number="4311"/> + <syscall name="getcpu" number="4312"/> + <syscall name="epoll_pwait" number="4313" groups="descriptor"/> + <syscall name="ioprio_set" number="4314"/> + <syscall name="ioprio_get" number="4315"/> + <syscall name="utimensat" number="4316" groups="descriptor,file"/> + <syscall name="signalfd" number="4317" groups="descriptor,signal"/> + <syscall name="timerfd" number="4318" groups="descriptor"/> + <syscall name="eventfd" number="4319" groups="descriptor"/> + <syscall name="fallocate" number="4320" groups="descriptor"/> + <syscall name="timerfd_create" number="4321" groups="descriptor"/> + <syscall name="timerfd_gettime" number="4322" groups="descriptor"/> + <syscall name="timerfd_settime" number="4323" groups="descriptor"/> + <syscall name="signalfd4" number="4324" groups="descriptor,signal"/> + <syscall name="eventfd2" number="4325" groups="descriptor"/> + <syscall name="epoll_create1" number="4326" groups="descriptor"/> + <syscall name="dup3" number="4327" groups="descriptor"/> + <syscall name="pipe2" number="4328" groups="descriptor"/> + <syscall name="inotify_init1" number="4329" groups="descriptor"/> + <syscall name="preadv" number="4330" groups="descriptor"/> + <syscall name="pwritev" number="4331" groups="descriptor"/> + <syscall name="rt_tgsigqueueinfo" number="4332" groups="process,signal"/> + <syscall name="perf_event_open" number="4333" groups="descriptor"/> + <syscall name="accept4" number="4334" groups="network"/> + <syscall name="recvmmsg" number="4335" groups="network"/> + <syscall name="fanotify_init" number="4336" groups="descriptor"/> + <syscall name="fanotify_mark" number="4337" groups="descriptor,file"/> + <syscall name="prlimit64" number="4338"/> +</syscalls_info> diff --git a/tools/msys/mingw64/share/gdb/syscalls/ppc-linux.xml b/tools/msys/mingw64/share/gdb/syscalls/ppc-linux.xml new file mode 100644 index 0000000000000000000000000000000000000000..a733d37237f9d26dddd27740690e15bbe6e3b405 --- /dev/null +++ b/tools/msys/mingw64/share/gdb/syscalls/ppc-linux.xml @@ -0,0 +1,307 @@ +<?xml version="1.0"?> +<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd"> +<!-- Copyright (C) 2009-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> +<!-- This file was generated using the following file: + + /usr/src/linux/arch/powerpc/include/asm/unistd.h + + The file mentioned above belongs to the Linux Kernel. --> +<syscalls_info> + <syscall name="restart_syscall" number="0"/> + <syscall name="exit" number="1" groups="process"/> + <syscall name="fork" number="2" groups="process"/> + <syscall name="read" number="3" groups="descriptor"/> + <syscall name="write" number="4" groups="descriptor"/> + <syscall name="open" number="5" groups="descriptor,file"/> + <syscall name="close" number="6" groups="descriptor"/> + <syscall name="waitpid" number="7" groups="process"/> + <syscall name="creat" number="8" groups="descriptor,file"/> + <syscall name="link" number="9" groups="file"/> + <syscall name="unlink" number="10" groups="file"/> + <syscall name="execve" number="11" groups="file,process"/> + <syscall name="chdir" number="12" groups="file"/> + <syscall name="time" number="13"/> + <syscall name="mknod" number="14" groups="file"/> + <syscall name="chmod" number="15" groups="file"/> + <syscall name="lchown" number="16" groups="file"/> + <syscall name="break" number="17" groups="memory"/> + <syscall name="oldstat" number="18" groups="file"/> + <syscall name="lseek" number="19" groups="descriptor"/> + <syscall name="getpid" number="20"/> + <syscall name="mount" number="21" groups="file"/> + <syscall name="umount" number="22" groups="file"/> + <syscall name="setuid" number="23"/> + <syscall name="getuid" number="24"/> + <syscall name="stime" number="25"/> + <syscall name="ptrace" number="26"/> + <syscall name="alarm" number="27"/> + <syscall name="oldfstat" number="28" groups="descriptor"/> + <syscall name="pause" number="29" groups="signal"/> + <syscall name="utime" number="30" groups="file"/> + <syscall name="stty" number="31"/> + <syscall name="gtty" number="32"/> + <syscall name="access" number="33" groups="file"/> + <syscall name="nice" number="34"/> + <syscall name="ftime" number="35"/> + <syscall name="sync" number="36"/> + <syscall name="kill" number="37" groups="signal"/> + <syscall name="rename" number="38" groups="file"/> + <syscall name="mkdir" number="39" groups="file"/> + <syscall name="rmdir" number="40" groups="file"/> + <syscall name="dup" number="41" groups="descriptor"/> + <syscall name="pipe" number="42" groups="descriptor"/> + <syscall name="times" number="43"/> + <syscall name="prof" number="44"/> + <syscall name="brk" number="45" groups="memory"/> + <syscall name="setgid" number="46"/> + <syscall name="getgid" number="47"/> + <syscall name="signal" number="48" groups="signal"/> + <syscall name="geteuid" number="49"/> + <syscall name="getegid" number="50"/> + <syscall name="acct" number="51" groups="file"/> + <syscall name="umount2" number="52" groups="file"/> + <syscall name="lock" number="53"/> + <syscall name="ioctl" number="54" groups="descriptor"/> + <syscall name="fcntl" number="55" groups="descriptor"/> + <syscall name="mpx" number="56"/> + <syscall name="setpgid" number="57"/> + <syscall name="ulimit" number="58"/> + <syscall name="oldolduname" number="59"/> + <syscall name="umask" number="60"/> + <syscall name="chroot" number="61" groups="file"/> + <syscall name="ustat" number="62"/> + <syscall name="dup2" number="63" groups="descriptor"/> + <syscall name="getppid" number="64"/> + <syscall name="getpgrp" number="65"/> + <syscall name="setsid" number="66"/> + <syscall name="sigaction" number="67" groups="signal"/> + <syscall name="sgetmask" number="68" groups="signal"/> + <syscall name="ssetmask" number="69" groups="signal"/> + <syscall name="setreuid" number="70"/> + <syscall name="setregid" number="71"/> + <syscall name="sigsuspend" number="72" groups="signal"/> + <syscall name="sigpending" number="73" groups="signal"/> + <syscall name="sethostname" number="74"/> + <syscall name="setrlimit" number="75"/> + <syscall name="getrlimit" number="76"/> + <syscall name="getrusage" number="77"/> + <syscall name="gettimeofday" number="78"/> + <syscall name="settimeofday" number="79"/> + <syscall name="getgroups" number="80"/> + <syscall name="setgroups" number="81"/> + <syscall name="select" number="82" groups="descriptor"/> + <syscall name="symlink" number="83" groups="file"/> + <syscall name="oldlstat" number="84" groups="file"/> + <syscall name="readlink" number="85" groups="file"/> + <syscall name="uselib" number="86" groups="file"/> + <syscall name="swapon" number="87" groups="file"/> + <syscall name="reboot" number="88"/> + <syscall name="readdir" number="89" groups="descriptor"/> + <syscall name="mmap" number="90" groups="descriptor,memory"/> + <syscall name="munmap" number="91" groups="memory"/> + <syscall name="truncate" number="92" groups="file"/> + <syscall name="ftruncate" number="93" groups="descriptor"/> + <syscall name="fchmod" number="94" groups="descriptor"/> + <syscall name="fchown" number="95" groups="descriptor"/> + <syscall name="getpriority" number="96"/> + <syscall name="setpriority" number="97"/> + <syscall name="profil" number="98"/> + <syscall name="statfs" number="99" groups="file"/> + <syscall name="fstatfs" number="100" groups="descriptor"/> + <syscall name="ioperm" number="101"/> + <syscall name="socketcall" number="102" groups="descriptor"/> + <syscall name="syslog" number="103"/> + <syscall name="setitimer" number="104"/> + <syscall name="getitimer" number="105"/> + <syscall name="stat" number="106" groups="file"/> + <syscall name="lstat" number="107" groups="file"/> + <syscall name="fstat" number="108" groups="descriptor"/> + <syscall name="olduname" number="109"/> + <syscall name="iopl" number="110"/> + <syscall name="vhangup" number="111"/> + <syscall name="idle" number="112"/> + <syscall name="vm86" number="113"/> + <syscall name="wait4" number="114" groups="process"/> + <syscall name="swapoff" number="115" groups="file"/> + <syscall name="sysinfo" number="116"/> + <syscall name="ipc" number="117" groups="ipc"/> + <syscall name="fsync" number="118" groups="descriptor"/> + <syscall name="sigreturn" number="119" groups="signal"/> + <syscall name="clone" number="120" groups="process"/> + <syscall name="setdomainname" number="121"/> + <syscall name="uname" number="122"/> + <syscall name="modify_ldt" number="123"/> + <syscall name="adjtimex" number="124"/> + <syscall name="mprotect" number="125" groups="memory"/> + <syscall name="sigprocmask" number="126" groups="signal"/> + <syscall name="create_module" number="127"/> + <syscall name="init_module" number="128"/> + <syscall name="delete_module" number="129"/> + <syscall name="get_kernel_syms" number="130"/> + <syscall name="quotactl" number="131" groups="file"/> + <syscall name="getpgid" number="132"/> + <syscall name="fchdir" number="133" groups="descriptor"/> + <syscall name="bdflush" number="134"/> + <syscall name="sysfs" number="135"/> + <syscall name="personality" number="136"/> + <syscall name="afs_syscall" number="137"/> + <syscall name="setfsuid" number="138"/> + <syscall name="setfsgid" number="139"/> + <syscall name="_llseek" number="140" groups="descriptor"/> + <syscall name="getdents" number="141" groups="descriptor"/> + <syscall name="_newselect" number="142" groups="descriptor"/> + <syscall name="flock" number="143" groups="descriptor"/> + <syscall name="msync" number="144" groups="memory"/> + <syscall name="readv" number="145" groups="descriptor"/> + <syscall name="writev" number="146" groups="descriptor"/> + <syscall name="getsid" number="147"/> + <syscall name="fdatasync" number="148" groups="descriptor"/> + <syscall name="_sysctl" number="149"/> + <syscall name="mlock" number="150" groups="memory"/> + <syscall name="munlock" number="151" groups="memory"/> + <syscall name="mlockall" number="152" groups="memory"/> + <syscall name="munlockall" number="153" groups="memory"/> + <syscall name="sched_setparam" number="154"/> + <syscall name="sched_getparam" number="155"/> + <syscall name="sched_setscheduler" number="156"/> + <syscall name="sched_getscheduler" number="157"/> + <syscall name="sched_yield" number="158"/> + <syscall name="sched_get_priority_max" number="159"/> + <syscall name="sched_get_priority_min" number="160"/> + <syscall name="sched_rr_get_interval" number="161"/> + <syscall name="nanosleep" number="162"/> + <syscall name="mremap" number="163" groups="memory"/> + <syscall name="setresuid" number="164"/> + <syscall name="getresuid" number="165"/> + <syscall name="query_module" number="166"/> + <syscall name="poll" number="167" groups="descriptor"/> + <syscall name="nfsservctl" number="168"/> + <syscall name="setresgid" number="169"/> + <syscall name="getresgid" number="170"/> + <syscall name="prctl" number="171"/> + <syscall name="rt_sigreturn" number="172" groups="signal"/> + <syscall name="rt_sigaction" number="173" groups="signal"/> + <syscall name="rt_sigprocmask" number="174" groups="signal"/> + <syscall name="rt_sigpending" number="175" groups="signal"/> + <syscall name="rt_sigtimedwait" number="176" groups="signal"/> + <syscall name="rt_sigqueueinfo" number="177" groups="signal"/> + <syscall name="rt_sigsuspend" number="178" groups="signal"/> + <syscall name="pread64" number="179" groups="descriptor"/> + <syscall name="pwrite64" number="180" groups="descriptor"/> + <syscall name="chown" number="181" groups="file"/> + <syscall name="getcwd" number="182" groups="file"/> + <syscall name="capget" number="183"/> + <syscall name="capset" number="184"/> + <syscall name="sigaltstack" number="185" groups="signal"/> + <syscall name="sendfile" number="186" groups="descriptor,network"/> + <syscall name="getpmsg" number="187"/> + <syscall name="putpmsg" number="188"/> + <syscall name="vfork" number="189" groups="process"/> + <syscall name="ugetrlimit" number="190"/> + <syscall name="readahead" number="191" groups="descriptor"/> + <syscall name="mmap2" number="192" groups="descriptor,memory"/> + <syscall name="truncate64" number="193" groups="file"/> + <syscall name="ftruncate64" number="194" groups="descriptor"/> + <syscall name="stat64" number="195" groups="file"/> + <syscall name="lstat64" number="196" groups="file"/> + <syscall name="fstat64" number="197" groups="descriptor"/> + <syscall name="pciconfig_read" number="198"/> + <syscall name="pciconfig_write" number="199"/> + <syscall name="pciconfig_iobase" number="200"/> + <syscall name="multiplexer" number="201"/> + <syscall name="getdents64" number="202" groups="descriptor"/> + <syscall name="pivot_root" number="203" groups="file"/> + <syscall name="fcntl64" number="204" groups="descriptor"/> + <syscall name="madvise" number="205" groups="memory"/> + <syscall name="mincore" number="206" groups="memory"/> + <syscall name="gettid" number="207"/> + <syscall name="tkill" number="208" groups="signal"/> + <syscall name="setxattr" number="209" groups="file"/> + <syscall name="lsetxattr" number="210" groups="file"/> + <syscall name="fsetxattr" number="211" groups="descriptor"/> + <syscall name="getxattr" number="212" groups="file"/> + <syscall name="lgetxattr" number="213" groups="file"/> + <syscall name="fgetxattr" number="214" groups="descriptor"/> + <syscall name="listxattr" number="215" groups="file"/> + <syscall name="llistxattr" number="216" groups="file"/> + <syscall name="flistxattr" number="217" groups="descriptor"/> + <syscall name="removexattr" number="218" groups="file"/> + <syscall name="lremovexattr" number="219" groups="file"/> + <syscall name="fremovexattr" number="220" groups="descriptor"/> + <syscall name="futex" number="221"/> + <syscall name="sched_setaffinity" number="222"/> + <syscall name="sched_getaffinity" number="223"/> + <syscall name="tuxcall" number="225"/> + <syscall name="sendfile64" number="226" groups="descriptor,network"/> + <syscall name="io_setup" number="227"/> + <syscall name="io_destroy" number="228"/> + <syscall name="io_getevents" number="229"/> + <syscall name="io_submit" number="230"/> + <syscall name="io_cancel" number="231"/> + <syscall name="set_tid_address" number="232"/> + <syscall name="fadvise64" number="233" groups="descriptor"/> + <syscall name="exit_group" number="234" groups="process"/> + <syscall name="lookup_dcookie" number="235"/> + <syscall name="epoll_create" number="236" groups="descriptor"/> + <syscall name="epoll_ctl" number="237" groups="descriptor"/> + <syscall name="epoll_wait" number="238" groups="descriptor"/> + <syscall name="remap_file_pages" number="239" groups="memory"/> + <syscall name="timer_create" number="240"/> + <syscall name="timer_settime" number="241"/> + <syscall name="timer_gettime" number="242"/> + <syscall name="timer_getoverrun" number="243"/> + <syscall name="timer_delete" number="244"/> + <syscall name="clock_settime" number="245"/> + <syscall name="clock_gettime" number="246"/> + <syscall name="clock_getres" number="247"/> + <syscall name="clock_nanosleep" number="248"/> + <syscall name="swapcontext" number="249"/> + <syscall name="tgkill" number="250" groups="signal"/> + <syscall name="utimes" number="251" groups="file"/> + <syscall name="statfs64" number="252" groups="file"/> + <syscall name="fstatfs64" number="253" groups="descriptor"/> + <syscall name="fadvise64_64" number="254" groups="descriptor"/> + <syscall name="rtas" number="255"/> + <syscall name="sys_debug_setcontext" number="256"/> + <syscall name="mbind" number="259" groups="memory"/> + <syscall name="get_mempolicy" number="260" groups="memory"/> + <syscall name="set_mempolicy" number="261" groups="memory"/> + <syscall name="mq_open" number="262"/> + <syscall name="mq_unlink" number="263"/> + <syscall name="mq_timedsend" number="264"/> + <syscall name="mq_timedreceive" number="265"/> + <syscall name="mq_notify" number="266"/> + <syscall name="mq_getsetattr" number="267"/> + <syscall name="kexec_load" number="268"/> + <syscall name="add_key" number="269"/> + <syscall name="request_key" number="270"/> + <syscall name="keyctl" number="271"/> + <syscall name="waitid" number="272" groups="process"/> + <syscall name="ioprio_set" number="273"/> + <syscall name="ioprio_get" number="274"/> + <syscall name="inotify_init" number="275" groups="descriptor"/> + <syscall name="inotify_add_watch" number="276" groups="descriptor"/> + <syscall name="inotify_rm_watch" number="277" groups="descriptor"/> + <syscall name="spu_run" number="278"/> + <syscall name="spu_create" number="279"/> + <syscall name="pselect6" number="280" groups="descriptor"/> + <syscall name="ppoll" number="281" groups="descriptor"/> + <syscall name="unshare" number="282" groups="process"/> + <syscall name="openat" number="286" groups="descriptor,file"/> + <syscall name="mkdirat" number="287" groups="descriptor,file"/> + <syscall name="mknodat" number="288" groups="descriptor,file"/> + <syscall name="fchownat" number="289" groups="descriptor,file"/> + <syscall name="futimesat" number="290" groups="descriptor,file"/> + <syscall name="fstatat64" number="291" groups="descriptor,file"/> + <syscall name="unlinkat" number="292" groups="descriptor,file"/> + <syscall name="renameat" number="293" groups="descriptor,file"/> + <syscall name="linkat" number="294" groups="descriptor,file"/> + <syscall name="symlinkat" number="295" groups="descriptor,file"/> + <syscall name="readlinkat" number="296" groups="descriptor,file"/> + <syscall name="fchmodat" number="297" groups="descriptor,file"/> + <syscall name="faccessat" number="298" groups="descriptor,file"/> +</syscalls_info> diff --git a/tools/msys/mingw64/share/gdb/syscalls/ppc64-linux.xml b/tools/msys/mingw64/share/gdb/syscalls/ppc64-linux.xml new file mode 100644 index 0000000000000000000000000000000000000000..b56e0b78d15176b43c3069074bf0501708de5246 --- /dev/null +++ b/tools/msys/mingw64/share/gdb/syscalls/ppc64-linux.xml @@ -0,0 +1,292 @@ +<?xml version="1.0"?> +<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd"> +<!-- Copyright (C) 2009-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> +<!-- This file was generated using the following file: + + /usr/src/linux/arch/powerpc/include/asm/unistd.h + + The file mentioned above belongs to the Linux Kernel. --> +<syscalls_info> + <syscall name="restart_syscall" number="0"/> + <syscall name="exit" number="1" groups="process"/> + <syscall name="fork" number="2" groups="process"/> + <syscall name="read" number="3" groups="descriptor"/> + <syscall name="write" number="4" groups="descriptor"/> + <syscall name="open" number="5" groups="descriptor,file"/> + <syscall name="close" number="6" groups="descriptor"/> + <syscall name="waitpid" number="7" groups="process"/> + <syscall name="creat" number="8" groups="descriptor,file"/> + <syscall name="link" number="9" groups="file"/> + <syscall name="unlink" number="10" groups="file"/> + <syscall name="execve" number="11" groups="file,process"/> + <syscall name="chdir" number="12" groups="file"/> + <syscall name="time" number="13"/> + <syscall name="mknod" number="14" groups="file"/> + <syscall name="chmod" number="15" groups="file"/> + <syscall name="lchown" number="16" groups="file"/> + <syscall name="break" number="17" groups="memory"/> + <syscall name="oldstat" number="18" groups="file"/> + <syscall name="lseek" number="19" groups="descriptor"/> + <syscall name="getpid" number="20"/> + <syscall name="mount" number="21" groups="file"/> + <syscall name="umount" number="22" groups="file"/> + <syscall name="setuid" number="23"/> + <syscall name="getuid" number="24"/> + <syscall name="stime" number="25"/> + <syscall name="ptrace" number="26"/> + <syscall name="alarm" number="27"/> + <syscall name="oldfstat" number="28" groups="descriptor"/> + <syscall name="pause" number="29" groups="signal"/> + <syscall name="utime" number="30" groups="file"/> + <syscall name="stty" number="31"/> + <syscall name="gtty" number="32"/> + <syscall name="access" number="33" groups="file"/> + <syscall name="nice" number="34"/> + <syscall name="ftime" number="35"/> + <syscall name="sync" number="36"/> + <syscall name="kill" number="37" groups="signal"/> + <syscall name="rename" number="38" groups="file"/> + <syscall name="mkdir" number="39" groups="file"/> + <syscall name="rmdir" number="40" groups="file"/> + <syscall name="dup" number="41" groups="descriptor"/> + <syscall name="pipe" number="42" groups="descriptor"/> + <syscall name="times" number="43"/> + <syscall name="prof" number="44"/> + <syscall name="brk" number="45" groups="memory"/> + <syscall name="setgid" number="46"/> + <syscall name="getgid" number="47"/> + <syscall name="signal" number="48" groups="signal"/> + <syscall name="geteuid" number="49"/> + <syscall name="getegid" number="50"/> + <syscall name="acct" number="51" groups="file"/> + <syscall name="umount2" number="52" groups="file"/> + <syscall name="lock" number="53"/> + <syscall name="ioctl" number="54" groups="descriptor"/> + <syscall name="fcntl" number="55" groups="descriptor"/> + <syscall name="mpx" number="56"/> + <syscall name="setpgid" number="57"/> + <syscall name="ulimit" number="58"/> + <syscall name="oldolduname" number="59"/> + <syscall name="umask" number="60"/> + <syscall name="chroot" number="61" groups="file"/> + <syscall name="ustat" number="62"/> + <syscall name="dup2" number="63" groups="descriptor"/> + <syscall name="getppid" number="64"/> + <syscall name="getpgrp" number="65"/> + <syscall name="setsid" number="66"/> + <syscall name="sigaction" number="67" groups="signal"/> + <syscall name="sgetmask" number="68" groups="signal"/> + <syscall name="ssetmask" number="69" groups="signal"/> + <syscall name="setreuid" number="70"/> + <syscall name="setregid" number="71"/> + <syscall name="sigsuspend" number="72" groups="signal"/> + <syscall name="sigpending" number="73" groups="signal"/> + <syscall name="sethostname" number="74"/> + <syscall name="setrlimit" number="75"/> + <syscall name="getrlimit" number="76"/> + <syscall name="getrusage" number="77"/> + <syscall name="gettimeofday" number="78"/> + <syscall name="settimeofday" number="79"/> + <syscall name="getgroups" number="80"/> + <syscall name="setgroups" number="81"/> + <syscall name="select" number="82" groups="descriptor"/> + <syscall name="symlink" number="83" groups="file"/> + <syscall name="oldlstat" number="84" groups="file"/> + <syscall name="readlink" number="85" groups="file"/> + <syscall name="uselib" number="86" groups="file"/> + <syscall name="swapon" number="87" groups="file"/> + <syscall name="reboot" number="88"/> + <syscall name="readdir" number="89" groups="descriptor"/> + <syscall name="mmap" number="90" groups="descriptor,memory"/> + <syscall name="munmap" number="91" groups="memory"/> + <syscall name="truncate" number="92" groups="file"/> + <syscall name="ftruncate" number="93" groups="descriptor"/> + <syscall name="fchmod" number="94" groups="descriptor"/> + <syscall name="fchown" number="95" groups="descriptor"/> + <syscall name="getpriority" number="96"/> + <syscall name="setpriority" number="97"/> + <syscall name="profil" number="98"/> + <syscall name="statfs" number="99" groups="file"/> + <syscall name="fstatfs" number="100" groups="descriptor"/> + <syscall name="ioperm" number="101"/> + <syscall name="socketcall" number="102" groups="descriptor"/> + <syscall name="syslog" number="103"/> + <syscall name="setitimer" number="104"/> + <syscall name="getitimer" number="105"/> + <syscall name="stat" number="106" groups="file"/> + <syscall name="lstat" number="107" groups="file"/> + <syscall name="fstat" number="108" groups="descriptor"/> + <syscall name="olduname" number="109"/> + <syscall name="iopl" number="110"/> + <syscall name="vhangup" number="111"/> + <syscall name="idle" number="112"/> + <syscall name="vm86" number="113"/> + <syscall name="wait4" number="114" groups="process"/> + <syscall name="swapoff" number="115" groups="file"/> + <syscall name="sysinfo" number="116"/> + <syscall name="ipc" number="117" groups="ipc"/> + <syscall name="fsync" number="118" groups="descriptor"/> + <syscall name="sigreturn" number="119" groups="signal"/> + <syscall name="clone" number="120" groups="process"/> + <syscall name="setdomainname" number="121"/> + <syscall name="uname" number="122"/> + <syscall name="modify_ldt" number="123"/> + <syscall name="adjtimex" number="124"/> + <syscall name="mprotect" number="125" groups="memory"/> + <syscall name="sigprocmask" number="126" groups="signal"/> + <syscall name="create_module" number="127"/> + <syscall name="init_module" number="128"/> + <syscall name="delete_module" number="129"/> + <syscall name="get_kernel_syms" number="130"/> + <syscall name="quotactl" number="131" groups="file"/> + <syscall name="getpgid" number="132"/> + <syscall name="fchdir" number="133" groups="descriptor"/> + <syscall name="bdflush" number="134"/> + <syscall name="sysfs" number="135"/> + <syscall name="personality" number="136"/> + <syscall name="afs_syscall" number="137"/> + <syscall name="setfsuid" number="138"/> + <syscall name="setfsgid" number="139"/> + <syscall name="_llseek" number="140" groups="descriptor"/> + <syscall name="getdents" number="141" groups="descriptor"/> + <syscall name="_newselect" number="142" groups="descriptor"/> + <syscall name="flock" number="143" groups="descriptor"/> + <syscall name="msync" number="144" groups="memory"/> + <syscall name="readv" number="145" groups="descriptor"/> + <syscall name="writev" number="146" groups="descriptor"/> + <syscall name="getsid" number="147"/> + <syscall name="fdatasync" number="148" groups="descriptor"/> + <syscall name="_sysctl" number="149"/> + <syscall name="mlock" number="150" groups="memory"/> + <syscall name="munlock" number="151" groups="memory"/> + <syscall name="mlockall" number="152" groups="memory"/> + <syscall name="munlockall" number="153" groups="memory"/> + <syscall name="sched_setparam" number="154"/> + <syscall name="sched_getparam" number="155"/> + <syscall name="sched_setscheduler" number="156"/> + <syscall name="sched_getscheduler" number="157"/> + <syscall name="sched_yield" number="158"/> + <syscall name="sched_get_priority_max" number="159"/> + <syscall name="sched_get_priority_min" number="160"/> + <syscall name="sched_rr_get_interval" number="161"/> + <syscall name="nanosleep" number="162"/> + <syscall name="mremap" number="163" groups="memory"/> + <syscall name="setresuid" number="164"/> + <syscall name="getresuid" number="165"/> + <syscall name="query_module" number="166"/> + <syscall name="poll" number="167" groups="descriptor"/> + <syscall name="nfsservctl" number="168"/> + <syscall name="setresgid" number="169"/> + <syscall name="getresgid" number="170"/> + <syscall name="prctl" number="171"/> + <syscall name="rt_sigreturn" number="172" groups="signal"/> + <syscall name="rt_sigaction" number="173" groups="signal"/> + <syscall name="rt_sigprocmask" number="174" groups="signal"/> + <syscall name="rt_sigpending" number="175" groups="signal"/> + <syscall name="rt_sigtimedwait" number="176" groups="signal"/> + <syscall name="rt_sigqueueinfo" number="177" groups="signal"/> + <syscall name="rt_sigsuspend" number="178" groups="signal"/> + <syscall name="pread64" number="179" groups="descriptor"/> + <syscall name="pwrite64" number="180" groups="descriptor"/> + <syscall name="chown" number="181" groups="file"/> + <syscall name="getcwd" number="182" groups="file"/> + <syscall name="capget" number="183"/> + <syscall name="capset" number="184"/> + <syscall name="sigaltstack" number="185" groups="signal"/> + <syscall name="sendfile" number="186" groups="descriptor,network"/> + <syscall name="getpmsg" number="187"/> + <syscall name="putpmsg" number="188"/> + <syscall name="vfork" number="189" groups="process"/> + <syscall name="ugetrlimit" number="190"/> + <syscall name="readahead" number="191" groups="descriptor"/> + <syscall name="pciconfig_read" number="198"/> + <syscall name="pciconfig_write" number="199"/> + <syscall name="pciconfig_iobase" number="200"/> + <syscall name="multiplexer" number="201"/> + <syscall name="getdents64" number="202" groups="descriptor"/> + <syscall name="pivot_root" number="203" groups="file"/> + <syscall name="madvise" number="205" groups="memory"/> + <syscall name="mincore" number="206" groups="memory"/> + <syscall name="gettid" number="207"/> + <syscall name="tkill" number="208" groups="signal"/> + <syscall name="setxattr" number="209" groups="file"/> + <syscall name="lsetxattr" number="210" groups="file"/> + <syscall name="fsetxattr" number="211" groups="descriptor"/> + <syscall name="getxattr" number="212" groups="file"/> + <syscall name="lgetxattr" number="213" groups="file"/> + <syscall name="fgetxattr" number="214" groups="descriptor"/> + <syscall name="listxattr" number="215" groups="file"/> + <syscall name="llistxattr" number="216" groups="file"/> + <syscall name="flistxattr" number="217" groups="descriptor"/> + <syscall name="removexattr" number="218" groups="file"/> + <syscall name="lremovexattr" number="219" groups="file"/> + <syscall name="fremovexattr" number="220" groups="descriptor"/> + <syscall name="futex" number="221"/> + <syscall name="sched_setaffinity" number="222"/> + <syscall name="sched_getaffinity" number="223"/> + <syscall name="tuxcall" number="225"/> + <syscall name="io_setup" number="227"/> + <syscall name="io_destroy" number="228"/> + <syscall name="io_getevents" number="229"/> + <syscall name="io_submit" number="230"/> + <syscall name="io_cancel" number="231"/> + <syscall name="set_tid_address" number="232"/> + <syscall name="fadvise64" number="233" groups="descriptor"/> + <syscall name="exit_group" number="234" groups="process"/> + <syscall name="lookup_dcookie" number="235"/> + <syscall name="epoll_create" number="236" groups="descriptor"/> + <syscall name="epoll_ctl" number="237" groups="descriptor"/> + <syscall name="epoll_wait" number="238" groups="descriptor"/> + <syscall name="remap_file_pages" number="239" groups="memory"/> + <syscall name="timer_create" number="240"/> + <syscall name="timer_settime" number="241"/> + <syscall name="timer_gettime" number="242"/> + <syscall name="timer_getoverrun" number="243"/> + <syscall name="timer_delete" number="244"/> + <syscall name="clock_settime" number="245"/> + <syscall name="clock_gettime" number="246"/> + <syscall name="clock_getres" number="247"/> + <syscall name="clock_nanosleep" number="248"/> + <syscall name="swapcontext" number="249"/> + <syscall name="tgkill" number="250" groups="signal"/> + <syscall name="utimes" number="251" groups="file"/> + <syscall name="statfs64" number="252" groups="file"/> + <syscall name="fstatfs64" number="253" groups="descriptor"/> + <syscall name="rtas" number="255"/> + <syscall name="sys_debug_setcontext" number="256"/> + <syscall name="mbind" number="259" groups="memory"/> + <syscall name="get_mempolicy" number="260" groups="memory"/> + <syscall name="set_mempolicy" number="261" groups="memory"/> + <syscall name="mq_open" number="262"/> + <syscall name="mq_unlink" number="263"/> + <syscall name="mq_timedsend" number="264"/> + <syscall name="mq_timedreceive" number="265"/> + <syscall name="mq_notify" number="266"/> + <syscall name="mq_getsetattr" number="267"/> + <syscall name="kexec_load" number="268"/> + <syscall name="add_key" number="269"/> + <syscall name="request_key" number="270"/> + <syscall name="keyctl" number="271"/> + <syscall name="waitid" number="272" groups="process"/> + <syscall name="ioprio_set" number="273"/> + <syscall name="ioprio_get" number="274"/> + <syscall name="inotify_init" number="275" groups="descriptor"/> + <syscall name="inotify_add_watch" number="276" groups="descriptor"/> + <syscall name="inotify_rm_watch" number="277" groups="descriptor"/> + <syscall name="spu_run" number="278"/> + <syscall name="spu_create" number="279"/> + <syscall name="pselect6" number="280" groups="descriptor"/> + <syscall name="ppoll" number="281" groups="descriptor"/> + <syscall name="unshare" number="282" groups="process"/> + <syscall name="unlinkat" number="286" groups="descriptor,file"/> + <syscall name="renameat" number="287" groups="descriptor,file"/> + <syscall name="linkat" number="288" groups="descriptor,file"/> + <syscall name="symlinkat" number="289" groups="descriptor,file"/> + <syscall name="readlinkat" number="290" groups="descriptor,file"/> + <syscall name="fchmodat" number="291" groups="descriptor,file"/> + <syscall name="faccessat" number="292" groups="descriptor,file"/> +</syscalls_info> diff --git a/tools/msys/mingw64/share/gdb/syscalls/s390-linux.xml b/tools/msys/mingw64/share/gdb/syscalls/s390-linux.xml new file mode 100644 index 0000000000000000000000000000000000000000..8db0ac5c861dcd04e8028daf1ea7d4bb92c2af4e --- /dev/null +++ b/tools/msys/mingw64/share/gdb/syscalls/s390-linux.xml @@ -0,0 +1,364 @@ +<?xml version="1.0"?> +<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd"> +<!-- Copyright (C) 2009-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> +<!-- This file was generated using the following file: + + /usr/include/asm/unistd.h + + The file mentioned above belongs to the Linux Kernel. --> +<syscalls_info> + <syscall name="exit" number="1" groups="process"/> + <syscall name="fork" number="2" groups="process"/> + <syscall name="read" number="3" groups="descriptor"/> + <syscall name="write" number="4" groups="descriptor"/> + <syscall name="open" number="5" groups="descriptor,file"/> + <syscall name="close" number="6" groups="descriptor"/> + <syscall name="restart_syscall" number="7"/> + <syscall name="creat" number="8" groups="descriptor,file"/> + <syscall name="link" number="9" groups="file"/> + <syscall name="unlink" number="10" groups="file"/> + <syscall name="execve" number="11" groups="file,process"/> + <syscall name="chdir" number="12" groups="file"/> + <syscall name="time" number="13"/> + <syscall name="mknod" number="14" groups="file"/> + <syscall name="chmod" number="15" groups="file"/> + <syscall name="lchown" number="16" groups="file"/> + <syscall name="lseek" number="19" groups="descriptor"/> + <syscall name="getpid" number="20"/> + <syscall name="mount" number="21" groups="file"/> + <syscall name="umount" number="22" groups="file"/> + <syscall name="setuid" number="23"/> + <syscall name="getuid" number="24"/> + <syscall name="stime" number="25"/> + <syscall name="ptrace" number="26"/> + <syscall name="alarm" number="27"/> + <syscall name="pause" number="29" groups="signal"/> + <syscall name="utime" number="30" groups="file"/> + <syscall name="access" number="33" groups="file"/> + <syscall name="nice" number="34"/> + <syscall name="sync" number="36"/> + <syscall name="kill" number="37" groups="signal"/> + <syscall name="rename" number="38" groups="file"/> + <syscall name="mkdir" number="39" groups="file"/> + <syscall name="rmdir" number="40" groups="file"/> + <syscall name="dup" number="41" groups="descriptor"/> + <syscall name="pipe" number="42" groups="descriptor"/> + <syscall name="times" number="43"/> + <syscall name="brk" number="45" groups="memory"/> + <syscall name="setgid" number="46"/> + <syscall name="getgid" number="47"/> + <syscall name="signal" number="48" groups="signal"/> + <syscall name="geteuid" number="49"/> + <syscall name="getegid" number="50"/> + <syscall name="acct" number="51" groups="file"/> + <syscall name="umount2" number="52" groups="file"/> + <syscall name="ioctl" number="54" groups="descriptor"/> + <syscall name="fcntl" number="55" groups="descriptor"/> + <syscall name="setpgid" number="57"/> + <syscall name="umask" number="60"/> + <syscall name="chroot" number="61" groups="file"/> + <syscall name="ustat" number="62"/> + <syscall name="dup2" number="63" groups="descriptor"/> + <syscall name="getppid" number="64"/> + <syscall name="getpgrp" number="65"/> + <syscall name="setsid" number="66"/> + <syscall name="sigaction" number="67" groups="signal"/> + <syscall name="setreuid" number="70"/> + <syscall name="setregid" number="71"/> + <syscall name="sigsuspend" number="72" groups="signal"/> + <syscall name="sigpending" number="73" groups="signal"/> + <syscall name="sethostname" number="74"/> + <syscall name="setrlimit" number="75"/> + <syscall name="getrlimit" number="76"/> + <syscall name="getrusage" number="77"/> + <syscall name="gettimeofday" number="78"/> + <syscall name="settimeofday" number="79"/> + <syscall name="getgroups" number="80"/> + <syscall name="setgroups" number="81"/> + <syscall name="symlink" number="83" groups="file"/> + <syscall name="readlink" number="85" groups="file"/> + <syscall name="uselib" number="86" groups="file"/> + <syscall name="swapon" number="87" groups="file"/> + <syscall name="reboot" number="88"/> + <syscall name="readdir" number="89" groups="descriptor"/> + <syscall name="mmap" number="90" groups="descriptor,memory"/> + <syscall name="munmap" number="91" groups="memory"/> + <syscall name="truncate" number="92" groups="file"/> + <syscall name="ftruncate" number="93" groups="descriptor"/> + <syscall name="fchmod" number="94" groups="descriptor"/> + <syscall name="fchown" number="95" groups="descriptor"/> + <syscall name="getpriority" number="96"/> + <syscall name="setpriority" number="97"/> + <syscall name="statfs" number="99" groups="file"/> + <syscall name="fstatfs" number="100" groups="descriptor"/> + <syscall name="ioperm" number="101"/> + <syscall name="socketcall" number="102" groups="descriptor"/> + <syscall name="syslog" number="103"/> + <syscall name="setitimer" number="104"/> + <syscall name="getitimer" number="105"/> + <syscall name="stat" number="106" groups="file"/> + <syscall name="lstat" number="107" groups="file"/> + <syscall name="fstat" number="108" groups="descriptor"/> + <syscall name="lookup_dcookie" number="110"/> + <syscall name="vhangup" number="111"/> + <syscall name="idle" number="112"/> + <syscall name="wait4" number="114" groups="process"/> + <syscall name="swapoff" number="115" groups="file"/> + <syscall name="sysinfo" number="116"/> + <syscall name="ipc" number="117" groups="ipc"/> + <syscall name="fsync" number="118" groups="descriptor"/> + <syscall name="sigreturn" number="119" groups="signal"/> + <syscall name="clone" number="120" groups="process"/> + <syscall name="setdomainname" number="121"/> + <syscall name="uname" number="122"/> + <syscall name="adjtimex" number="124"/> + <syscall name="mprotect" number="125" groups="memory"/> + <syscall name="sigprocmask" number="126" groups="signal"/> + <syscall name="create_module" number="127"/> + <syscall name="init_module" number="128"/> + <syscall name="delete_module" number="129"/> + <syscall name="get_kernel_syms" number="130"/> + <syscall name="quotactl" number="131" groups="file"/> + <syscall name="getpgid" number="132"/> + <syscall name="fchdir" number="133" groups="descriptor"/> + <syscall name="bdflush" number="134"/> + <syscall name="sysfs" number="135"/> + <syscall name="personality" number="136"/> + <syscall name="afs_syscall" number="137"/> + <syscall name="setfsuid" number="138"/> + <syscall name="setfsgid" number="139"/> + <syscall name="_llseek" number="140" groups="descriptor"/> + <syscall name="getdents" number="141" groups="descriptor"/> + <syscall name="_newselect" number="142" groups="descriptor"/> + <syscall name="flock" number="143" groups="descriptor"/> + <syscall name="msync" number="144" groups="memory"/> + <syscall name="readv" number="145" groups="descriptor"/> + <syscall name="writev" number="146" groups="descriptor"/> + <syscall name="getsid" number="147"/> + <syscall name="fdatasync" number="148" groups="descriptor"/> + <syscall name="_sysctl" number="149"/> + <syscall name="mlock" number="150" groups="memory"/> + <syscall name="munlock" number="151" groups="memory"/> + <syscall name="mlockall" number="152" groups="memory"/> + <syscall name="munlockall" number="153" groups="memory"/> + <syscall name="sched_setparam" number="154"/> + <syscall name="sched_getparam" number="155"/> + <syscall name="sched_setscheduler" number="156"/> + <syscall name="sched_getscheduler" number="157"/> + <syscall name="sched_yield" number="158"/> + <syscall name="sched_get_priority_max" number="159"/> + <syscall name="sched_get_priority_min" number="160"/> + <syscall name="sched_rr_get_interval" number="161"/> + <syscall name="nanosleep" number="162"/> + <syscall name="mremap" number="163" groups="memory"/> + <syscall name="setresuid" number="164"/> + <syscall name="getresuid" number="165"/> + <syscall name="query_module" number="167"/> + <syscall name="poll" number="168" groups="descriptor"/> + <syscall name="nfsservctl" number="169"/> + <syscall name="setresgid" number="170"/> + <syscall name="getresgid" number="171"/> + <syscall name="prctl" number="172"/> + <syscall name="rt_sigreturn" number="173" groups="signal"/> + <syscall name="rt_sigaction" number="174" groups="signal"/> + <syscall name="rt_sigprocmask" number="175" groups="signal"/> + <syscall name="rt_sigpending" number="176" groups="signal"/> + <syscall name="rt_sigtimedwait" number="177" groups="signal"/> + <syscall name="rt_sigqueueinfo" number="178" groups="signal"/> + <syscall name="rt_sigsuspend" number="179" groups="signal"/> + <syscall name="pread64" number="180" groups="descriptor"/> + <syscall name="pwrite64" number="181" groups="descriptor"/> + <syscall name="chown" number="182" groups="file"/> + <syscall name="getcwd" number="183" groups="file"/> + <syscall name="capget" number="184"/> + <syscall name="capset" number="185"/> + <syscall name="sigaltstack" number="186" groups="signal"/> + <syscall name="sendfile" number="187" groups="descriptor,network"/> + <syscall name="getpmsg" number="188"/> + <syscall name="putpmsg" number="189"/> + <syscall name="vfork" number="190" groups="process"/> + <syscall name="ugetrlimit" number="191"/> + <syscall name="mmap2" number="192" groups="descriptor,memory"/> + <syscall name="truncate64" number="193" groups="file"/> + <syscall name="ftruncate64" number="194" groups="descriptor"/> + <syscall name="stat64" number="195" groups="file"/> + <syscall name="lstat64" number="196" groups="file"/> + <syscall name="fstat64" number="197" groups="descriptor"/> + <syscall name="lchown32" number="198" groups="file"/> + <syscall name="getuid32" number="199"/> + <syscall name="getgid32" number="200"/> + <syscall name="geteuid32" number="201"/> + <syscall name="getegid32" number="202"/> + <syscall name="setreuid32" number="203"/> + <syscall name="setregid32" number="204"/> + <syscall name="getgroups32" number="205"/> + <syscall name="setgroups32" number="206"/> + <syscall name="fchown32" number="207" groups="descriptor"/> + <syscall name="setresuid32" number="208"/> + <syscall name="getresuid32" number="209"/> + <syscall name="setresgid32" number="210"/> + <syscall name="getresgid32" number="211"/> + <syscall name="chown32" number="212" groups="file"/> + <syscall name="setuid32" number="213"/> + <syscall name="setgid32" number="214"/> + <syscall name="setfsuid32" number="215"/> + <syscall name="setfsgid32" number="216"/> + <syscall name="pivot_root" number="217" groups="file"/> + <syscall name="mincore" number="218" groups="memory"/> + <syscall name="madvise" number="219" groups="memory"/> + <syscall name="getdents64" number="220" groups="descriptor"/> + <syscall name="fcntl64" number="221" groups="descriptor"/> + <syscall name="readahead" number="222" groups="descriptor"/> + <syscall name="sendfile64" number="223" groups="descriptor,network"/> + <syscall name="setxattr" number="224" groups="file"/> + <syscall name="lsetxattr" number="225" groups="file"/> + <syscall name="fsetxattr" number="226" groups="descriptor"/> + <syscall name="getxattr" number="227" groups="file"/> + <syscall name="lgetxattr" number="228" groups="file"/> + <syscall name="fgetxattr" number="229" groups="descriptor"/> + <syscall name="listxattr" number="230" groups="file"/> + <syscall name="llistxattr" number="231" groups="file"/> + <syscall name="flistxattr" number="232" groups="descriptor"/> + <syscall name="removexattr" number="233" groups="file"/> + <syscall name="lremovexattr" number="234" groups="file"/> + <syscall name="fremovexattr" number="235" groups="descriptor"/> + <syscall name="gettid" number="236"/> + <syscall name="tkill" number="237" groups="signal"/> + <syscall name="futex" number="238"/> + <syscall name="sched_setaffinity" number="239"/> + <syscall name="sched_getaffinity" number="240"/> + <syscall name="tgkill" number="241" groups="signal"/> + <syscall name="io_setup" number="243"/> + <syscall name="io_destroy" number="244"/> + <syscall name="io_getevents" number="245"/> + <syscall name="io_submit" number="246"/> + <syscall name="io_cancel" number="247"/> + <syscall name="exit_group" number="248" groups="process"/> + <syscall name="epoll_create" number="249" groups="descriptor"/> + <syscall name="epoll_ctl" number="250" groups="descriptor"/> + <syscall name="epoll_wait" number="251" groups="descriptor"/> + <syscall name="set_tid_address" number="252"/> + <syscall name="fadvise64" number="253" groups="descriptor"/> + <syscall name="timer_create" number="254"/> + <syscall name="timer_settime" number="255"/> + <syscall name="timer_gettime" number="256"/> + <syscall name="timer_getoverrun" number="257"/> + <syscall name="timer_delete" number="258"/> + <syscall name="clock_settime" number="259"/> + <syscall name="clock_gettime" number="260"/> + <syscall name="clock_getres" number="261"/> + <syscall name="clock_nanosleep" number="262"/> + <syscall name="fadvise64_64" number="264" groups="descriptor"/> + <syscall name="statfs64" number="265" groups="file"/> + <syscall name="fstatfs64" number="266" groups="descriptor"/> + <syscall name="remap_file_pages" number="267" groups="memory"/> + <syscall name="mbind" number="268" groups="memory"/> + <syscall name="get_mempolicy" number="269" groups="memory"/> + <syscall name="set_mempolicy" number="270" groups="memory"/> + <syscall name="mq_open" number="271"/> + <syscall name="mq_unlink" number="272"/> + <syscall name="mq_timedsend" number="273"/> + <syscall name="mq_timedreceive" number="274"/> + <syscall name="mq_notify" number="275"/> + <syscall name="mq_getsetattr" number="276"/> + <syscall name="kexec_load" number="277"/> + <syscall name="add_key" number="278"/> + <syscall name="request_key" number="279"/> + <syscall name="keyctl" number="280"/> + <syscall name="waitid" number="281" groups="process"/> + <syscall name="ioprio_set" number="282"/> + <syscall name="ioprio_get" number="283"/> + <syscall name="inotify_init" number="284" groups="descriptor"/> + <syscall name="inotify_add_watch" number="285" groups="descriptor"/> + <syscall name="inotify_rm_watch" number="286" groups="descriptor"/> + <syscall name="migrate_pages" number="287" groups="memory"/> + <syscall name="openat" number="288" groups="descriptor,file"/> + <syscall name="mkdirat" number="289" groups="descriptor,file"/> + <syscall name="mknodat" number="290" groups="descriptor,file"/> + <syscall name="fchownat" number="291" groups="descriptor,file"/> + <syscall name="futimesat" number="292" groups="descriptor,file"/> + <syscall name="fstatat64" number="293" groups="descriptor,file"/> + <syscall name="unlinkat" number="294" groups="descriptor,file"/> + <syscall name="renameat" number="295" groups="descriptor,file"/> + <syscall name="linkat" number="296" groups="descriptor,file"/> + <syscall name="symlinkat" number="297" groups="descriptor,file"/> + <syscall name="readlinkat" number="298" groups="descriptor,file"/> + <syscall name="fchmodat" number="299" groups="descriptor,file"/> + <syscall name="faccessat" number="300" groups="descriptor,file"/> + <syscall name="pselect6" number="301" groups="descriptor"/> + <syscall name="ppoll" number="302" groups="descriptor"/> + <syscall name="unshare" number="303" groups="process"/> + <syscall name="set_robust_list" number="304"/> + <syscall name="get_robust_list" number="305"/> + <syscall name="splice" number="306" groups="descriptor"/> + <syscall name="sync_file_range" number="307" groups="descriptor"/> + <syscall name="tee" number="308" groups="descriptor"/> + <syscall name="vmsplice" number="309" groups="descriptor"/> + <syscall name="move_pages" number="310" groups="memory"/> + <syscall name="getcpu" number="311"/> + <syscall name="epoll_pwait" number="312" groups="descriptor"/> + <syscall name="utimes" number="313" groups="file"/> + <syscall name="fallocate" number="314" groups="descriptor"/> + <syscall name="utimensat" number="315" groups="descriptor,file"/> + <syscall name="signalfd" number="316" groups="descriptor,signal"/> + <syscall name="timerfd" number="317" groups="descriptor"/> + <syscall name="eventfd" number="318" groups="descriptor"/> + <syscall name="timerfd_create" number="319" groups="descriptor"/> + <syscall name="timerfd_settime" number="320" groups="descriptor"/> + <syscall name="timerfd_gettime" number="321" groups="descriptor"/> + <syscall name="signalfd4" number="322" groups="descriptor,signal"/> + <syscall name="eventfd2" number="323" groups="descriptor"/> + <syscall name="inotify_init1" number="324" groups="descriptor"/> + <syscall name="pipe2" number="325" groups="descriptor"/> + <syscall name="dup3" number="326" groups="descriptor"/> + <syscall name="epoll_create1" number="327" groups="descriptor"/> + <syscall name="rt_tgsigqueueinfo" number="330" groups="process,signal"/> + <syscall name="perf_event_open" number="331" groups="descriptor"/> + <syscall name="fanotify_init" number="332" groups="descriptor"/> + <syscall name="fanotify_mark" number="333" groups="descriptor,file"/> + <syscall name="prlimit64" number="334"/> + <syscall name="name_to_handle_at" number="335" groups="descriptor,file"/> + <syscall name="open_by_handle_at" number="336" groups="descriptor"/> + <syscall name="clock_adjtime" number="337"/> + <syscall name="syncfs" number="338" groups="descriptor"/> + <syscall name="setns" number="339" groups="descriptor"/> + <syscall name="process_vm_readv" number="340"/> + <syscall name="process_vm_writev" number="341"/> + <syscall name="s390_runtime_instr" number="342"/> + <syscall name="kcmp" number="343"/> + <syscall name="finit_module" number="344" groups="descriptor"/> + <syscall name="sched_setattr" number="345"/> + <syscall name="sched_getattr" number="346"/> + <syscall name="renameat2" number="347"/> + <syscall name="seccomp" number="348"/> + <syscall name="getrandom" number="349"/> + <syscall name="memfd_create" number="350"/> + <syscall name="bpf" number="351"/> + <syscall name="s390_pci_mmio_write" number="352"/> + <syscall name="s390_pci_mmio_read" number="353"/> + <syscall name="execveat" number="354"/> + <syscall name="userfaultfd" number="355"/> + <syscall name="membarrier" number="356"/> + <syscall name="recvmmsg" number="357" groups="network"/> + <syscall name="sendmmsg" number="358" groups="network"/> + <syscall name="socket" number="359" groups="network"/> + <syscall name="socketpair" number="360" groups="network"/> + <syscall name="bind" number="361" groups="network"/> + <syscall name="connect" number="362" groups="network"/> + <syscall name="listen" number="363" groups="network"/> + <syscall name="accept4" number="364" groups="network"/> + <syscall name="getsockopt" number="365" groups="network"/> + <syscall name="setsockopt" number="366" groups="network"/> + <syscall name="getsockname" number="367" groups="network"/> + <syscall name="getpeername" number="368" groups="network"/> + <syscall name="sendto" number="369" groups="network"/> + <syscall name="sendmsg" number="370" groups="network"/> + <syscall name="recvfrom" number="371" groups="network"/> + <syscall name="recvmsg" number="372" groups="network"/> + <syscall name="shutdown" number="373" groups="network"/> + <syscall name="mlock2" number="374"/> +</syscalls_info> diff --git a/tools/msys/mingw64/share/gdb/syscalls/s390x-linux.xml b/tools/msys/mingw64/share/gdb/syscalls/s390x-linux.xml new file mode 100644 index 0000000000000000000000000000000000000000..fe873e6c8a1bfe574333c001346a638667ee58d2 --- /dev/null +++ b/tools/msys/mingw64/share/gdb/syscalls/s390x-linux.xml @@ -0,0 +1,331 @@ +<?xml version="1.0"?> +<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd"> +<!-- Copyright (C) 2009-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> +<!-- This file was generated using the following file: + + /usr/include/asm/unistd.h + + The file mentioned above belongs to the Linux Kernel. --> +<syscalls_info> + <syscall name="exit" number="1" groups="process"/> + <syscall name="fork" number="2" groups="process"/> + <syscall name="read" number="3" groups="descriptor"/> + <syscall name="write" number="4" groups="descriptor"/> + <syscall name="open" number="5" groups="descriptor,file"/> + <syscall name="close" number="6" groups="descriptor"/> + <syscall name="restart_syscall" number="7"/> + <syscall name="creat" number="8" groups="descriptor,file"/> + <syscall name="link" number="9" groups="file"/> + <syscall name="unlink" number="10" groups="file"/> + <syscall name="execve" number="11" groups="file,process"/> + <syscall name="chdir" number="12" groups="file"/> + <syscall name="mknod" number="14" groups="file"/> + <syscall name="chmod" number="15" groups="file"/> + <syscall name="lseek" number="19" groups="descriptor"/> + <syscall name="getpid" number="20"/> + <syscall name="mount" number="21" groups="file"/> + <syscall name="umount" number="22" groups="file"/> + <syscall name="ptrace" number="26"/> + <syscall name="alarm" number="27"/> + <syscall name="pause" number="29" groups="signal"/> + <syscall name="utime" number="30" groups="file"/> + <syscall name="access" number="33" groups="file"/> + <syscall name="nice" number="34"/> + <syscall name="sync" number="36"/> + <syscall name="kill" number="37" groups="signal"/> + <syscall name="rename" number="38" groups="file"/> + <syscall name="mkdir" number="39" groups="file"/> + <syscall name="rmdir" number="40" groups="file"/> + <syscall name="dup" number="41" groups="descriptor"/> + <syscall name="pipe" number="42" groups="descriptor"/> + <syscall name="times" number="43"/> + <syscall name="brk" number="45" groups="memory"/> + <syscall name="signal" number="48" groups="signal"/> + <syscall name="acct" number="51" groups="file"/> + <syscall name="umount2" number="52" groups="file"/> + <syscall name="ioctl" number="54" groups="descriptor"/> + <syscall name="fcntl" number="55" groups="descriptor"/> + <syscall name="setpgid" number="57"/> + <syscall name="umask" number="60"/> + <syscall name="chroot" number="61" groups="file"/> + <syscall name="ustat" number="62"/> + <syscall name="dup2" number="63" groups="descriptor"/> + <syscall name="getppid" number="64"/> + <syscall name="getpgrp" number="65"/> + <syscall name="setsid" number="66"/> + <syscall name="sigaction" number="67" groups="signal"/> + <syscall name="sigsuspend" number="72" groups="signal"/> + <syscall name="sigpending" number="73" groups="signal"/> + <syscall name="sethostname" number="74"/> + <syscall name="setrlimit" number="75"/> + <syscall name="getrusage" number="77"/> + <syscall name="gettimeofday" number="78"/> + <syscall name="settimeofday" number="79"/> + <syscall name="symlink" number="83" groups="file"/> + <syscall name="readlink" number="85" groups="file"/> + <syscall name="uselib" number="86" groups="file"/> + <syscall name="swapon" number="87" groups="file"/> + <syscall name="reboot" number="88"/> + <syscall name="readdir" number="89" groups="descriptor"/> + <syscall name="mmap" number="90" groups="descriptor,memory"/> + <syscall name="munmap" number="91" groups="memory"/> + <syscall name="truncate" number="92" groups="file"/> + <syscall name="ftruncate" number="93" groups="descriptor"/> + <syscall name="fchmod" number="94" groups="descriptor"/> + <syscall name="getpriority" number="96"/> + <syscall name="setpriority" number="97"/> + <syscall name="statfs" number="99" groups="file"/> + <syscall name="fstatfs" number="100" groups="descriptor"/> + <syscall name="socketcall" number="102" groups="descriptor"/> + <syscall name="syslog" number="103"/> + <syscall name="setitimer" number="104"/> + <syscall name="getitimer" number="105"/> + <syscall name="stat" number="106" groups="file"/> + <syscall name="lstat" number="107" groups="file"/> + <syscall name="fstat" number="108" groups="descriptor"/> + <syscall name="lookup_dcookie" number="110"/> + <syscall name="vhangup" number="111"/> + <syscall name="idle" number="112"/> + <syscall name="wait4" number="114" groups="process"/> + <syscall name="swapoff" number="115" groups="file"/> + <syscall name="sysinfo" number="116"/> + <syscall name="ipc" number="117" groups="ipc"/> + <syscall name="fsync" number="118" groups="descriptor"/> + <syscall name="sigreturn" number="119" groups="signal"/> + <syscall name="clone" number="120" groups="process"/> + <syscall name="setdomainname" number="121"/> + <syscall name="uname" number="122"/> + <syscall name="adjtimex" number="124"/> + <syscall name="mprotect" number="125" groups="memory"/> + <syscall name="sigprocmask" number="126" groups="signal"/> + <syscall name="create_module" number="127"/> + <syscall name="init_module" number="128"/> + <syscall name="delete_module" number="129"/> + <syscall name="get_kernel_syms" number="130"/> + <syscall name="quotactl" number="131" groups="file"/> + <syscall name="getpgid" number="132"/> + <syscall name="fchdir" number="133" groups="descriptor"/> + <syscall name="bdflush" number="134"/> + <syscall name="sysfs" number="135"/> + <syscall name="personality" number="136"/> + <syscall name="afs_syscall" number="137"/> + <syscall name="getdents" number="141" groups="descriptor"/> + <syscall name="select" number="142" groups="descriptor"/> + <syscall name="flock" number="143" groups="descriptor"/> + <syscall name="msync" number="144" groups="memory"/> + <syscall name="readv" number="145" groups="descriptor"/> + <syscall name="writev" number="146" groups="descriptor"/> + <syscall name="getsid" number="147"/> + <syscall name="fdatasync" number="148" groups="descriptor"/> + <syscall name="_sysctl" number="149"/> + <syscall name="mlock" number="150" groups="memory"/> + <syscall name="munlock" number="151" groups="memory"/> + <syscall name="mlockall" number="152" groups="memory"/> + <syscall name="munlockall" number="153" groups="memory"/> + <syscall name="sched_setparam" number="154"/> + <syscall name="sched_getparam" number="155"/> + <syscall name="sched_setscheduler" number="156"/> + <syscall name="sched_getscheduler" number="157"/> + <syscall name="sched_yield" number="158"/> + <syscall name="sched_get_priority_max" number="159"/> + <syscall name="sched_get_priority_min" number="160"/> + <syscall name="sched_rr_get_interval" number="161"/> + <syscall name="nanosleep" number="162"/> + <syscall name="mremap" number="163" groups="memory"/> + <syscall name="query_module" number="167"/> + <syscall name="poll" number="168" groups="descriptor"/> + <syscall name="nfsservctl" number="169"/> + <syscall name="prctl" number="172"/> + <syscall name="rt_sigreturn" number="173" groups="signal"/> + <syscall name="rt_sigaction" number="174" groups="signal"/> + <syscall name="rt_sigprocmask" number="175" groups="signal"/> + <syscall name="rt_sigpending" number="176" groups="signal"/> + <syscall name="rt_sigtimedwait" number="177" groups="signal"/> + <syscall name="rt_sigqueueinfo" number="178" groups="signal"/> + <syscall name="rt_sigsuspend" number="179" groups="signal"/> + <syscall name="pread64" number="180" groups="descriptor"/> + <syscall name="pwrite64" number="181" groups="descriptor"/> + <syscall name="getcwd" number="183" groups="file"/> + <syscall name="capget" number="184"/> + <syscall name="capset" number="185"/> + <syscall name="sigaltstack" number="186" groups="signal"/> + <syscall name="sendfile" number="187" groups="descriptor,network"/> + <syscall name="getpmsg" number="188"/> + <syscall name="putpmsg" number="189"/> + <syscall name="vfork" number="190" groups="process"/> + <syscall name="getrlimit" number="191"/> + <syscall name="lchown" number="198" groups="file"/> + <syscall name="getuid" number="199"/> + <syscall name="getgid" number="200"/> + <syscall name="geteuid" number="201"/> + <syscall name="getegid" number="202"/> + <syscall name="setreuid" number="203"/> + <syscall name="setregid" number="204"/> + <syscall name="getgroups" number="205"/> + <syscall name="setgroups" number="206"/> + <syscall name="fchown" number="207" groups="descriptor"/> + <syscall name="setresuid" number="208"/> + <syscall name="getresuid" number="209"/> + <syscall name="setresgid" number="210"/> + <syscall name="getresgid" number="211"/> + <syscall name="chown" number="212" groups="file"/> + <syscall name="setuid" number="213"/> + <syscall name="setgid" number="214"/> + <syscall name="setfsuid" number="215"/> + <syscall name="setfsgid" number="216"/> + <syscall name="pivot_root" number="217" groups="file"/> + <syscall name="mincore" number="218" groups="memory"/> + <syscall name="madvise" number="219" groups="memory"/> + <syscall name="getdents64" number="220" groups="descriptor"/> + <syscall name="readahead" number="222" groups="descriptor"/> + <syscall name="setxattr" number="224" groups="file"/> + <syscall name="lsetxattr" number="225" groups="file"/> + <syscall name="fsetxattr" number="226" groups="descriptor"/> + <syscall name="getxattr" number="227" groups="file"/> + <syscall name="lgetxattr" number="228" groups="file"/> + <syscall name="fgetxattr" number="229" groups="descriptor"/> + <syscall name="listxattr" number="230" groups="file"/> + <syscall name="llistxattr" number="231" groups="file"/> + <syscall name="flistxattr" number="232" groups="descriptor"/> + <syscall name="removexattr" number="233" groups="file"/> + <syscall name="lremovexattr" number="234" groups="file"/> + <syscall name="fremovexattr" number="235" groups="descriptor"/> + <syscall name="gettid" number="236"/> + <syscall name="tkill" number="237" groups="signal"/> + <syscall name="futex" number="238"/> + <syscall name="sched_setaffinity" number="239"/> + <syscall name="sched_getaffinity" number="240"/> + <syscall name="tgkill" number="241" groups="signal"/> + <syscall name="io_setup" number="243"/> + <syscall name="io_destroy" number="244"/> + <syscall name="io_getevents" number="245"/> + <syscall name="io_submit" number="246"/> + <syscall name="io_cancel" number="247"/> + <syscall name="exit_group" number="248" groups="process"/> + <syscall name="epoll_create" number="249" groups="descriptor"/> + <syscall name="epoll_ctl" number="250" groups="descriptor"/> + <syscall name="epoll_wait" number="251" groups="descriptor"/> + <syscall name="set_tid_address" number="252"/> + <syscall name="fadvise64" number="253" groups="descriptor"/> + <syscall name="timer_create" number="254"/> + <syscall name="timer_settime" number="255"/> + <syscall name="timer_gettime" number="256"/> + <syscall name="timer_getoverrun" number="257"/> + <syscall name="timer_delete" number="258"/> + <syscall name="clock_settime" number="259"/> + <syscall name="clock_gettime" number="260"/> + <syscall name="clock_getres" number="261"/> + <syscall name="clock_nanosleep" number="262"/> + <syscall name="statfs64" number="265" groups="file"/> + <syscall name="fstatfs64" number="266" groups="descriptor"/> + <syscall name="remap_file_pages" number="267" groups="memory"/> + <syscall name="mbind" number="268" groups="memory"/> + <syscall name="get_mempolicy" number="269" groups="memory"/> + <syscall name="set_mempolicy" number="270" groups="memory"/> + <syscall name="mq_open" number="271"/> + <syscall name="mq_unlink" number="272"/> + <syscall name="mq_timedsend" number="273"/> + <syscall name="mq_timedreceive" number="274"/> + <syscall name="mq_notify" number="275"/> + <syscall name="mq_getsetattr" number="276"/> + <syscall name="kexec_load" number="277"/> + <syscall name="add_key" number="278"/> + <syscall name="request_key" number="279"/> + <syscall name="keyctl" number="280"/> + <syscall name="waitid" number="281" groups="process"/> + <syscall name="ioprio_set" number="282"/> + <syscall name="ioprio_get" number="283"/> + <syscall name="inotify_init" number="284" groups="descriptor"/> + <syscall name="inotify_add_watch" number="285" groups="descriptor"/> + <syscall name="inotify_rm_watch" number="286" groups="descriptor"/> + <syscall name="migrate_pages" number="287" groups="memory"/> + <syscall name="openat" number="288" groups="descriptor,file"/> + <syscall name="mkdirat" number="289" groups="descriptor,file"/> + <syscall name="mknodat" number="290" groups="descriptor,file"/> + <syscall name="fchownat" number="291" groups="descriptor,file"/> + <syscall name="futimesat" number="292" groups="descriptor,file"/> + <syscall name="newfstatat" number="293" groups="descriptor,file"/> + <syscall name="unlinkat" number="294" groups="descriptor,file"/> + <syscall name="renameat" number="295" groups="descriptor,file"/> + <syscall name="linkat" number="296" groups="descriptor,file"/> + <syscall name="symlinkat" number="297" groups="descriptor,file"/> + <syscall name="readlinkat" number="298" groups="descriptor,file"/> + <syscall name="fchmodat" number="299" groups="descriptor,file"/> + <syscall name="faccessat" number="300" groups="descriptor,file"/> + <syscall name="pselect6" number="301" groups="descriptor"/> + <syscall name="ppoll" number="302" groups="descriptor"/> + <syscall name="unshare" number="303" groups="process"/> + <syscall name="set_robust_list" number="304"/> + <syscall name="get_robust_list" number="305"/> + <syscall name="splice" number="306" groups="descriptor"/> + <syscall name="sync_file_range" number="307" groups="descriptor"/> + <syscall name="tee" number="308" groups="descriptor"/> + <syscall name="vmsplice" number="309" groups="descriptor"/> + <syscall name="move_pages" number="310" groups="memory"/> + <syscall name="getcpu" number="311"/> + <syscall name="epoll_pwait" number="312" groups="descriptor"/> + <syscall name="utimes" number="313" groups="file"/> + <syscall name="fallocate" number="314" groups="descriptor"/> + <syscall name="utimensat" number="315" groups="descriptor,file"/> + <syscall name="signalfd" number="316" groups="descriptor,signal"/> + <syscall name="timerfd" number="317" groups="descriptor"/> + <syscall name="eventfd" number="318" groups="descriptor"/> + <syscall name="timerfd_create" number="319" groups="descriptor"/> + <syscall name="timerfd_settime" number="320" groups="descriptor"/> + <syscall name="timerfd_gettime" number="321" groups="descriptor"/> + <syscall name="signalfd4" number="322" groups="descriptor,signal"/> + <syscall name="eventfd2" number="323" groups="descriptor"/> + <syscall name="inotify_init1" number="324" groups="descriptor"/> + <syscall name="pipe2" number="325" groups="descriptor"/> + <syscall name="dup3" number="326" groups="descriptor"/> + <syscall name="epoll_create1" number="327" groups="descriptor"/> + <syscall name="rt_tgsigqueueinfo" number="330" groups="process,signal"/> + <syscall name="perf_event_open" number="331" groups="descriptor"/> + <syscall name="fanotify_init" number="332" groups="descriptor"/> + <syscall name="fanotify_mark" number="333" groups="descriptor,file"/> + <syscall name="prlimit64" number="334"/> + <syscall name="name_to_handle_at" number="335" groups="descriptor,file"/> + <syscall name="open_by_handle_at" number="336" groups="descriptor"/> + <syscall name="clock_adjtime" number="337"/> + <syscall name="syncfs" number="338" groups="descriptor"/> + <syscall name="setns" number="339" groups="descriptor"/> + <syscall name="process_vm_readv" number="340"/> + <syscall name="process_vm_writev" number="341"/> + <syscall name="s390_runtime_instr" number="342"/> + <syscall name="kcmp" number="343"/> + <syscall name="finit_module" number="344" groups="descriptor"/> + <syscall name="sched_setattr" number="345"/> + <syscall name="sched_getattr" number="346"/> + <syscall name="renameat2" number="347"/> + <syscall name="seccomp" number="348"/> + <syscall name="getrandom" number="349"/> + <syscall name="memfd_create" number="350"/> + <syscall name="bpf" number="351"/> + <syscall name="s390_pci_mmio_write" number="352"/> + <syscall name="s390_pci_mmio_read" number="353"/> + <syscall name="execveat" number="354"/> + <syscall name="userfaultfd" number="355"/> + <syscall name="membarrier" number="356"/> + <syscall name="recvmmsg" number="357" groups="network"/> + <syscall name="sendmmsg" number="358" groups="network"/> + <syscall name="socket" number="359" groups="network"/> + <syscall name="socketpair" number="360" groups="network"/> + <syscall name="bind" number="361" groups="network"/> + <syscall name="connect" number="362" groups="network"/> + <syscall name="listen" number="363" groups="network"/> + <syscall name="accept4" number="364" groups="network"/> + <syscall name="getsockopt" number="365" groups="network"/> + <syscall name="setsockopt" number="366" groups="network"/> + <syscall name="getsockname" number="367" groups="network"/> + <syscall name="getpeername" number="368" groups="network"/> + <syscall name="sendto" number="369" groups="network"/> + <syscall name="sendmsg" number="370" groups="network"/> + <syscall name="recvfrom" number="371" groups="network"/> + <syscall name="recvmsg" number="372" groups="network"/> + <syscall name="shutdown" number="373" groups="network"/> + <syscall name="mlock2" number="374"/> +</syscalls_info> diff --git a/tools/msys/mingw64/share/gdb/syscalls/sparc-linux.xml b/tools/msys/mingw64/share/gdb/syscalls/sparc-linux.xml new file mode 100644 index 0000000000000000000000000000000000000000..fe833d04ed33213c713b8057602f3c885265a12e --- /dev/null +++ b/tools/msys/mingw64/share/gdb/syscalls/sparc-linux.xml @@ -0,0 +1,341 @@ +<?xml version="1.0"?> +<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd"> +<!-- Copyright (C) 2010-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> +<!-- This file was generated using the following file: + + /usr/src/linux/arch/sparc/include/asm/unistd.h + + The file mentioned above belongs to the Linux Kernel. --> +<syscalls_info> + <syscall name="restart_syscall" number="0"/> + <syscall name="exit" number="1" groups="process"/> + <syscall name="fork" number="2" groups="process"/> + <syscall name="read" number="3" groups="descriptor"/> + <syscall name="write" number="4" groups="descriptor"/> + <syscall name="open" number="5" groups="descriptor,file"/> + <syscall name="close" number="6" groups="descriptor"/> + <syscall name="wait4" number="7" groups="process"/> + <syscall name="creat" number="8" groups="descriptor,file"/> + <syscall name="link" number="9" groups="file"/> + <syscall name="unlink" number="10" groups="file"/> + <syscall name="execv" number="11" groups="file,process"/> + <syscall name="chdir" number="12" groups="file"/> + <syscall name="chown" number="13" groups="file"/> + <syscall name="mknod" number="14" groups="file"/> + <syscall name="chmod" number="15" groups="file"/> + <syscall name="lchown" number="16" groups="file"/> + <syscall name="brk" number="17" groups="memory"/> + <syscall name="perfctr" number="18"/> + <syscall name="lseek" number="19" groups="descriptor"/> + <syscall name="getpid" number="20"/> + <syscall name="capget" number="21"/> + <syscall name="capset" number="22"/> + <syscall name="setuid" number="23"/> + <syscall name="getuid" number="24"/> + <syscall name="vmsplice" number="25" groups="descriptor"/> + <syscall name="ptrace" number="26"/> + <syscall name="alarm" number="27"/> + <syscall name="sigaltstack" number="28" groups="signal"/> + <syscall name="pause" number="29" groups="signal"/> + <syscall name="utime" number="30" groups="file"/> + <syscall name="lchown32" number="31" groups="file"/> + <syscall name="fchown32" number="32" groups="descriptor"/> + <syscall name="access" number="33" groups="file"/> + <syscall name="nice" number="34"/> + <syscall name="chown32" number="35" groups="file"/> + <syscall name="sync" number="36"/> + <syscall name="kill" number="37" groups="signal"/> + <syscall name="stat" number="38" groups="file"/> + <syscall name="sendfile" number="39" groups="descriptor,network"/> + <syscall name="lstat" number="40" groups="file"/> + <syscall name="dup" number="41" groups="descriptor"/> + <syscall name="pipe" number="42" groups="descriptor"/> + <syscall name="times" number="43"/> + <syscall name="getuid32" number="44"/> + <syscall name="umount2" number="45" groups="file"/> + <syscall name="setgid" number="46"/> + <syscall name="getgid" number="47"/> + <syscall name="signal" number="48" groups="signal"/> + <syscall name="geteuid" number="49"/> + <syscall name="getegid" number="50"/> + <syscall name="acct" number="51" groups="file"/> + <syscall name="getgid32" number="53"/> + <syscall name="ioctl" number="54" groups="descriptor"/> + <syscall name="reboot" number="55"/> + <syscall name="mmap2" number="56" groups="descriptor,memory"/> + <syscall name="symlink" number="57" groups="file"/> + <syscall name="readlink" number="58" groups="file"/> + <syscall name="execve" number="59" groups="file,process"/> + <syscall name="umask" number="60"/> + <syscall name="chroot" number="61" groups="file"/> + <syscall name="fstat" number="62" groups="descriptor"/> + <syscall name="fstat64" number="63" groups="descriptor"/> + <syscall name="getpagesize" number="64"/> + <syscall name="msync" number="65" groups="memory"/> + <syscall name="vfork" number="66" groups="process"/> + <syscall name="pread64" number="67" groups="descriptor"/> + <syscall name="pwrite64" number="68" groups="descriptor"/> + <syscall name="geteuid32" number="69"/> + <syscall name="getegid32" number="70"/> + <syscall name="mmap" number="71" groups="descriptor,memory"/> + <syscall name="setreuid32" number="72"/> + <syscall name="munmap" number="73" groups="memory"/> + <syscall name="mprotect" number="74" groups="memory"/> + <syscall name="madvise" number="75" groups="memory"/> + <syscall name="vhangup" number="76"/> + <syscall name="truncate64" number="77" groups="file"/> + <syscall name="mincore" number="78" groups="memory"/> + <syscall name="getgroups" number="79"/> + <syscall name="setgroups" number="80"/> + <syscall name="getpgrp" number="81"/> + <syscall name="setgroups32" number="82"/> + <syscall name="setitimer" number="83"/> + <syscall name="ftruncate64" number="84" groups="descriptor"/> + <syscall name="swapon" number="85" groups="file"/> + <syscall name="getitimer" number="86"/> + <syscall name="setuid32" number="87"/> + <syscall name="sethostname" number="88"/> + <syscall name="setgid32" number="89"/> + <syscall name="dup2" number="90" groups="descriptor"/> + <syscall name="setfsuid32" number="91"/> + <syscall name="fcntl" number="92" groups="descriptor"/> + <syscall name="select" number="93" groups="descriptor"/> + <syscall name="setfsgid32" number="94"/> + <syscall name="fsync" number="95" groups="descriptor"/> + <syscall name="setpriority" number="96"/> + <syscall name="socket" number="97" groups="network"/> + <syscall name="connect" number="98" groups="network"/> + <syscall name="accept" number="99" groups="network"/> + <syscall name="getpriority" number="100"/> + <syscall name="rt_sigreturn" number="101" groups="signal"/> + <syscall name="rt_sigaction" number="102" groups="signal"/> + <syscall name="rt_sigprocmask" number="103" groups="signal"/> + <syscall name="rt_sigpending" number="104" groups="signal"/> + <syscall name="rt_sigtimedwait" number="105" groups="signal"/> + <syscall name="rt_sigqueueinfo" number="106" groups="signal"/> + <syscall name="rt_sigsuspend" number="107" groups="signal"/> + <syscall name="setresuid32" number="108"/> + <syscall name="getresuid32" number="109"/> + <syscall name="setresgid32" number="110"/> + <syscall name="getresgid32" number="111"/> + <syscall name="setregid32" number="112"/> + <syscall name="recvmsg" number="113" groups="network"/> + <syscall name="sendmsg" number="114" groups="network"/> + <syscall name="getgroups32" number="115"/> + <syscall name="gettimeofday" number="116"/> + <syscall name="getrusage" number="117"/> + <syscall name="getsockopt" number="118" groups="network"/> + <syscall name="getcwd" number="119" groups="file"/> + <syscall name="readv" number="120" groups="descriptor"/> + <syscall name="writev" number="121" groups="descriptor"/> + <syscall name="settimeofday" number="122"/> + <syscall name="fchown" number="123" groups="descriptor"/> + <syscall name="fchmod" number="124" groups="descriptor"/> + <syscall name="recvfrom" number="125" groups="network"/> + <syscall name="setreuid" number="126"/> + <syscall name="setregid" number="127"/> + <syscall name="rename" number="128" groups="file"/> + <syscall name="truncate" number="129" groups="file"/> + <syscall name="ftruncate" number="130" groups="descriptor"/> + <syscall name="flock" number="131" groups="descriptor"/> + <syscall name="lstat64" number="132" groups="file"/> + <syscall name="sendto" number="133" groups="network"/> + <syscall name="shutdown" number="134" groups="network"/> + <syscall name="socketpair" number="135" groups="network"/> + <syscall name="mkdir" number="136" groups="file"/> + <syscall name="rmdir" number="137" groups="file"/> + <syscall name="utimes" number="138" groups="file"/> + <syscall name="stat64" number="139" groups="file"/> + <syscall name="sendfile64" number="140" groups="descriptor,network"/> + <syscall name="getpeername" number="141" groups="network"/> + <syscall name="futex" number="142"/> + <syscall name="gettid" number="143"/> + <syscall name="getrlimit" number="144"/> + <syscall name="setrlimit" number="145"/> + <syscall name="pivot_root" number="146" groups="file"/> + <syscall name="prctl" number="147"/> + <syscall name="pciconfig_read" number="148"/> + <syscall name="pciconfig_write" number="149"/> + <syscall name="getsockname" number="150" groups="network"/> + <syscall name="inotify_init" number="151" groups="descriptor"/> + <syscall name="inotify_add_watch" number="152" groups="descriptor"/> + <syscall name="poll" number="153" groups="descriptor"/> + <syscall name="getdents64" number="154" groups="descriptor"/> + <syscall name="fcntl64" number="155" groups="descriptor"/> + <syscall name="inotify_rm_watch" number="156" groups="descriptor"/> + <syscall name="statfs" number="157" groups="file"/> + <syscall name="fstatfs" number="158" groups="descriptor"/> + <syscall name="umount" number="159" groups="file"/> + <syscall name="sched_set_affinity" number="160"/> + <syscall name="sched_get_affinity" number="161"/> + <syscall name="getdomainname" number="162"/> + <syscall name="setdomainname" number="163"/> + <syscall name="quotactl" number="165" groups="file"/> + <syscall name="set_tid_address" number="166"/> + <syscall name="mount" number="167" groups="file"/> + <syscall name="ustat" number="168"/> + <syscall name="setxattr" number="169" groups="file"/> + <syscall name="lsetxattr" number="170" groups="file"/> + <syscall name="fsetxattr" number="171" groups="descriptor"/> + <syscall name="getxattr" number="172" groups="file"/> + <syscall name="lgetxattr" number="173" groups="file"/> + <syscall name="getdents" number="174" groups="descriptor"/> + <syscall name="setsid" number="175"/> + <syscall name="fchdir" number="176" groups="descriptor"/> + <syscall name="fgetxattr" number="177" groups="descriptor"/> + <syscall name="listxattr" number="178" groups="file"/> + <syscall name="llistxattr" number="179" groups="file"/> + <syscall name="flistxattr" number="180" groups="descriptor"/> + <syscall name="removexattr" number="181" groups="file"/> + <syscall name="lremovexattr" number="182" groups="file"/> + <syscall name="sigpending" number="183" groups="signal"/> + <syscall name="query_module" number="184"/> + <syscall name="setpgid" number="185"/> + <syscall name="fremovexattr" number="186" groups="descriptor"/> + <syscall name="tkill" number="187" groups="signal"/> + <syscall name="exit_group" number="188" groups="process"/> + <syscall name="uname" number="189"/> + <syscall name="init_module" number="190"/> + <syscall name="personality" number="191"/> + <syscall name="remap_file_pages" number="192" groups="memory"/> + <syscall name="epoll_create" number="193" groups="descriptor"/> + <syscall name="epoll_ctl" number="194" groups="descriptor"/> + <syscall name="epoll_wait" number="195" groups="descriptor"/> + <syscall name="ioprio_set" number="196"/> + <syscall name="getppid" number="197"/> + <syscall name="sigaction" number="198" groups="signal"/> + <syscall name="sgetmask" number="199" groups="signal"/> + <syscall name="ssetmask" number="200" groups="signal"/> + <syscall name="sigsuspend" number="201" groups="signal"/> + <syscall name="oldlstat" number="202" groups="file"/> + <syscall name="uselib" number="203" groups="file"/> + <syscall name="readdir" number="204" groups="descriptor"/> + <syscall name="readahead" number="205" groups="descriptor"/> + <syscall name="socketcall" number="206" groups="descriptor"/> + <syscall name="syslog" number="207"/> + <syscall name="lookup_dcookie" number="208"/> + <syscall name="fadvise64" number="209" groups="descriptor"/> + <syscall name="fadvise64_64" number="210" groups="descriptor"/> + <syscall name="tgkill" number="211" groups="signal"/> + <syscall name="waitpid" number="212" groups="process"/> + <syscall name="swapoff" number="213" groups="file"/> + <syscall name="sysinfo" number="214"/> + <syscall name="ipc" number="215" groups="ipc"/> + <syscall name="sigreturn" number="216" groups="signal"/> + <syscall name="clone" number="217" groups="process"/> + <syscall name="ioprio_get" number="218"/> + <syscall name="adjtimex" number="219"/> + <syscall name="sigprocmask" number="220" groups="signal"/> + <syscall name="create_module" number="221"/> + <syscall name="delete_module" number="222"/> + <syscall name="get_kernel_syms" number="223"/> + <syscall name="getpgid" number="224"/> + <syscall name="bdflush" number="225"/> + <syscall name="sysfs" number="226"/> + <syscall name="afs_syscall" number="227"/> + <syscall name="setfsuid" number="228"/> + <syscall name="setfsgid" number="229"/> + <syscall name="_newselect" number="230" groups="descriptor"/> + <syscall name="time" number="231"/> + <syscall name="splice" number="232" groups="descriptor"/> + <syscall name="stime" number="233"/> + <syscall name="statfs64" number="234" groups="file"/> + <syscall name="fstatfs64" number="235" groups="descriptor"/> + <syscall name="_llseek" number="236" groups="descriptor"/> + <syscall name="mlock" number="237" groups="memory"/> + <syscall name="munlock" number="238" groups="memory"/> + <syscall name="mlockall" number="239" groups="memory"/> + <syscall name="munlockall" number="240" groups="memory"/> + <syscall name="sched_setparam" number="241"/> + <syscall name="sched_getparam" number="242"/> + <syscall name="sched_setscheduler" number="243"/> + <syscall name="sched_getscheduler" number="244"/> + <syscall name="sched_yield" number="245"/> + <syscall name="sched_get_priority_max" number="246"/> + <syscall name="sched_get_priority_min" number="247"/> + <syscall name="sched_rr_get_interval" number="248"/> + <syscall name="nanosleep" number="249"/> + <syscall name="mremap" number="250" groups="memory"/> + <syscall name="_sysctl" number="251"/> + <syscall name="getsid" number="252"/> + <syscall name="fdatasync" number="253" groups="descriptor"/> + <syscall name="nfsservctl" number="254"/> + <syscall name="sync_file_range" number="255" groups="descriptor"/> + <syscall name="clock_settime" number="256"/> + <syscall name="clock_gettime" number="257"/> + <syscall name="clock_getres" number="258"/> + <syscall name="clock_nanosleep" number="259"/> + <syscall name="sched_getaffinity" number="260"/> + <syscall name="sched_setaffinity" number="261"/> + <syscall name="timer_settime" number="262"/> + <syscall name="timer_gettime" number="263"/> + <syscall name="timer_getoverrun" number="264"/> + <syscall name="timer_delete" number="265"/> + <syscall name="timer_create" number="266"/> + <syscall name="vserver" number="267"/> + <syscall name="io_setup" number="268"/> + <syscall name="io_destroy" number="269"/> + <syscall name="io_submit" number="270"/> + <syscall name="io_cancel" number="271"/> + <syscall name="io_getevents" number="272"/> + <syscall name="mq_open" number="273"/> + <syscall name="mq_unlink" number="274"/> + <syscall name="mq_timedsend" number="275"/> + <syscall name="mq_timedreceive" number="276"/> + <syscall name="mq_notify" number="277"/> + <syscall name="mq_getsetattr" number="278"/> + <syscall name="waitid" number="279" groups="process"/> + <syscall name="tee" number="280" groups="descriptor"/> + <syscall name="add_key" number="281"/> + <syscall name="request_key" number="282"/> + <syscall name="keyctl" number="283"/> + <syscall name="openat" number="284" groups="descriptor,file"/> + <syscall name="mkdirat" number="285" groups="descriptor,file"/> + <syscall name="mknodat" number="286" groups="descriptor,file"/> + <syscall name="fchownat" number="287" groups="descriptor,file"/> + <syscall name="futimesat" number="288" groups="descriptor,file"/> + <syscall name="fstatat64" number="289" groups="descriptor,file"/> + <syscall name="unlinkat" number="290" groups="descriptor,file"/> + <syscall name="renameat" number="291" groups="descriptor,file"/> + <syscall name="linkat" number="292" groups="descriptor,file"/> + <syscall name="symlinkat" number="293" groups="descriptor,file"/> + <syscall name="readlinkat" number="294" groups="descriptor,file"/> + <syscall name="fchmodat" number="295" groups="descriptor,file"/> + <syscall name="faccessat" number="296" groups="descriptor,file"/> + <syscall name="pselect6" number="297" groups="descriptor"/> + <syscall name="ppoll" number="298" groups="descriptor"/> + <syscall name="unshare" number="299" groups="process"/> + <syscall name="set_robust_list" number="300"/> + <syscall name="get_robust_list" number="301"/> + <syscall name="migrate_pages" number="302" groups="memory"/> + <syscall name="mbind" number="303" groups="memory"/> + <syscall name="get_mempolicy" number="304" groups="memory"/> + <syscall name="set_mempolicy" number="305" groups="memory"/> + <syscall name="kexec_load" number="306"/> + <syscall name="move_pages" number="307" groups="memory"/> + <syscall name="getcpu" number="308"/> + <syscall name="epoll_pwait" number="309" groups="descriptor"/> + <syscall name="utimensat" number="310" groups="descriptor,file"/> + <syscall name="signalfd" number="311" groups="descriptor,signal"/> + <syscall name="timerfd_create" number="312" groups="descriptor"/> + <syscall name="eventfd" number="313" groups="descriptor"/> + <syscall name="fallocate" number="314" groups="descriptor"/> + <syscall name="timerfd_settime" number="315" groups="descriptor"/> + <syscall name="timerfd_gettime" number="316" groups="descriptor"/> + <syscall name="signalfd4" number="317" groups="descriptor,signal"/> + <syscall name="eventfd2" number="318" groups="descriptor"/> + <syscall name="epoll_create1" number="319" groups="descriptor"/> + <syscall name="dup3" number="320" groups="descriptor"/> + <syscall name="pipe2" number="321" groups="descriptor"/> + <syscall name="inotify_init1" number="322" groups="descriptor"/> + <syscall name="accept4" number="323" groups="network"/> + <syscall name="preadv" number="324" groups="descriptor"/> + <syscall name="pwritev" number="325" groups="descriptor"/> + <syscall name="rt_tgsigqueueinfo" number="326" groups="process,signal"/> + <syscall name="perf_event_open" number="327" groups="descriptor"/> + <syscall name="recvmmsg" number="328" groups="network"/> +</syscalls_info> diff --git a/tools/msys/mingw64/share/gdb/syscalls/sparc64-linux.xml b/tools/msys/mingw64/share/gdb/syscalls/sparc64-linux.xml new file mode 100644 index 0000000000000000000000000000000000000000..7339dc4dfc5801361085cbeb4479c5738f0413ed --- /dev/null +++ b/tools/msys/mingw64/share/gdb/syscalls/sparc64-linux.xml @@ -0,0 +1,323 @@ +<?xml version="1.0"?> +<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd"> +<!-- Copyright (C) 2010-2020 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> +<!-- This file was generated using the following file: + + /usr/src/linux/arch/sparc/include/asm/unistd.h + + The file mentioned above belongs to the Linux Kernel. --> +<syscalls_info> + <syscall name="restart_syscall" number="0"/> + <syscall name="exit" number="1" groups="process"/> + <syscall name="fork" number="2" groups="process"/> + <syscall name="read" number="3" groups="descriptor"/> + <syscall name="write" number="4" groups="descriptor"/> + <syscall name="open" number="5" groups="descriptor,file"/> + <syscall name="close" number="6" groups="descriptor"/> + <syscall name="wait4" number="7" groups="process"/> + <syscall name="creat" number="8" groups="descriptor,file"/> + <syscall name="link" number="9" groups="file"/> + <syscall name="unlink" number="10" groups="file"/> + <syscall name="execv" number="11" groups="file,process"/> + <syscall name="chdir" number="12" groups="file"/> + <syscall name="chown" number="13" groups="file"/> + <syscall name="mknod" number="14" groups="file"/> + <syscall name="chmod" number="15" groups="file"/> + <syscall name="lchown" number="16" groups="file"/> + <syscall name="brk" number="17" groups="memory"/> + <syscall name="perfctr" number="18"/> + <syscall name="lseek" number="19" groups="descriptor"/> + <syscall name="getpid" number="20"/> + <syscall name="capget" number="21"/> + <syscall name="capset" number="22"/> + <syscall name="setuid" number="23"/> + <syscall name="getuid" number="24"/> + <syscall name="vmsplice" number="25" groups="descriptor"/> + <syscall name="ptrace" number="26"/> + <syscall name="alarm" number="27"/> + <syscall name="sigaltstack" number="28" groups="signal"/> + <syscall name="pause" number="29" groups="signal"/> + <syscall name="utime" number="30" groups="file"/> + <syscall name="access" number="33" groups="file"/> + <syscall name="nice" number="34"/> + <syscall name="sync" number="36"/> + <syscall name="kill" number="37" groups="signal"/> + <syscall name="stat" number="38" groups="file"/> + <syscall name="sendfile" number="39" groups="descriptor,network"/> + <syscall name="lstat" number="40" groups="file"/> + <syscall name="dup" number="41" groups="descriptor"/> + <syscall name="pipe" number="42" groups="descriptor"/> + <syscall name="times" number="43"/> + <syscall name="umount2" number="45" groups="file"/> + <syscall name="setgid" number="46"/> + <syscall name="getgid" number="47"/> + <syscall name="signal" number="48" groups="signal"/> + <syscall name="geteuid" number="49"/> + <syscall name="getegid" number="50"/> + <syscall name="acct" number="51" groups="file"/> + <syscall name="memory_ordering" number="52"/> + <syscall name="ioctl" number="54" groups="descriptor"/> + <syscall name="reboot" number="55"/> + <syscall name="symlink" number="57" groups="file"/> + <syscall name="readlink" number="58" groups="file"/> + <syscall name="execve" number="59" groups="file,process"/> + <syscall name="umask" number="60"/> + <syscall name="chroot" number="61" groups="file"/> + <syscall name="fstat" number="62" groups="descriptor"/> + <syscall name="fstat64" number="63" groups="descriptor"/> + <syscall name="getpagesize" number="64"/> + <syscall name="msync" number="65" groups="memory"/> + <syscall name="vfork" number="66" groups="process"/> + <syscall name="pread64" number="67" groups="descriptor"/> + <syscall name="pwrite64" number="68" groups="descriptor"/> + <syscall name="mmap" number="71" groups="descriptor,memory"/> + <syscall name="munmap" number="73" groups="memory"/> + <syscall name="mprotect" number="74" groups="memory"/> + <syscall name="madvise" number="75" groups="memory"/> + <syscall name="vhangup" number="76"/> + <syscall name="mincore" number="78" groups="memory"/> + <syscall name="getgroups" number="79"/> + <syscall name="setgroups" number="80"/> + <syscall name="getpgrp" number="81"/> + <syscall name="setitimer" number="83"/> + <syscall name="swapon" number="85" groups="file"/> + <syscall name="getitimer" number="86"/> + <syscall name="sethostname" number="88"/> + <syscall name="dup2" number="90" groups="descriptor"/> + <syscall name="fcntl" number="92" groups="descriptor"/> + <syscall name="select" number="93" groups="descriptor"/> + <syscall name="fsync" number="95" groups="descriptor"/> + <syscall name="setpriority" number="96"/> + <syscall name="socket" number="97" groups="network"/> + <syscall name="connect" number="98" groups="network"/> + <syscall name="accept" number="99" groups="network"/> + <syscall name="getpriority" number="100"/> + <syscall name="rt_sigreturn" number="101" groups="signal"/> + <syscall name="rt_sigaction" number="102" groups="signal"/> + <syscall name="rt_sigprocmask" number="103" groups="signal"/> + <syscall name="rt_sigpending" number="104" groups="signal"/> + <syscall name="rt_sigtimedwait" number="105" groups="signal"/> + <syscall name="rt_sigqueueinfo" number="106" groups="signal"/> + <syscall name="rt_sigsuspend" number="107" groups="signal"/> + <syscall name="setresuid" number="108"/> + <syscall name="getresuid" number="109"/> + <syscall name="setresgid" number="110"/> + <syscall name="getresgid" number="111"/> + <syscall name="recvmsg" number="113" groups="network"/> + <syscall name="sendmsg" number="114" groups="network"/> + <syscall name="gettimeofday" number="116"/> + <syscall name="getrusage" number="117"/> + <syscall name="getsockopt" number="118" groups="network"/> + <syscall name="getcwd" number="119" groups="file"/> + <syscall name="readv" number="120" groups="descriptor"/> + <syscall name="writev" number="121" groups="descriptor"/> + <syscall name="settimeofday" number="122"/> + <syscall name="fchown" number="123" groups="descriptor"/> + <syscall name="fchmod" number="124" groups="descriptor"/> + <syscall name="recvfrom" number="125" groups="network"/> + <syscall name="setreuid" number="126"/> + <syscall name="setregid" number="127"/> + <syscall name="rename" number="128" groups="file"/> + <syscall name="truncate" number="129" groups="file"/> + <syscall name="ftruncate" number="130" groups="descriptor"/> + <syscall name="flock" number="131" groups="descriptor"/> + <syscall name="lstat64" number="132" groups="file"/> + <syscall name="sendto" number="133" groups="network"/> + <syscall name="shutdown" number="134" groups="network"/> + <syscall name="socketpair" number="135" groups="network"/> + <syscall name="mkdir" number="136" groups="file"/> + <syscall name="rmdir" number="137" groups="file"/> + <syscall name="utimes" number="138" groups="file"/> + <syscall name="stat64" number="139" groups="file"/> + <syscall name="sendfile64" number="140" groups="descriptor,network"/> + <syscall name="getpeername" number="141" groups="network"/> + <syscall name="futex" number="142"/> + <syscall name="gettid" number="143"/> + <syscall name="getrlimit" number="144"/> + <syscall name="setrlimit" number="145"/> + <syscall name="pivot_root" number="146" groups="file"/> + <syscall name="prctl" number="147"/> + <syscall name="pciconfig_read" number="148"/> + <syscall name="pciconfig_write" number="149"/> + <syscall name="getsockname" number="150" groups="network"/> + <syscall name="inotify_init" number="151" groups="descriptor"/> + <syscall name="inotify_add_watch" number="152" groups="descriptor"/> + <syscall name="poll" number="153" groups="descriptor"/> + <syscall name="getdents64" number="154" groups="descriptor"/> + <syscall name="inotify_rm_watch" number="156" groups="descriptor"/> + <syscall name="statfs" number="157" groups="file"/> + <syscall name="fstatfs" number="158" groups="descriptor"/> + <syscall name="umount" number="159" groups="file"/> + <syscall name="sched_set_affinity" number="160"/> + <syscall name="sched_get_affinity" number="161"/> + <syscall name="getdomainname" number="162"/> + <syscall name="setdomainname" number="163"/> + <syscall name="utrap_install" number="164"/> + <syscall name="quotactl" number="165" groups="file"/> + <syscall name="set_tid_address" number="166"/> + <syscall name="mount" number="167" groups="file"/> + <syscall name="ustat" number="168"/> + <syscall name="setxattr" number="169" groups="file"/> + <syscall name="lsetxattr" number="170" groups="file"/> + <syscall name="fsetxattr" number="171" groups="descriptor"/> + <syscall name="getxattr" number="172" groups="file"/> + <syscall name="lgetxattr" number="173" groups="file"/> + <syscall name="getdents" number="174" groups="descriptor"/> + <syscall name="setsid" number="175"/> + <syscall name="fchdir" number="176" groups="descriptor"/> + <syscall name="fgetxattr" number="177" groups="descriptor"/> + <syscall name="listxattr" number="178" groups="file"/> + <syscall name="llistxattr" number="179" groups="file"/> + <syscall name="flistxattr" number="180" groups="descriptor"/> + <syscall name="removexattr" number="181" groups="file"/> + <syscall name="lremovexattr" number="182" groups="file"/> + <syscall name="sigpending" number="183" groups="signal"/> + <syscall name="query_module" number="184"/> + <syscall name="setpgid" number="185"/> + <syscall name="fremovexattr" number="186" groups="descriptor"/> + <syscall name="tkill" number="187" groups="signal"/> + <syscall name="exit_group" number="188" groups="process"/> + <syscall name="uname" number="189"/> + <syscall name="init_module" number="190"/> + <syscall name="personality" number="191"/> + <syscall name="remap_file_pages" number="192" groups="memory"/> + <syscall name="epoll_create" number="193" groups="descriptor"/> + <syscall name="epoll_ctl" number="194" groups="descriptor"/> + <syscall name="epoll_wait" number="195" groups="descriptor"/> + <syscall name="ioprio_set" number="196"/> + <syscall name="getppid" number="197"/> + <syscall name="sigaction" number="198" groups="signal"/> + <syscall name="sgetmask" number="199" groups="signal"/> + <syscall name="ssetmask" number="200" groups="signal"/> + <syscall name="sigsuspend" number="201" groups="signal"/> + <syscall name="oldlstat" number="202" groups="file"/> + <syscall name="uselib" number="203" groups="file"/> + <syscall name="readdir" number="204" groups="descriptor"/> + <syscall name="readahead" number="205" groups="descriptor"/> + <syscall name="socketcall" number="206" groups="descriptor"/> + <syscall name="syslog" number="207"/> + <syscall name="lookup_dcookie" number="208"/> + <syscall name="fadvise64" number="209" groups="descriptor"/> + <syscall name="fadvise64_64" number="210" groups="descriptor"/> + <syscall name="tgkill" number="211" groups="signal"/> + <syscall name="waitpid" number="212" groups="process"/> + <syscall name="swapoff" number="213" groups="file"/> + <syscall name="sysinfo" number="214"/> + <syscall name="ipc" number="215" groups="ipc"/> + <syscall name="sigreturn" number="216" groups="signal"/> + <syscall name="clone" number="217" groups="process"/> + <syscall name="ioprio_get" number="218"/> + <syscall name="adjtimex" number="219"/> + <syscall name="sigprocmask" number="220" groups="signal"/> + <syscall name="create_module" number="221"/> + <syscall name="delete_module" number="222"/> + <syscall name="get_kernel_syms" number="223"/> + <syscall name="getpgid" number="224"/> + <syscall name="bdflush" number="225"/> + <syscall name="sysfs" number="226"/> + <syscall name="afs_syscall" number="227"/> + <syscall name="setfsuid" number="228"/> + <syscall name="setfsgid" number="229"/> + <syscall name="_newselect" number="230" groups="descriptor"/> + <syscall name="splice" number="232" groups="descriptor"/> + <syscall name="stime" number="233"/> + <syscall name="statfs64" number="234" groups="file"/> + <syscall name="fstatfs64" number="235" groups="descriptor"/> + <syscall name="_llseek" number="236" groups="descriptor"/> + <syscall name="mlock" number="237" groups="memory"/> + <syscall name="munlock" number="238" groups="memory"/> + <syscall name="mlockall" number="239" groups="memory"/> + <syscall name="munlockall" number="240" groups="memory"/> + <syscall name="sched_setparam" number="241"/> + <syscall name="sched_getparam" number="242"/> + <syscall name="sched_setscheduler" number="243"/> + <syscall name="sched_getscheduler" number="244"/> + <syscall name="sched_yield" number="245"/> + <syscall name="sched_get_priority_max" number="246"/> + <syscall name="sched_get_priority_min" number="247"/> + <syscall name="sched_rr_get_interval" number="248"/> + <syscall name="nanosleep" number="249"/> + <syscall name="mremap" number="250" groups="memory"/> + <syscall name="_sysctl" number="251"/> + <syscall name="getsid" number="252"/> + <syscall name="fdatasync" number="253" groups="descriptor"/> + <syscall name="nfsservctl" number="254"/> + <syscall name="sync_file_range" number="255" groups="descriptor"/> + <syscall name="clock_settime" number="256"/> + <syscall name="clock_gettime" number="257"/> + <syscall name="clock_getres" number="258"/> + <syscall name="clock_nanosleep" number="259"/> + <syscall name="sched_getaffinity" number="260"/> + <syscall name="sched_setaffinity" number="261"/> + <syscall name="timer_settime" number="262"/> + <syscall name="timer_gettime" number="263"/> + <syscall name="timer_getoverrun" number="264"/> + <syscall name="timer_delete" number="265"/> + <syscall name="timer_create" number="266"/> + <syscall name="vserver" number="267"/> + <syscall name="io_setup" number="268"/> + <syscall name="io_destroy" number="269"/> + <syscall name="io_submit" number="270"/> + <syscall name="io_cancel" number="271"/> + <syscall name="io_getevents" number="272"/> + <syscall name="mq_open" number="273"/> + <syscall name="mq_unlink" number="274"/> + <syscall name="mq_timedsend" number="275"/> + <syscall name="mq_timedreceive" number="276"/> + <syscall name="mq_notify" number="277"/> + <syscall name="mq_getsetattr" number="278"/> + <syscall name="waitid" number="279" groups="process"/> + <syscall name="tee" number="280" groups="descriptor"/> + <syscall name="add_key" number="281"/> + <syscall name="request_key" number="282"/> + <syscall name="keyctl" number="283"/> + <syscall name="openat" number="284" groups="descriptor,file"/> + <syscall name="mkdirat" number="285" groups="descriptor,file"/> + <syscall name="mknodat" number="286" groups="descriptor,file"/> + <syscall name="fchownat" number="287" groups="descriptor,file"/> + <syscall name="futimesat" number="288" groups="descriptor,file"/> + <syscall name="fstatat64" number="289" groups="descriptor,file"/> + <syscall name="unlinkat" number="290" groups="descriptor,file"/> + <syscall name="renameat" number="291" groups="descriptor,file"/> + <syscall name="linkat" number="292" groups="descriptor,file"/> + <syscall name="symlinkat" number="293" groups="descriptor,file"/> + <syscall name="readlinkat" number="294" groups="descriptor,file"/> + <syscall name="fchmodat" number="295" groups="descriptor,file"/> + <syscall name="faccessat" number="296" groups="descriptor,file"/> + <syscall name="pselect6" number="297" groups="descriptor"/> + <syscall name="ppoll" number="298" groups="descriptor"/> + <syscall name="unshare" number="299" groups="process"/> + <syscall name="set_robust_list" number="300"/> + <syscall name="get_robust_list" number="301"/> + <syscall name="migrate_pages" number="302" groups="memory"/> + <syscall name="mbind" number="303" groups="memory"/> + <syscall name="get_mempolicy" number="304" groups="memory"/> + <syscall name="set_mempolicy" number="305" groups="memory"/> + <syscall name="kexec_load" number="306"/> + <syscall name="move_pages" number="307" groups="memory"/> + <syscall name="getcpu" number="308"/> + <syscall name="epoll_pwait" number="309" groups="descriptor"/> + <syscall name="utimensat" number="310" groups="descriptor,file"/> + <syscall name="signalfd" number="311" groups="descriptor,signal"/> + <syscall name="timerfd_create" number="312" groups="descriptor"/> + <syscall name="eventfd" number="313" groups="descriptor"/> + <syscall name="fallocate" number="314" groups="descriptor"/> + <syscall name="timerfd_settime" number="315" groups="descriptor"/> + <syscall name="timerfd_gettime" number="316" groups="descriptor"/> + <syscall name="signalfd4" number="317" groups="descriptor,signal"/> + <syscall name="eventfd2" number="318" groups="descriptor"/> + <syscall name="epoll_create1" number="319" groups="descriptor"/> + <syscall name="dup3" number="320" groups="descriptor"/> + <syscall name="pipe2" number="321" groups="descriptor"/> + <syscall name="inotify_init1" number="322" groups="descriptor"/> + <syscall name="accept4" number="323" groups="network"/> + <syscall name="preadv" number="324" groups="descriptor"/> + <syscall name="pwritev" number="325" groups="descriptor"/> + <syscall name="rt_tgsigqueueinfo" number="326" groups="process,signal"/> + <syscall name="perf_event_open" number="327" groups="descriptor"/> + <syscall name="recvmmsg" number="328" groups="network"/> +</syscalls_info> diff --git a/tools/msys/mingw64/share/gdb/system-gdbinit/elinos.py b/tools/msys/mingw64/share/gdb/system-gdbinit/elinos.py new file mode 100644 index 0000000000000000000000000000000000000000..c2b351c6ef5fb2e818ad27d90a3bf5aa72c1a11a --- /dev/null +++ b/tools/msys/mingw64/share/gdb/system-gdbinit/elinos.py @@ -0,0 +1,91 @@ +# Copyright (C) 2011-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""Configure GDB using the ELinOS environment.""" + +import os +import glob +import gdb + + +def warn(msg): + print "warning: %s" % msg + + +def get_elinos_environment(): + """Return the ELinOS environment. + + If the ELinOS environment is properly set up, return a dictionary + which contains: + * The path to the ELinOS project at key 'project'; + * The path to the ELinOS CDK at key 'cdk'; + * The ELinOS target name at key 'target' (Eg. 'i486-linux'); + * A list of Xenomai install prefixes (which could be empty, if + the ELinOS project does not include Xenomai) at key 'xenomai'. + + If one of these cannot be found, print a warning; the corresponding + value in the returned dictionary will be None. + """ + result = {} + for key in ("project", "cdk", "target"): + var = "ELINOS_" + key.upper() + if var in os.environ: + result[key] = os.environ[var] + else: + warn("%s not set" % var) + result[key] = None + + if result["project"] is not None: + result["xenomai"] = glob.glob(result["project"] + "/xenomai-[0-9.]*") + else: + result["xenomai"] = [] + + return result + + +def elinos_init(): + """Initialize debugger environment for ELinOS. + + Let the debugger know where to find the ELinOS libraries on host. This + assumes that an ELinOS environment is properly set up. If some environment + variables are missing, warn about which library may be missing. + """ + elinos_env = get_elinos_environment() + + solib_dirs = [] + + # System libraries + if None in (elinos_env[key] for key in ("cdk", "target")): + warn("ELinOS system libraries will not be loaded") + else: + solib_prefix = "%s/%s" % (elinos_env["cdk"], elinos_env["target"]) + solib_dirs += ["%s/%s" % (solib_prefix, "lib")] + gdb.execute("set solib-absolute-prefix %s" % solib_prefix) + + # Xenomai libraries. Those are optional, so have a lighter warning + # if they cannot be located. + if elinos_env["project"] is None: + warn("Xenomai libraries may not be loaded") + else: + for dir in elinos_env['xenomai']: + solib_dirs += ["%s/%s" + % (dir, "xenomai-build/usr/realtime/lib")] + + if len(solib_dirs) != 0: + gdb.execute("set solib-search-path %s" % ":".join(solib_dirs)) + + +if __name__ == "__main__": + elinos_init() diff --git a/tools/msys/mingw64/share/gdb/system-gdbinit/wrs-linux.py b/tools/msys/mingw64/share/gdb/system-gdbinit/wrs-linux.py new file mode 100644 index 0000000000000000000000000000000000000000..be56e8d1f257d0755e01bb9bcbd982dd55e4d49f --- /dev/null +++ b/tools/msys/mingw64/share/gdb/system-gdbinit/wrs-linux.py @@ -0,0 +1,25 @@ +# Copyright (C) 2011-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""Configure GDB using the WRS/Linux environment.""" + +import os + +if 'ENV_PREFIX' in os.environ: + gdb.execute('set sysroot %s' % os.environ['ENV_PREFIX']) + +else: + print "warning: ENV_PREFIX environment variable missing." + print "The debugger will probably be unable to find the correct system libraries" diff --git a/tools/msys/mingw64/share/locale/da/LC_MESSAGES/bfd.mo b/tools/msys/mingw64/share/locale/da/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..ca9e50c80efbadfd1ca90169ed04492a8db1a8f6 Binary files /dev/null and b/tools/msys/mingw64/share/locale/da/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw64/share/locale/da/LC_MESSAGES/opcodes.mo b/tools/msys/mingw64/share/locale/da/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..a2fae8ba6dd42b6a970cca4cc30a6006e3376082 Binary files /dev/null and b/tools/msys/mingw64/share/locale/da/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw64/share/locale/de/LC_MESSAGES/opcodes.mo b/tools/msys/mingw64/share/locale/de/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..2e71a14bc0fddae9e3e3a41f46c78b99611f4e3e Binary files /dev/null and b/tools/msys/mingw64/share/locale/de/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw64/share/locale/es/LC_MESSAGES/bfd.mo b/tools/msys/mingw64/share/locale/es/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..b667be50934126a9ecd35d0e6c14b560a01ee9ae Binary files /dev/null and b/tools/msys/mingw64/share/locale/es/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw64/share/locale/es/LC_MESSAGES/opcodes.mo b/tools/msys/mingw64/share/locale/es/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..99390ecac76fb7be9a539eb1f260c4c5573b5c16 Binary files /dev/null and b/tools/msys/mingw64/share/locale/es/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw64/share/locale/fi/LC_MESSAGES/bfd.mo b/tools/msys/mingw64/share/locale/fi/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..ded62c4608232870612a65c200ec869ade93c0dc Binary files /dev/null and b/tools/msys/mingw64/share/locale/fi/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw64/share/locale/fi/LC_MESSAGES/opcodes.mo b/tools/msys/mingw64/share/locale/fi/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..8c9f5d4a91749f9e1c2d4bc7d2431530291ebc4e Binary files /dev/null and b/tools/msys/mingw64/share/locale/fi/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw64/share/locale/fr/LC_MESSAGES/bfd.mo b/tools/msys/mingw64/share/locale/fr/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..74b002c31be6c3166651fe89f4dda3db9959f617 Binary files /dev/null and b/tools/msys/mingw64/share/locale/fr/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw64/share/locale/fr/LC_MESSAGES/opcodes.mo b/tools/msys/mingw64/share/locale/fr/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..f86ad78c75b1adfebcfb96f14c8dfd5ec6796475 Binary files /dev/null and b/tools/msys/mingw64/share/locale/fr/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw64/share/locale/ga/LC_MESSAGES/opcodes.mo b/tools/msys/mingw64/share/locale/ga/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..d1468449ac30fbd69a5273439f3ac816f82cf165 Binary files /dev/null and b/tools/msys/mingw64/share/locale/ga/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw64/share/locale/hr/LC_MESSAGES/bfd.mo b/tools/msys/mingw64/share/locale/hr/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..a29732ff51ca9f58f0c0647f9ffbfbd189b15482 Binary files /dev/null and b/tools/msys/mingw64/share/locale/hr/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw64/share/locale/id/LC_MESSAGES/bfd.mo b/tools/msys/mingw64/share/locale/id/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..957b28b17bfb696d9ef78154aa498336e662413b Binary files /dev/null and b/tools/msys/mingw64/share/locale/id/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw64/share/locale/id/LC_MESSAGES/opcodes.mo b/tools/msys/mingw64/share/locale/id/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..84ad41447246ac082d6bf52d808ccb6c7a04808e Binary files /dev/null and b/tools/msys/mingw64/share/locale/id/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw64/share/locale/it/LC_MESSAGES/opcodes.mo b/tools/msys/mingw64/share/locale/it/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..5fd99126405632c704b2fedcc669579601f75411 Binary files /dev/null and b/tools/msys/mingw64/share/locale/it/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw64/share/locale/ja/LC_MESSAGES/bfd.mo b/tools/msys/mingw64/share/locale/ja/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..108faf71e34da570b560aabafc2d6f6eb86d7055 Binary files /dev/null and b/tools/msys/mingw64/share/locale/ja/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw64/share/locale/nl/LC_MESSAGES/opcodes.mo b/tools/msys/mingw64/share/locale/nl/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..4d181ff82b793259d4e5cef2a1e0a7a49b42f9d9 Binary files /dev/null and b/tools/msys/mingw64/share/locale/nl/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw64/share/locale/pt/LC_MESSAGES/bfd.mo b/tools/msys/mingw64/share/locale/pt/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..f30a640bcdba8c890994c4796961947975d97585 Binary files /dev/null and b/tools/msys/mingw64/share/locale/pt/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw64/share/locale/pt_BR/LC_MESSAGES/opcodes.mo b/tools/msys/mingw64/share/locale/pt_BR/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..83106a4f38b1541bd995fd80c6f90bbbdd493c1d Binary files /dev/null and b/tools/msys/mingw64/share/locale/pt_BR/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw64/share/locale/ro/LC_MESSAGES/bfd.mo b/tools/msys/mingw64/share/locale/ro/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..2706ea70f97e2a347090342182320c3bb879201f Binary files /dev/null and b/tools/msys/mingw64/share/locale/ro/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw64/share/locale/ro/LC_MESSAGES/opcodes.mo b/tools/msys/mingw64/share/locale/ro/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..0aa0bd0a0582f782f2d8911f697962cebc2e2b9a Binary files /dev/null and b/tools/msys/mingw64/share/locale/ro/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw64/share/locale/ru/LC_MESSAGES/bfd.mo b/tools/msys/mingw64/share/locale/ru/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..52d11f5035d07cd8239a575d7d17d371aed4e9a5 Binary files /dev/null and b/tools/msys/mingw64/share/locale/ru/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw64/share/locale/rw/LC_MESSAGES/bfd.mo b/tools/msys/mingw64/share/locale/rw/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..a24c3be14db7f028dc80269dd11893fd81098cbb Binary files /dev/null and b/tools/msys/mingw64/share/locale/rw/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw64/share/locale/sr/LC_MESSAGES/bfd.mo b/tools/msys/mingw64/share/locale/sr/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..c0b7db079e4d5931fa295c5afdf73e169f17b32f Binary files /dev/null and b/tools/msys/mingw64/share/locale/sr/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw64/share/locale/sr/LC_MESSAGES/opcodes.mo b/tools/msys/mingw64/share/locale/sr/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..49551889070fa4c8c0c2358a5da79ff411bc3a94 Binary files /dev/null and b/tools/msys/mingw64/share/locale/sr/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw64/share/locale/sv/LC_MESSAGES/bfd.mo b/tools/msys/mingw64/share/locale/sv/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..8a97087ac37d5c530d5b174e9d53304e0c63a99b Binary files /dev/null and b/tools/msys/mingw64/share/locale/sv/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw64/share/locale/sv/LC_MESSAGES/opcodes.mo b/tools/msys/mingw64/share/locale/sv/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..8905f173cbf0a3dca214e0811ad65e2b00585e91 Binary files /dev/null and b/tools/msys/mingw64/share/locale/sv/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw64/share/locale/tr/LC_MESSAGES/bfd.mo b/tools/msys/mingw64/share/locale/tr/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..3a0480589789b92142e0d0e1bf874d5f22256e9a Binary files /dev/null and b/tools/msys/mingw64/share/locale/tr/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw64/share/locale/tr/LC_MESSAGES/opcodes.mo b/tools/msys/mingw64/share/locale/tr/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..9578276fc907bd8d7d7c5673600f4a1209d96546 Binary files /dev/null and b/tools/msys/mingw64/share/locale/tr/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw64/share/locale/uk/LC_MESSAGES/bfd.mo b/tools/msys/mingw64/share/locale/uk/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..048400a85b9e5f6a6d27a02084ecff43833ac922 Binary files /dev/null and b/tools/msys/mingw64/share/locale/uk/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw64/share/locale/uk/LC_MESSAGES/opcodes.mo b/tools/msys/mingw64/share/locale/uk/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..c2dba6e93d92aafb61a640a018f00f37da0605f6 Binary files /dev/null and b/tools/msys/mingw64/share/locale/uk/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw64/share/locale/vi/LC_MESSAGES/bfd.mo b/tools/msys/mingw64/share/locale/vi/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..315d95d9b6e8afd6344d50590e111add67cb89be Binary files /dev/null and b/tools/msys/mingw64/share/locale/vi/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw64/share/locale/vi/LC_MESSAGES/opcodes.mo b/tools/msys/mingw64/share/locale/vi/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..f8520c515e1b4d329d7fb2d25b604358ed1e9cfa Binary files /dev/null and b/tools/msys/mingw64/share/locale/vi/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw64/share/locale/zh_CN/LC_MESSAGES/bfd.mo b/tools/msys/mingw64/share/locale/zh_CN/LC_MESSAGES/bfd.mo new file mode 100644 index 0000000000000000000000000000000000000000..f6e4119f16f471d669155830022e118f37519d11 Binary files /dev/null and b/tools/msys/mingw64/share/locale/zh_CN/LC_MESSAGES/bfd.mo differ diff --git a/tools/msys/mingw64/share/locale/zh_CN/LC_MESSAGES/opcodes.mo b/tools/msys/mingw64/share/locale/zh_CN/LC_MESSAGES/opcodes.mo new file mode 100644 index 0000000000000000000000000000000000000000..05114f2e14ca514077796d8a5c15f3c380b7e71b Binary files /dev/null and b/tools/msys/mingw64/share/locale/zh_CN/LC_MESSAGES/opcodes.mo differ diff --git a/tools/msys/mingw64/share/man/man1/xxhsum.1.gz b/tools/msys/mingw64/share/man/man1/xxhsum.1.gz new file mode 100644 index 0000000000000000000000000000000000000000..691077a170988b6bb5a8289c6939a25d783692ac Binary files /dev/null and b/tools/msys/mingw64/share/man/man1/xxhsum.1.gz differ diff --git a/tools/msys/var/log/pacman.log b/tools/msys/var/log/pacman.log index e6ac8a11b2686766911aad70d513bc3e50dda729..c62887ce69038cfbda91d1e95ed67aee35e9b013 100644 --- a/tools/msys/var/log/pacman.log +++ b/tools/msys/var/log/pacman.log @@ -2284,3 +2284,10 @@ [2020-10-28T01:40:21+0100] [ALPM] installed mingw-w64-i686-tools-git (9.0.0.6029.ecb4ff54-1) [2020-10-28T01:40:21+0100] [ALPM] installed mingw-w64-x86_64-tools-git (9.0.0.6029.ecb4ff54-1) [2020-10-28T01:40:21+0100] [ALPM] transaction completed +[2020-10-29T19:09:34+0100] [PACMAN] Running 'pacman -S mingw-w64-i686-gdb mingw-w64-x86_64-gdb' +[2020-10-29T19:09:59+0100] [ALPM] transaction started +[2020-10-29T19:09:59+0100] [ALPM] installed mingw-w64-i686-xxhash (0.8.0-1) +[2020-10-29T19:10:00+0100] [ALPM] installed mingw-w64-i686-gdb (9.2-4) +[2020-10-29T19:10:00+0100] [ALPM] installed mingw-w64-x86_64-xxhash (0.8.0-1) +[2020-10-29T19:10:01+0100] [ALPM] installed mingw-w64-x86_64-gdb (9.2-4) +[2020-10-29T19:10:01+0100] [ALPM] transaction completed