Coder Social home page Coder Social logo

Comments (5)

namhyung avatar namhyung commented on September 13, 2024

In Itanium C++ ABI (which is the basis of the linux C++ ABI):

3.1.4 Return Values

In general, C++ return values are handled just like C return values. This includes class type results returned in registers. However, if the return value type has a non-trivial copy constructor or destructor, the caller allocates space for a temporary, and passes a pointer to the temporary as an implicit first parameter preceding both the this parameter and user parameters. The callee constructs the return value into this temporary.

https://refspecs.linuxfoundation.org/cxxabi-1.86.html#calls

from uftrace.

honggyukim avatar honggyukim commented on September 13, 2024

Hi @namhyung , thanks for the specific answer. But my concern is that if it's possible to know whether I have to give -A bar@arg1 or -A bar@arg2 for such function to print the first argument.

from uftrace.

namhyung avatar namhyung commented on September 13, 2024

I think it should be handled in uftrace if it knows about the debug info. But I don't know how much info would be provided from the debuginfo.

from uftrace.

honggyukim avatar honggyukim commented on September 13, 2024

So it seems that it's not possible to handle this case as of now. Debuginfo support may be required to fix this in the future.

from uftrace.

namhyung avatar namhyung commented on September 13, 2024

With gcc 8.1 and -O2 option, it can find the correct argument of bar from the debug info. (foo was optimized out). But it still gets an incorrect value when -O0.

$ g++ -O2 -g -pg test.cc

$ uftrace -A bar -R bar a.out
# DURATION    TID     FUNCTION
            [  3345] | main() {
  15.967 us [  3345] |   bar(10) = 0x7ffd64b2f410;
   1.777 us [  3345] |   operator delete();
  23.460 us [  3345] | } /* main */

from uftrace.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.