Setting disassembly flavour to Intel in LLDB - gdb

Is there a way to set the disassembly flavour like there is in GDB within LLDB so that it spits out Intel style assembly rather than AT&T style?
set disassembly-flavor intel # GDB
but for LLDB.

The exact line to write in your ~/.lldbinit file is
settings set target.x86-disassembly-flavor intel
In the future, you will also be able to tweak how immediate values are displayed with the new settings: target.use-hex-immediates and target.hex-immediates-style.

No, not yet. Intel format disassembly is a feature I'm sure will be implemented eventually, but I don't think anyone is working on it today.
UPDATE: the ability to select the assembly style was added to the top of tree sources (v. http://lldb.llvm.org ) March 1st, 2013 with the -F or --flavor option to disassemble or the target.x86-disassembly-flavor setting in your ~/.lldbinit file. This will be available in future releases of lldb in Xcode.

Related

How to profile with Code:Blocks

I'm making a wxWidget application for windows. I'm working with code:blocks 13.12 and MinGW 4.8 in windows 7.
I enable the -pg option in settings->compiler and after compiling try to open the plugins->code profiler and the result is this:
gprof:
file`C:\Users\josele\Documents\C_C++\DLL\SQLManager\bin\Release\SQLManager.exe'
has no symbols
Basicly I don't know how profiling works in code:block and also my general knowledge of profiling is quite reduced.
I'm looking for solve this or a tutorial of: how profiling works in code:blocks?.
If you need more information, only let me know. Thank you in advance.
PD. I also run the .exe before calling the plugins->code profiler with a positive exit of the program
I just solve that problem with this posts:
http://forums.codeblocks.org/index.php?topic=12237.0
http://forums.codeblocks.org/index.php?topic=14798.0
I went to Project->build options and there I turn off optimizations and enable the pofiler.
What solved it for me was turning off the "-s" compiler flag, which seems to be on by default in CB release flags.

eclipse debugging is not working as expected

i am debugging c++ with eclipse on a linux VM.
The eclipse I am using is Kepler Service Release 1.
I compile the files using Automake.
When I try to debug in Eclipse and do stepover it sometimes jump to backward lines, sometimes it goes into the line. Also when there is a problem it just shows nothing. When I try to see variables it doesn't always succeed. It seems the Eclipse behavior is not so good.
I come from Windows programming and it looks very much like I saw when we compiled release version and tried to debug it in Visual.
Can anyone plesae assist? I can't debug like this. Is there any configuration? something I do wrong?
Thanks
As Martin James stated all I needed was to turn off all optimizations.
I had -o2 flag and needed to remove it.

GDB 7.5 (OS X): Can't access source from library functions

gdb newbie here, so I hope I haven't overlooked something glaringly obvious… (and if I did, maybe a kind soul could point it out anyway? ;)
I'm debugging a GCC C++ application under OS X Lion. As it's quite heavy on STL, I'd really like to use a GDB version with python support (i.e. >=v7) for pretty printing of containers. My application is split up into a backend library (.dylib) that does all the heavy lifting, and a very simple frontend application. All of the sources and binaries are below a common source path, and everything has been compiled with debugging symbols (I tried both -g and -ggdb).
Using the GDB version in XCode (which identifies as "GNU gdb 6.3.50-20050815 (Apple version gdb-1820)"), displaying the source lines of frames in a backtrace works as expected out of the box, no matter whether the respective call happens in the frontend app or the backend library:
(gdb) f 12
#12 0x000000010002ddc5 in FL3D::Resource::createMesh_ (this=0x7fff5fbff7c8, fl3d=#0x7fff5fbff1f8, id=) at /Development/workspace/fl3d/libfl3d/resource.cpp:234
234 std::vector& t = textureIndices_.at(i);
(gdb)
So far so good. GDB 7.5 and 7.4.1, on the other hand, refuse to give me any source lines from the library:
(gdb) f 12
#12 0x000000010002ddc5 in FL3D::Resource::createMesh_(FL3D::FL3DParser&, std::string) ()
from /Development/workspace/fl3d/libfl3d/build/libfl3d.dylib
(gdb)
I'm really confused by the different responses given – gdb6 prints the correct path to the source file and the correct line, while gdb7 gets the function prototype right (supposedly read from the debugging symbols of the .dylib?), but doesn't seem to know anything about the source. Interestingly, though, it DOES show the corresponding source line for calls in the frontend's main() function!
I've already tried manually setting the path to the library's source files with "dir libfl3d", but that doesn't change anything. I also notice that gdb6 says "Reading symbols for shared libraries" a few times when I run the application and gdb7 doesn't – but the symbols don't seem to be the problem, as they seem to be resolved correctly by both versions?
I'm at my wit's end here. Any pointers?
The Apple gdb is displaying the debug information because it knows how to find & parse DWARF on this platform. The gdb version 7 that you're showing is a gdb that doesn't know how to find the DWARF debug information on a Mac OS X system -- that output that you're showing above is what no-debug-info looks like. My guess is that the FSF gdb version 7 support for Mac OS X has not seen a lot of attention, I would be hesitant to recommend using it on this platform.
As bames53 notes, you're far better off using LLDB on Mac OS X at this point. It is the debugger that all of the support work is going in to and Objective-C / C++ container support is rapidly being added to LLDB but not gdb. The gdb provided by Apple is on an end-of-life path and all users will be switched over to LLDB in the future.
Give lldb a try. It's a little different but it's quite good. There is a cheat sheet that a lot of people find useful in the beginning, it shows gdb and lldb command equivalences. http://lldb.llvm.org/lldb-gdb.html

Is C++ Edit and Continue functionality available for anything other than VC++?

Does Eclipse or other IDE's support Edit and Continue for C++?
You mean the debugger feature ?
It's more a debugger-dependent than an IDE-dependent feature.
When using Eclipse, my debugger back-end is gdb, so yes, it does support Edit&Continue. (even if it's a bit odd to use, see info -f gdb -n Patching)

How to do remote debugging with Eclipse CDT without gdbserver?

We're using the Eclipse CDT 5 C++ IDE on Windows to develop a C++ application on a remote AIX host.
Eclipse CDT has the ability to perform remote debugging using gdbserver. Unfortunately, gdbserver is not supported on AIX.
Is anyone familiar with a way to debug remotely using Eclipse CDT without gdbserver? Perhaps using an SSH shell connection to gdb?
finally I got gdb run remotly anyhow now. At the Bug-symbol on the taskbar I took Debug Configurations - GDB Hardware Debugging.
In Main C/C++ Applications I set the full path on the Samba share of the executable (X:\abin\vlmi9506). I also set a linked folder on X:\abin in the project. Then I modified my batch-script in GDB Setup. It's not directly calling gdb in the plink-session but a unix-shell-script, which opens gdb. By this I have the possibility to set some unix environment-variables for the program before doing debug. The call in my batch:
plink.exe prevoax1 -l suttera -pw XXXXX -i /proj/user/dev/suttera/vl/9506/test/vlmi9506ddd.run 20155 dev o m
In the unix script I started gdb with the command line params from eclipse, that I found in my former tryals. The call in the shell command looks like this:
gdb -nw -i mi -cd=$LVarPathExec $LVarPathExec/vlmi9506
Then IBM just gives gdb 6.0 for AIX. I found version 6.8 in the net at http://www.perzl.org/aix/index.php?n=Main.Gdb. Our Admin installed it.
I can now step through the program and watch variables. I even can write gdb-commands directly in the console-view. yabadabadooooooo
Hope that helps to others as well. Can not tell, what was really the winner-action.
But each answer gives more new questions. Now I got 3 of them.
When I start the debug config I have to click restart in the toolbar to come really in the main procedure. Is it possible to come directly in main without restarting?
On AIX our programs are first preprocessed for embedded sql. The preprocessed c-source is put in another directory. When I duble-click the line to set a breakpoint, I get the warning "unresolved breakpoint" and in the gdb-console I see, that the break is set to the preprocessed source which is wrong. Is it possible to set the breakpoints on the right source?
We are using CICS on AIX. With the xldb-Debugger and the CDCN-command of CICS we manage that debugging is started, when we come in our programs. Is it possible to get that remotely (in plink) with gdb-eclipse as well?
I wouldn't normally take a shot in the dark on a question I can't really test the answer to, but since this one has sat around for a day, I'll give it a shot. It seems from looking at:
http://wiki.eclipse.org/TM_and_RSE_FAQ#How_can_I_do_Remote_Debugging_with_CDT.3F
...that even if the CDT has changed since that wiki page was made, you should still be able to change the debug command to:
ssh remotehost gdb
instead of using TM which uses gdbserver. This will probably be slightly slower than the TM remote debugging since that actually uses a local gdb, but on the other hand this way you won't have to NFS or SMB mount your source code to make it available to the local debugger (and if you're on a LAN it probably won't matter anyhow).
There's also a reference TCF implementation for linux, which you may or may not have any luck recompiling for AIX, but it allows for remote debugging if gdbserver is otherwise not available:
http://wiki.eclipse.org/DSDP/TM/TCF_FAQ
tried also to remotly debug an aix-appl with windows eclipse-cdt-gdb.
Got blocked at the end with unix/windows path-problems. Maybe my result can help u a little further - maybe you already got it work. I'm interested in your comment. asked on eclipse news portal- following the answer of martin oberhuber (thanks again) tried dsp dd (also blocked with path problem) and set an request in eclipse bugzilla.
here the link to news:
http://www.eclipse.org/newsportal/article.php?id=406&group=eclipse.dsdp.tm
Here my bugzilla:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=252758
At the moment we still debug localy with xldb but I am trying ddd-gdb at the moment. At least locally gdb is running.