Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] strange issue with GDB MI interface with pretty prints

Simon,

I filed a bug on the gdb bug tracker, so you can actually get the attachment from there:
https://sourceware.org/bugzilla/show_bug.cgi?id=17437

About your question, there may be two reasons. First, GDB cannot evaluate function calls for inlined functions. To make sure the function is not inlined I define it outside the class declaration, e.g.

struct BaseStruct {
  BaseStruct() {
     x = 1;
  }
  int x;
  int func();
};

int BaseStruct::func() {
    return x+x;
}

Also use flag -O0 when compiling. So this is the second reason. Your SystemC library has to be built in debug mode (when you configure it, you can select it there), otherwise the function might be inlined while optimized by compiler.

Hope that helps,
Andrey

-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Simon Marchi
Sent: Friday, September 26, 2014 1:15 PM
To: cdt-dev@xxxxxxxxxxx
Subject: Re: [cdt-dev] strange issue with GDB MI interface with pretty prints

On 2014-09-26 04:06 PM, Ayupov, Andrey wrote:
> I was able to create a small/synthetic example that shows the issue. It is attached.
> It contains:
> compile  - two commands to build main.cpp gdb_bug_test  - executable 
> if you happen to be able to run (built on suse11 64 bit), otherwise 
> build using compile gdb_bug_test_pretty_print.cmd  - pretty print script
> main.cpp   - source
> mi.cmd - MI commands that would make it crash. They use relative paths so it should just run out of the box. 
> Can you please see if you can reproduce it? I am planning to file a ticket on gdb next.
> 
> Some thoughts. I think the fact that the class for which I create a pretty print actually calls a method to the base class makes a difference. If I create a pretty print for the base class then it seems to work. Maybe I can change my pretty print to do that for now, although it will require user to do an extra click and see extra unnecessary fields from the derived class.
> 
> Thanks,
> Andrey

Your attachment was eaten by the evil corporate antivirus on my side, so I can't access it. Also, I can find it on the list archive, I guess it was rejected because of the attachment as well.

I suggest you send a pastebin or a Github gist (I like gists because you can put multiple files in a single gist).

On a sidenote, when I try to do "print my_int.to_string()" in gdb (where my_int is a sc_dt::sc_biguint), gdb tells me it can't find to_string. I have "std::cout << my_int.to_string() << std::endl" in my code and it works. I don't know if the problem is gdb or me. Do you have an idea?

Simon
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top