How to set break points on all destructors in AIX? (c++) - c++

I have found that rbreak in gdb can do this by a regular expression.
Is there an alternative way in aix dbx?
I have read the document of IBM.
It seems that dbx cannot do this.

Related

How to set data breakpoints (i.e. watchpoints) on VSCode

I am no expert in VSCode, but I saw that since version 1.38 there is the possibility to add watchpoints (a breakpoint which breaks when a given memory area is modified, a feature that is supported by many debuggers), at least for C/C++, see here https://jaxenter.com/vs-code-1-38-161797.html and here https://github.com/microsoft/vscode/issues/58304. Now my version of VSCode is 1.48.2, and I still can't figure out how to do it, and I couldn't find a proper explanation either. If anyone can give an explanation on how to do it (or whether it is possible), for sure it will very beneficial for me and for the VSCode community.
I personally use the CodeLLDB extension for C++ debugging as I use LLDB. The way I create a variable watchpoint:
Put a regular break-point at where the variable is defined
Upon hitting the break-point, find the variable in the Variables pane, right click, and choose Break When Value Changes

List of functions called till a breakpoint gdb

I am using gdb to trace a program's execution flow. I am using an open source codebase and using certain library functions for my task. I am interested to know the path the program takes to reach the particular function, where I have placed a breakpoint. Is there a way in gdb to list all the functions called before the breakpoint is reached. I am looking to add a field to a particular data structure and it can be done only if I know in which exact function is the data structure being modified.
I am interested to know the path the program takes to reach the particular function, where I have placed a breakpoint.
This is possible by setting a breakpoint on every function, with something like rbreak ., but is not a viable approach for anything larger than tiny toy programs.
Is there a way in gdb to list all the functions called before the breakpoint is reached.
No.
I am looking to add a field to a particular data structure and it can be done only if I know in which exact function is the data structure being modified.
You are holding it wrong. You are trying to replace code understanding and indexing tool with GDB, but GDB is not such a tool.
Further, knowing all functions that have been called before the breakpoint in no way answers "which exact function(s) modified the structure" -- you get a superset instead. That superset can be 1000 times larger than the set you are interested in.
TL;DR: read the source, use tools that help with code understanding and indexing, and don't try to use GDB as such a tool (you'll fail).

debugging LLVM IR with LLDB

I've developed an LLVM front-end generating LLVM IR as the target code from some source-language X. If I extend this front-end to embed debug information within the generated IR, is it possible to use LLDB for debugging my source-language? I mean does lldb support any source-language targeting LLVM IR?
You'll have to get a DWARF language code and get lldb to recognize it. If we get some DWARF for an unknown language, we'll just ignore it...
Then with no more support, some things will work, others won't.
If you emit correct line table information, you should be able to map back to your source, and that should get stepping working as well. Other things start getting hard.
The next hard part is how you are going to tell lldb about your type information. lldb uses Clang's AST's as internal storage for type information in the debugger. lldb translates DWARF type information into Clang AST's both for printing local variables (with the frame variable command) and for use with the expression parser.
If your language has a type system that looks kinda like C lldb should be able to parse the DWARF for your types. You'll that plus correct variable information should get frame variable working.
The expression parser (i.e. the expression, print or po commands) requires that lldb have a parser for your language. That can be a pretty big chunk of work.

find position of a list term in gdb

I'm wondering if it is possible, within a debugging session, to tell gdb to go over all the terms of an std::vector and print out the indexes of those that satisfy a certain condition. In my case I have vector, and I would like to know which of the terms are negative.
I am well aware that this can be accomplished using conditional breakpoints, but for that I would have to rerun the program and place the breakpoint in the position where the vector is initialized, but it's less convenient.
There is no way of doing what you are asking for with plain gdb. The debugger does not have a language in which you can run arbitrary queries. That being said, the debugger does have support (at least not ancient versions) to load python scripts that will interact with data.
You can define scripts in the gdb command line, or else you can define them in files and load them from the command line.

"How can I jump to functions in a C++ project with vi

I am making a c++ program with vi. It has only one file but it's getting kind of big. It would be nice if I could easily see all the functions I created and jump to any one of them without having to search for them. Can vi do this, or is there a similar program that can?
This seems like a dup of Jump to function definition in vim.
To sum up that answer, use ctags, and take a look at Vim and Ctags tips and tricks.
I use a vim plugin to do this :
http://www.vim.org/scripts/script.php?script_id=273
It summarizes classes, struct, function, with jump functionality.