Beispiel #1
0
        ulong GetPseudoLocationId(int processId, string imageName, Address?address, string label)
        {
            var   location = new Location(processId, imageName, address, label);
            ulong locationId;

            if (!locations.TryGetValue(location, out locationId))
            {
                locationId = nextLocationId++;
                locations.Add(location, locationId);

                var locationProto = new pb.Location();
                locationProto.Id = locationId;

                var line = new pb.Line();
                line.FunctionId = GetFunctionId(imageName, label);
                locationProto.Line.Add(line);

                profile.Location.Add(locationProto);
            }
            return(locationId);
        }
Beispiel #2
0
        ulong GetLocationId(IStackSymbol stackSymbol)
        {
            var processId       = stackSymbol.Image?.ProcessId ?? 0;
            var imageName       = stackSymbol.Image?.FileName;
            var imagePath       = stackSymbol.Image?.Path ?? "<unknown>";
            var functionAddress = stackSymbol.AddressRange.BaseAddress;
            var functionName    = stackSymbol.FunctionName;

            var location = new Location(processId, imagePath, functionAddress, functionName);

            ulong locationId;

            if (!locations.TryGetValue(location, out locationId))
            {
                locationId = nextLocationId++;
                locations.Add(location, locationId);

                var locationProto = new pb.Location();
                locationProto.Id = locationId;

                pb.Line line;
                if (includeInlinedFunctions && stackSymbol.InlinedFunctionNames != null)
                {
                    foreach (var inlineFunctionName in stackSymbol.InlinedFunctionNames)
                    {
                        line            = new pb.Line();
                        line.FunctionId = GetFunctionId(imageName, inlineFunctionName);
                        locationProto.Line.Add(line);
                    }
                }
                line            = new pb.Line();
                line.FunctionId = GetFunctionId(imageName, functionName, stackSymbol.SourceFileName);
                line.Line_      = stackSymbol.SourceLineNumber;
                locationProto.Line.Add(line);

                profile.Location.Add(locationProto);
            }
            return(locationId);
        }