Skip to content

Line records before symbol address in some cases #535

@mstange

Description

@mstange

It looks like bad debug info can make dump_syms create line records in a function which start before the function address. There is an example in this XUL.sym:

FUNC m 7503d0 94 0 mozilla::storage::Variant_base::Release()
[...]
750458 4 93 459
75045c 8 800 461
FUNC m 750464 8 0 mozilla::storage::NullVariant::GetDataType()
75045c c 800 461
750468 4 0 461
FUNC m 75046c c 0 mozilla::storage::Variant_base::GetAsJSVal(JS::MutableHandle<JS::Value>)
[...]

Here, the line record 75045c c 800 461 shows up twice. And it shows up in GetDataType() even though GetDataType() only starts at 0x750464, which is 8 bytes after 0x75045c.

This causes the symbolication API to return the wrong symbol and negative function offsets.

curl 'https://symbolication.services.mozilla.com/symbolicate/v5' -X POST --data-raw '{"jobs":[{"memoryMap":[["XUL","6117E38C063A30B0BC7B5A0A21F82B0F0"]],"stacks":[[[0,7668831]]]}]}' | jq .
{
  "results": [
    {
      "stacks": [
        [
          {
            "frame": 0,
            "module": "XUL",
            "module_offset": "0x75045f",
            "function": "mozilla::storage::NullVariant::GetDataType()",
            "function_offset": "-0x5",
            "file": "hg:hg.mozilla.org/mozilla-central:mfbt/Span.h:60b4965aa0ca5a7a60c71229600092a65df8bc1d",
            "line": 800
          }
        ]
      ],
      "found_modules": {
        "XUL/6117E38C063A30B0BC7B5A0A21F82B0F0": true
      }
    }
  ]
}

"function_offset": "-0x5" is not good.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions