1+ # -*- coding: utf-8 -*-
12#
2- # Copyright (c) 2019 nexB Inc. and others. All rights reserved.
3- # http://nexb.com and https://github.com/nexB/scancode-toolkit/
4- # The ScanCode software is licensed under the Apache License version 2.0.
5- # Data generated with ScanCode require an acknowledgment.
3+ # Copyright (c) nexB Inc. and others. All rights reserved.
64# ScanCode is a trademark of nexB Inc.
5+ # SPDX-License-Identifier: Apache-2.0
6+ # See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
7+ # See https://github.com/nexB/scancode-plugins for support or download.
8+ # See https://aboutcode.org for more information about nexB OSS projects.
79#
8- # You may not use this software except in compliance with the License.
9- # You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
10- # Unless required by applicable law or agreed to in writing, software distributed
11- # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12- # CONDITIONS OF ANY KIND, either express or implied. See the License for the
13- # specific language governing permissions and limitations under the License.
14- #
15- # When you publish or redistribute any data created with ScanCode or any ScanCode
16- # derivative work, you must accompany this data with the following acknowledgment:
17- #
18- # Generated with ScanCode and provided on an "AS IS" BASIS, WITHOUT WARRANTIES
19- # OR CONDITIONS OF ANY KIND, either express or implied. No content created from
20- # ScanCode should be considered or used as legal advice. Consult an Attorney
21- # for any legal advice.
22- # ScanCode is a free software code scanning tool from nexB Inc. and others.
23- # Visit https://github.com/nexB/scancode-toolkit/ for support and download.
24-
25- from __future__ import absolute_import
26- from __future__ import unicode_literals
2710
2811import os
2912
3922from commoncode .cliutils import SCAN_GROUP
4023from typecode import contenttype
4124
42- from dwarf import dwarf
43- from dwarf import dwarf2
25+ from compiledcode .dwarf import dwarf
26+ from compiledcode .dwarf import dwarf2
27+ from compiledcode .dwarf import dwarfng
4428
4529
4630@scan_impl
@@ -49,15 +33,17 @@ class DwarfScanner(ScanPlugin):
4933 Scan a dwarf infos for URLs.
5034 """
5135 resource_attributes = dict (
52- dwarf_source_path = attr .ib (default = attr .Factory (list ), repr = False ))
36+ dwarf_source_path = attr .ib (default = attr .Factory (list ), repr = False )
37+ )
5338
5439 options = [
5540 PluggableCommandLineOption (('--dwarf' ,),
5641 is_flag = True , default = False ,
5742 help = 'Collect source code path from compilation units found in '
5843 'ELF DWARFs.' ,
5944 help_group = SCAN_GROUP ,
60- sort_order = 100 ),
45+ sort_order = 100
46+ ),
6147 ]
6248
6349 def is_enabled (self , dwarf , ** kwargs ):
@@ -72,7 +58,17 @@ def get_dwarfs(location, **kwargs):
7258 Return a mapping with original_source_files and included_source_files or None.
7359 """
7460 return dict (
75- dwarf_source_path = list (dwarf_source_path (location )))
61+ # dwarf_source_path=list(dwarf_source_path(location))
62+ dwarf_source_path = list (dwarf_source_path_ng (location ))
63+ )
64+
65+
66+ def dwarf_source_path_ng (location , ** kwargs ):
67+ """
68+ Collect unique paths to compiled source code found in Elf binaries DWARF
69+ sections for D2D.
70+ """
71+ return dwarfng .get_dwarf_cu_and_die_paths (location )
7672
7773
7874def dwarf_source_path (location ):
@@ -120,8 +116,6 @@ def get_dwarf1(location):
120116 # std and original path as separate annotations
121117 for p in d .original_source_files + d .included_source_files :
122118 yield p
123-
124-
125119
126120
127121def get_dwarf2 (location ):
0 commit comments