Third-party shared packages can be classified into two types: Harmony Archive (HAR) and Harmony Shared Package (HSP). The source code debugging methods for these two types of packages are different.
HAR packages are categorized into bytecode HARs and source code HARs. A HAR package is a bytecode HAR if it meets both of the following conditions. Otherwise, it is a source code HAR. For more guidance on building source code HAR and bytecode HAR, see Building HAR.

If the HAP/HSP references a bytecode HAR package that contains C++ code, perform the following steps to debug the HAR package:
To generate the .so file with debugging information, add the strip field to the project- or module-level build-profile.json5 file and set it to false. For details, see Configuring for C++ Builds.

settings set -- target.source-map {old-path} {new-path} 

If a bytecode HAR package is compiled in debug mode in Project A (HAR package project), and Project B (host project) references this bytecode HAR package with local access to the source code of the HAR package. To debug this bytecode HAR, there are two methods: debugging in the host project or debugging in the HAR package project.
The bytecode HARs compiled in release mode do not support debugging.

// oh-package.json5 of the demo host module
"dependencies": {
"@ohos/test_stage_ets_library": "file:./lib/test_stage_ets_library.har",
}
If dependencies on the bytecode HAR module, for example, file:../test_stage_ets_library, are configured in the oh-package.json5 file of the demo host module, breakpoints may be invalid during debugging.




If both Symbol Directories and ArkTS Source Pairs are configured in the HAR package project, ArkTS code and C++ breakpoints can be debugged at the same time in attach mode.
If the HAP/HSP references a source code HAR package and the HAR package contains C++ code, perform debugging by referring to Debugging the Bytecode HAR.
If a project references a source code HAR package, debug this HAR package. The debugging methods vary depending on whether there is local source code.


To debug the HSP source code, place the source code in the local project module and debug it by referring to Method 1: Debugging in the host project.