Commit graph

75 commits

Author SHA1 Message Date
Markus Armbruster 3277400723
qapi: Move qapi-schema.json to qapi/, rename generated files
Move qapi-schema.json to qapi/, so it's next to its modules, and all
files get generated to qapi/, not just the ones generated for modules.

Consistently name the generated files qapi-MODULE.EXT:
qmp-commands.[ch] become qapi-commands.[ch], qapi-event.[ch] become
qapi-events.[ch], and qmp-introspect.[ch] become qapi-introspect.[ch].
This gets rid of the temporary hacks in scripts/qapi/commands.py,
scripts/qapi/events.py, and scripts/qapi/common.py.

Backports commit eb815e248f50cde9ab86eddd57eca5019b71ca78 from qemu
2018-03-09 11:35:11 -05:00
Markus Armbruster 311d659acf
qapi: Empty out qapi-schema.json
The previous commit improved compile time by including less of the
generated QAPI headers. This is impossible for stuff defined directly
in qapi-schema.json, because that ends up in headers that that pull in
everything.

Move everything but include directives from qapi-schema.json to new
sub-module qapi/misc.json, then include just the "misc" shard where
possible.

It's possible everywhere, except:

* monitor.c needs qmp-command.h to get qmp_init_marshal()

* monitor.c, ui/vnc.c and the generated qapi-event-FOO.c need
qapi-event.h to get enum QAPIEvent

Perhaps we'll get rid of those some other day.

Adding a type to qapi/migration.json now recompiles some 120 instead
of 2300 out of 5100 objects.

Backports commit 112ed241f5d9a411dbca92bdf597151cb853c6a7 from qemu
2018-03-09 10:23:27 -05:00
Markus Armbruster 5500a5e912
Include less of the generated modular QAPI headers
In my "build everything" tree, a change to the types in
qapi-schema.json triggers a recompile of about 4800 out of 5100
objects.

The previous commit split up qmp-commands.h, qmp-event.h, qmp-visit.h,
qapi-types.h. Each of these headers still includes all its shards.
Reduce compile time by including just the shards we actually need.

To illustrate the benefits: adding a type to qapi/migration.json now
recompiles some 2300 instead of 4800 objects. The next commit will
improve it further.

Backports commit 9af2398977a78d37bf184d6ff6bd04c72bfbf006 from qemu
2018-03-09 10:06:19 -05:00
Markus Armbruster 1fb1d31a1f
qapi/types qapi/visit: Generate built-in stuff into separate files
Linking code from multiple separate QAPI schemata into the same
program is possible, but involves some weirdness around built-in
types:

* We generate code for built-in types into .c only with option
--builtins. The user is responsible for generating code for exactly
one QAPI schema per program with --builtins.

* We generate code for built-in types into .h regardless of
--builtins, but guarded by #ifndef QAPI_VISIT_BUILTIN. Because all
copies of this code are exactly the same, including any combination
of these headers works.

Replace this contraption by something more conventional: generate code
for built-in types into their very own files: qapi-builtin-types.c,
qapi-builtin-visit.c, qapi-builtin-types.h, qapi-builtin-visit.h, but
only with --builtins. Obey --output-dir, but ignore --prefix for
them.

Make qapi-types.h include qapi-builtin-types.h. With multiple
schemata you now have multiple qapi-types.[ch], but only one
qapi-builtin-types.[ch]. Same for qapi-visit.[ch] and
qapi-builtin-visit.[ch].

Bonus: if all you need is built-in stuff, you can include a much
smaller header. To be exploited shortly.

Backports commit cdb6610ae4283720037bae2af1f78bd40eb5fe71 from qemu
2018-03-09 09:25:59 -05:00
Markus Armbruster 8c51980332
qapi-gen: New common driver for code and doc generators
Whenever qapi-schema.json changes, we run six programs eleven times to
update eleven files. Similar for qga/qapi-schema.json. This is
silly. Replace the six programs by a single program that spits out
all eleven files.

The programs become modules in new Python package qapi, along with the
helper library. This requires moving them to scripts/qapi/. While
moving them, consistently drop executable mode bits.

