Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature bluetooth traces #14198

Merged
merged 20 commits into from
Mar 22, 2021
Merged

Feature bluetooth traces #14198

merged 20 commits into from
Mar 22, 2021

Conversation

pan-
Copy link
Member

@pan- pan- commented Jan 27, 2021

Summary of changes

Addition of traces to the whole BLE stack. This work has been conducted to help debugging of Bluetooth application.

Documentation

Mbed OS documentation has been amended to explain how tracing can be enabled.


Pull request type

[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[x] No Tests required for this change (E.g docs only update)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers

@paul-szczepanek-arm @noonfom

@pan-
Copy link
Member Author

pan- commented Jan 27, 2021

@adbridge Could you review d914fe0 ? I added a recommendation to join traces in issues related to connectivity.

@ciarmcom ciarmcom added the release-type: patch Indentifies a PR as containing just a patch label Jan 27, 2021
@ciarmcom ciarmcom requested review from a team January 27, 2021 15:00
@ciarmcom
Copy link
Member

@pan-, thank you for your changes.
@ARMmbed/mbed-os-connectivity @ARMmbed/mbed-os-maintainers please review.

Copy link
Member

@paul-szczepanek-arm paul-szczepanek-arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am assuming there's not errors in the code you moved, this is not going in this week due to release so before we merge this branch we should run the test-suite to make sure we didn't break it horribly

@paul-szczepanek-arm
Copy link
Member

handbook PR: ARMmbed/mbed-os-5-docs#1397

return string_buffer[idx];
}

const char *to_string(bool v)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick question for my own personal C/C++ culture :

Compatibility issues with the existing code and bigger memory footprint put aside, would it be okay to use std::string instead of C-style string? Would a std::string_view with C++17 work as well? What are the pros and cons?

Something like:

const std::string to_string(bool v)
{
    if (v) {
        return "true";
    } else {
        return "false";
    }
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::string implies memory allocation of the string buffer. That is something we want to avoid; especially for constant data. std::string_view would be a better but in this case there is two issues:

  • It is part of C++17 while Mbed uses C++ 14.
  • Mbed trace does not understand string_view so we would have to use the data() member function everywhere.

In the end, these helpers don't return non const or uninitialized memory and their output target mbed_trace. I think it is the right thing to use const char*.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the detailed answer! After posting, I did some experiment and using std::string_view vs cont char* uses the exact same memory footprint. Of course as you pointed out, you'll need the data() member function everywhere you need to pass a C-string, printf() will be okay but you'll get a compiler warning.

I'm wondering if in the code that we write and control, we should use the C-string style or move to std::string_view to keep up with the nice features. The data() function is not that bad and would only be used where we interface with mbed or legacy code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We take these decision depending on the benefits and expectations from the user base. The helpers in this PR are internal to the BLE code base and not exposed to our users. They are not meant to be manipulated, return constant value and just meant to be fed into a tr_ trace. In that context, I'm not seeing much benefit for my team to recreate a C++14 version of string_view which main benefit is to be a compatible replacement for std::string and use it just for internal purposes.

On the other hand, when it make sense for the users we don't hesitate to back port standard APIs. For example, mbed::Span was present in mbed OS even before standardization because it just make sense to avoid carrying around the size associated to an array.

@ciarmcom ciarmcom added the stale Stale Pull Request label Feb 1, 2021
@ciarmcom
Copy link
Member

ciarmcom commented Feb 1, 2021

This pull request has automatically been marked as stale because it has had no recent activity. @noonfom, @ARMmbed/mbed-os-maintainers, please complete review of the changes to move the PR forward. Thank you for your contributions.

@mergify mergify bot dismissed paul-szczepanek-arm’s stale review February 1, 2021 16:01

Pull request has been modified.

@ciarmcom ciarmcom removed the stale Stale Pull Request label Feb 1, 2021
@pan-
Copy link
Member Author

pan- commented Feb 2, 2021

@0xc0170 I think the PR is good to go now, is it possible to start CI ?

@paul-szczepanek-arm @noonfom Can you confirm with an additional review ?

Copy link
Member

@paul-szczepanek-arm paul-szczepanek-arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested.

@mergify mergify bot added needs: CI and removed needs: review labels Feb 2, 2021
@mergify mergify bot added needs: work and removed needs: CI labels Feb 3, 2021
@mergify
Copy link

mergify bot commented Feb 3, 2021

This PR cannot be merged due to conflicts. Please rebase to resolve them.

@pan-
Copy link
Member Author

pan- commented Feb 9, 2021

Rebased.

@0xc0170 Do you expect anything more from this PR ?

@mergify mergify bot dismissed paul-szczepanek-arm’s stale review February 9, 2021 16:29

Pull request has been modified.

0xc0170
0xc0170 previously approved these changes Feb 10, 2021
@mergify mergify bot dismissed 0xc0170’s stale review March 15, 2021 15:37

Pull request has been modified.

@paul-szczepanek-arm paul-szczepanek-arm added needs: CI and removed needs: work stale Stale Pull Request labels Mar 15, 2021
@0xc0170
Copy link
Contributor

0xc0170 commented Mar 18, 2021

CI started

@mergify mergify bot added needs: work and removed needs: CI labels Mar 18, 2021
@mbed-ci
Copy link

mbed-ci commented Mar 18, 2021

Jenkins CI Test : ❌ FAILED

Build Number: 2 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-ARM
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️

@mergify mergify bot dismissed paul-szczepanek-arm’s stale review March 18, 2021 11:29

Pull request has been modified.

@paul-szczepanek-arm
Copy link
Member

Fixed cmake, tested build. Ready for rerun.

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 18, 2021

CI started

@mbed-ci
Copy link

mbed-ci commented Mar 18, 2021

Jenkins CI Test : ✔️ SUCCESS

Build Number: 3 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_cmake-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-test ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️

@0xc0170 0xc0170 merged commit 1fdb1c1 into master Mar 22, 2021
@0xc0170 0xc0170 deleted the feature-bluetooth-traces branch March 22, 2021 09:59
@mergify mergify bot removed the ready for merge label Mar 22, 2021
@mbedmain mbedmain removed release-type: patch Indentifies a PR as containing just a patch Release-pending labels Apr 26, 2021
AGlass0fMilk added a commit to AGlass0fMilk/mbed-os that referenced this pull request May 19, 2021
This commit introduces changes to fix a missing method, `as_entry`, and traces that were not updated properly to work with this new method.

Prior to this fix, it was not possible to use KVStoreSecurityDb as the build would fail since the `as_entry` method was not declared in the class header file.

This bug was introduced with commit 957486e in PR ARMmbed#14198
MubeenHCLite pushed a commit to MubeenHCLite/mbed-os that referenced this pull request Jun 14, 2021
This commit introduces changes to fix a missing method, `as_entry`, and traces that were not updated properly to work with this new method.

Prior to this fix, it was not possible to use KVStoreSecurityDb as the build would fail since the `as_entry` method was not declared in the class header file.

This bug was introduced with commit 957486e in PR ARMmbed#14198
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants