objdump -C interfering with --disassemble=<symbol>

80 Views Asked by At

Here is a simple cpp file:

#include <iostream>

void test(int x)
{
  std::cout << "x is " << x << std::endl;
}

int main()
{
  test(5);

  return 0;
}

After compiling with g++, suppose I want to use objdump to show the disassembly only of the test function (not main):

objdump a.out --disassemble="_Z4testi"

This works. Now, suppose I want to demangle the resulting output using -C:

objdump a.out -C --disassemble="_Z4testi"

The resulting disassembly is empty. How come?

Note: I know that c++filt can be used to accomplish this, but I would like to know why -C isn't working.

objdump a.out --disassemble="_Z4testi" | c++filt

g++ (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0

GNU objdump (GNU Binutils for Ubuntu) 2.38

0

There are 0 best solutions below