Backports commit fb0bc835e56b894cbc7236294921e5393c786ad8 from qemu
2018-03-09 08:47:12 -05:00
zhangwm 2e973a13f0 arm64eb: add support for ARM64 big endian. 2017-04-24 23:30:01 +08:00
Nguyen Anh Quynh dcccab5a75 msvc: initial support for armeb. also add i386 support (FIXME) 2017-04-21 01:20:12 +08:00
Nguyen Anh Quynh fabe682d87 update .gitignore 2017-01-23 21:54:48 +08:00
xorstream c8d1287e10 gitignore seems to have an undisclosed conflict?! fixed here. 2017-01-23 01:13:13 +11:00
xorstream 724c765028 Merging with current msvc 2 2017-01-23 01:07:50 +11:00
xorstream 37ac0efcea Added prebuild_script.bat to remove leftover configure generated files before building.
Also added project files and MSVC copies of configure generated files for all supported CPUs.
2017-01-22 01:17:36 +11:00
xorstream 8840d5b42b Save copies of generated qapi files. 2017-01-21 00:30:50 +11:00
Andrew Dutcher bf2cd79a4d Windows: export a static lib that can be used outside of mingw (#699)
* Windows: export a static lib that can be used outside of mingw

* Add comments to windows_export.bat
2016-12-27 16:30:07 +08:00
Stephen bc08bfda67 Unit testing in CI (#651)
- in appveyor, install clang and cmake in cygwin, enable package upgrades, and build cmocka and enable testing for gcc only
- in `gitignore`, ignore generated cmocka folder
- in travis, use brew in osx to install cmocka, and enable testing for gcc and clang on os x and linux
- in `Makefile`, change to use `uname -s` to determine os type
- make `install-cmocka-linux.sh`, a simple shell script to download and install cmocka on linux
- in `bindings/Makefile`, enable `make -c` to call subdirectory makefiles instead of `cd [dir] && make` and include environment variables for runtime access to generated libraries
- in `samples/Makefile`, change to use `uname -s` to determine os type, remove `clean_bins` from `all` command, and include `Werror` for compile strictness
- in `tests/unit/Makefile`, add `cflags` for compile time access to cmocka headers and library, include execute vars for runtime access to cmocka and unicorn libs
- in `tests/unit/test_tb_x86.c`, comment out assert that would not compile
2016-10-22 00:21:10 +08:00
Andrew Dutcher ac99b5bd14 Minor tweaks to python setup process; update gitignore 2016-09-12 14:06:50 -07:00
Nguyen Anh Quynh d92b37ed7d cleanup .gitignore 2016-06-16 09:29:16 +08:00
Nguyen Anh Quynh 65bef683d3 regress: more flexible .gitignore 2016-06-16 09:27:47 +08:00
Nguyen Anh Quynh 0e0a1ca786 samples: more flexible .gitignore 2016-06-16 09:23:00 +08:00
Nguyen Anh Quynh 6193be73b7 tests: more flexible .gitignore for tests/unit/ 2016-06-16 09:14:32 +08:00
Nguyen Anh Quynh 4084a385c2 regress: add mem_64_c.c from issue #523 by Chris Eagle 2016-04-24 22:53:30 +08:00
Nguyen Anh Quynh cc6cbc5cf7 Merge branch 'memleak' into m2 2016-04-18 12:48:13 +08:00
practicalswift 06a64dc3b0 Add six crash cases (2 * ARM + 4 * M68K)
* 001-bad_condition_code_0xe.c (ARM)
* 002-qemu__fatal__unimplemented_control_register_write_0xffb___0x0.c (M68K)
* 003-qemu__fatal__wdebug_not_implemented.c (M68K)
* 004-segmentation_fault_1.c (ARM)
* 005-qemu__fatal__illegal_instruction__0000___00000404.c (M68K)
* 006-qemu__fatal__illegal_instruction__0421___00040026.c (M68K)

```
$ ./001-bad_condition_code_0xe # ARM
uc_emu_start(…)
Bad condition code 0xe
Aborted

$ ./002-qemu__fatal__unimplemented_control_register_write_0xffb___0x0 # M68K
uc_emu_start(…)
hook_code(…) called
qemu: fatal: Unimplemented control register write 0xffb = 0x0

Aborted

$ ./003-qemu__fatal__wdebug_not_implemented # M68K
uc_emu_start(…)
qemu: fatal: WDEBUG not implemented
Aborted

$ ./004-segmentation_fault_1 # ARM
uc_emu_start(…)
hook_code(…) called
Segmentation fault

$ ./005-qemu__fatal__illegal_instruction__0000___00000404 # M68K
uc_emu_start(…)
qemu: fatal: Illegal instruction: 0000 @ 00000404
Aborted

$ ./006-qemu__fatal__illegal_instruction__0421___00040026 # M68K
uc_emu_start(…)
hook_code(…) called
qemu: fatal: Illegal instruction: 0421 @ 00040026
Aborted
```
2016-04-09 15:27:20 -04:00
Nguyen Anh Quynh f2c99bc80e update .gitignore 2016-04-06 09:48:14 +08:00
egberts 881360d60f Issue #465 - Added test_hookcounts to .gitignore 2016-03-16 11:01:59 -07:00
Nguyen Anh Quynh fb1ebac000 Merge branch 'master' into m1 2016-03-09 15:13:42 +08:00
Nguyen Anh Quynh 2f28f3f210 unit: make test_x86_soft_paging.c compilable. also update .gitignore for its binary 2016-02-22 14:01:00 +08:00
Nguyen Anh Quynh b69feb8d0b Merge branch 'master' into memleak2 2016-02-15 15:52:10 +08:00
Nguyen Anh Quynh 9b6d1bf324 regress: fix compilation warning for mem_fuzz.c 2016-02-05 08:54:52 +08:00
Nguyen Anh Quynh 20b01a6933 fix merge conflict 2016-02-01 12:08:38 +08:00
Nguyen Anh Quynh 5a04bcb115 allow to change PC during callback. this solves issue #210 2016-01-28 14:06:17 +08:00
Nguyen Anh Quynh 9c2017e115 update .gitignore 2016-01-23 17:08:40 +08:00
Nguyen Anh Quynh 3a8ad6f944 java: add .class & .jar files to .gitignore 2016-01-12 01:03:44 +08:00
Nguyen Anh Quynh 7de48f2f75 regress: add emu_clear_errors to .gitignore 2016-01-12 01:02:45 +08:00
Nguyen Anh Quynh 2a269acac1 regress: add memleak_xxx.c to test memleak issue 2016-01-10 23:56:14 +08:00
Nguyen Anh Quynh b3ebd1b7cb Merge branch 'master' of https://github.com/iroiro123/unicorn into iroiro123-master 2016-01-01 14:01:39 +08:00
Spl3en c9f6648877 Add sysenter_hook_x86 to tests/regress/Makefile and sysenter_hook_x86 to .gitignore. 2015-12-24 18:25:35 +01:00
farmdve 784b8066e2 Add test for pre-instruction hook being called more times. 2015-12-22 12:33:36 +02:00
Hiroyuki Uekawa 6445c80b29 Build for Cygwin 2015-12-20 22:00:35 +09:00
xorstream 7c1297662c Added test for MIPS branch likely instructions. 2015-12-20 16:07:54 +11:00
xorstream 7877f72a92 Added emu_stop_in_hook_overrun to gitignore 2015-12-20 15:11:01 +11:00
Nguyen Anh Quynh f509423cfa update .gitignore 2015-12-17 08:13:39 +08:00
Nguyen Anh Quynh 7b73a298c1 update .gitignore 2015-12-16 23:00:42 +08:00
xorstream f111d7d1ca Added support for building tests from MinGW. 2015-12-16 12:59:30 +11:00
univm 845392de1e Test for stack hooking. 2015-12-12 00:48:46 +02:00
Nguyen Anh Quynh 9b6701dc4d update .gitignore 2015-12-12 01:39:59 +08:00
Nguyen Anh Quynh 613d60119e update .gitignore 2015-12-11 22:26:05 +08:00
farmdve 0d98607121 Unmapped memory is not freed.
While uc_mem_unmap does unmap memory regions from Unicorn, it does not
free the memory. It accumulates over time when reusing a single Unicorn
instance.
2015-12-10 00:08:07 +02:00
xorstream c5c13e110a Added samples projects for MSVC binding.
Added MSVC support to unicorn samples.
2015-12-08 18:21:32 +11:00
xorstream 77f946f2fc Added MSVC++ support for unicorn
This lets you import the pre-built unicorn.dll files with Microsoft
Visual C++ projects.

There is support for static and dynamic linking of dlls. This has been
tested as working for both 32bit and 64bit versions.

The dynamic linking code should also work in Linux, though I have not
tested it.
2015-12-04 22:09:24 +11:00
practicalswift 31e32d1734 Crash case: Jump to invalid address (0x0), sparc32 2015-12-02 21:55:13 +01:00