12 Commits

Author SHA1 Message Date
Ben Clayton
773f0dff68 Add support for fuzzing cppdap
Add build rules, scripts, basic corpus, and dictionary.
Currently requires recent clang toolchain.
2020-06-05 10:53:52 +01:00
Ben Clayton
cc93ba9747 Add the ability to derive message types from one another.
`DAP_IMPLEMENT_STRUCT_TYPEINFO_EXT` and `DAP_STRUCT_TYPEINFO_EXT` are two new flavors of `DAP_IMPLEMENT_STRUCT_TYPEINFO` and `DAP_STRUCT_TYPEINFO` that allow you to derive message types.

This involved a bit of reworking on the serializer interfaces.

Added test.

Issue: #32
2020-06-02 17:18:32 +01:00
Ben Clayton
4bc690cba8 Update DAP protocol to Version 1.40
Updated with:
 `go run scripts/protocol_gen/protocol_gen.go`
2020-05-05 13:03:20 +01:00
Ben Clayton
c4358807e2 Fix new gcc 9 'deprecated-copy' warning.
Example warning:

cppdap/include/dap/future.h:172:14: error: implicitly-declared ‘dap::ResponseOrError<dap::StackTraceResponse>& dap::ResponseOrError<dap::StackTraceResponse>::operator=(const dap::ResponseOrError<dap::StackTraceResponse>&)’ is deprecated [-Werror=deprecated-copy]

Add missing constructors and assignment operators.
This probably adds more than is absolutely necessary, but there's no
harm in being thorough.
2020-02-06 13:37:41 +00:00
Ben Clayton
9a9d46f6b6 Fix bad usage of std::move
Issue #16 describes the problem and solution perfectly.

Updated tests to cover this.

Fixes #16
2020-01-24 15:21:26 +00:00
Ben Clayton
4abe43c131 optional: Remove the value() method that returns non-const-ref.
I'm not convinced that `opt.value() = foo` is a desirable pattern,
and worse still it confuses some compilers about which overload to
use.

Just remove it.
2020-01-24 07:25:33 +00:00
Ben Clayton
cdc19ac4d9 Serialization: Correctly encode structs with no fields
Empty structs were being serialized as `null`, when they should have been serialized as `{}`.

This was due to the type inference on the serializer - where no calls to `field()` would result in the default `null` type.

To solve this, the `serialize(const void* object, const std::initializer_list<Field>&)` inline helper has been promoted to a virtual function (and renamed to `fields()`).
The JSON serializer implementation of this now first sets the object type to `object`, even if there are no fields to serialize.

Added test for this.

Fixes: #10
2020-01-06 15:00:24 +00:00
kuafuwang
73d697eac4 Fix Response type info, make response 'body' field optional
The `body` field of the Response is optional. Do not error if it is missing.

If the typeinfo of the response. This was incorrectly using the Request type.

Authored by kuafuwang, squashed by ben-clayton.
2019-12-31 20:58:33 +00:00
Ben Clayton
eab43f3518 net::Server: Fix onError parameter default.
The onError parameter of Server::start was default initialized with
OnError(), which is an 'invalid target', not a no-op implementation.

Replace with a true no-op implementation.
2019-12-05 15:12:56 +00:00
Ben Clayton
44d158805c Reimplement std::future and std::promise to workaround TSAN false positives 2019-11-14 08:10:16 +00:00
Ben Clayton
d13d4a4151 GCC build fixes 2019-11-14 00:29:38 +00:00
Ben Clayton
2dfd15462f Initial drop of cppdap 2019-11-08 21:58:50 +00:00