@@ -1952,6 +1952,8 @@ uint32_t SymbolFileDWARF::ResolveSymbolContext(
1952
1952
const SourceLocationSpec &src_location_spec,
1953
1953
SymbolContextItem resolve_scope, SymbolContextList &sc_list) {
1954
1954
std::lock_guard<std::recursive_mutex> guard (GetModuleMutex ());
1955
+ const FileSpec &file_spec = src_location_spec.GetFileSpec ();
1956
+ const uint32_t line = src_location_spec.GetLine ().getValueOr (0 );
1955
1957
const bool check_inlines = src_location_spec.GetCheckInlines ();
1956
1958
const uint32_t prev_size = sc_list.GetSize ();
1957
1959
if (resolve_scope & eSymbolContextCompUnit) {
@@ -1964,7 +1966,71 @@ uint32_t SymbolFileDWARF::ResolveSymbolContext(
1964
1966
bool file_spec_matches_cu_file_spec = FileSpec::Match (
1965
1967
src_location_spec.GetFileSpec (), dc_cu->GetPrimaryFile ());
1966
1968
if (check_inlines || file_spec_matches_cu_file_spec) {
1967
- dc_cu->ResolveSymbolContext (src_location_spec, resolve_scope, sc_list);
1969
+ SymbolContext sc (m_objfile_sp->GetModule ());
1970
+ sc.comp_unit = dc_cu;
1971
+ uint32_t file_idx = UINT32_MAX;
1972
+
1973
+ // If we are looking for inline functions only and we don't find it
1974
+ // in the support files, we are done.
1975
+ if (check_inlines) {
1976
+ file_idx =
1977
+ sc.comp_unit ->GetSupportFiles ().FindFileIndex (1 , file_spec, true );
1978
+ if (file_idx == UINT32_MAX)
1979
+ continue ;
1980
+ }
1981
+
1982
+ if (line != 0 ) {
1983
+ LineTable *line_table = sc.comp_unit ->GetLineTable ();
1984
+
1985
+ if (line_table != nullptr && line != 0 ) {
1986
+ // We will have already looked up the file index if we are
1987
+ // searching for inline entries.
1988
+ if (!check_inlines)
1989
+ file_idx = sc.comp_unit ->GetSupportFiles ().FindFileIndex (
1990
+ 1 , file_spec, true );
1991
+
1992
+ if (file_idx != UINT32_MAX) {
1993
+ uint32_t found_line;
1994
+ uint16_t found_column;
1995
+ uint32_t line_idx = line_table->FindLineEntryIndexByFileIndex (
1996
+ 0 , file_idx, src_location_spec, &sc.line_entry );
1997
+ found_line = sc.line_entry .line ;
1998
+ found_column - sc.line_entry .column ;
1999
+
2000
+ while (line_idx != UINT32_MAX) {
2001
+ sc.function = nullptr ;
2002
+ sc.block = nullptr ;
2003
+ if (resolve_scope &
2004
+ (eSymbolContextFunction | eSymbolContextBlock)) {
2005
+ const lldb::addr_t file_vm_addr =
2006
+ sc.line_entry .range .GetBaseAddress ().GetFileAddress ();
2007
+ if (file_vm_addr != LLDB_INVALID_ADDRESS) {
2008
+ ResolveFunctionAndBlock (
2009
+ file_vm_addr, resolve_scope & eSymbolContextBlock, sc);
2010
+ }
2011
+ }
2012
+
2013
+ SourceLocationSpec found_location_spec (
2014
+ file_spec, found_line, found_column,
2015
+ /* check_inlines=*/ false , /* exact=*/ true ) sc_list.Append (sc);
2016
+ line_idx = line_table->FindLineEntryIndexByFileIndex (
2017
+ line_idx + 1 , file_idx, found_location_spec,
2018
+ &sc.line_entry );
2019
+ }
2020
+ }
2021
+ } else if (file_spec_matches_cu_file_spec && !check_inlines) {
2022
+ // only append the context if we aren't looking for inline call
2023
+ // sites by file and line and if the file spec matches that of
2024
+ // the compile unit
2025
+ sc_list.Append (sc);
2026
+ }
2027
+ } else if (file_spec_matches_cu_file_spec && !check_inlines) {
2028
+ // only append the context if we aren't looking for inline call
2029
+ // sites by file and line and if the file spec matches that of
2030
+ // the compile unit
2031
+ sc_list.Append (sc);
2032
+ }
2033
+
1968
2034
if (!check_inlines)
1969
2035
break ;
1970
2036
}
0 commit comments