summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/common/SoftwareBreakpoint.cpp
Commit message (Collapse)AuthorAgeFilesLines
* NativeProcessProtocol: Simplify breakpoint setting codePavel Labath2018-11-041-313/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: A fairly simple operation as setting a breakpoint (writing a breakpoint opcode) at a given address was going through three classes: NativeProcessProtocol which called NativeBreakpointList, which then called SoftwareBrekpoint, only to end up again in NativeProcessProtocol to do the actual writing itself. This is unnecessarily complex and can be simplified by moving all of the logic into NativeProcessProtocol class itself, removing a lot of boilerplate. One of the reeasons for this complexity was that (it seems) NativeBreakpointList class was meant to hold both software and hardware breakpoints. However, that never materialized, and hardware breakpoints are stored in a separate map holding only hardware breakpoints. Essentially, this patch makes software breakpoints follow that approach by replacing the heavy SoftwareBraekpoint with a light struct of the same name, which holds only the data necessary to describe one breakpoint. The rest of the logic is in the main class. As, at the lldb-server level, handling software and hardware breakpoints is very different, this seems like a reasonable state of things. Reviewers: krytarowski, zturner, clayborg Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D52941 llvm-svn: 346093
* Re-commit "Modernize NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode"Pavel Labath2018-09-091-47/+10
| | | | | | | | | | | | | This recommits r341487, which was reverted due to failing tests with clang. It turned out I had incorrectly expected that the literal arrays passed to ArrayRef constructor will have static (permanent) storage. This was only the case with gcc, while clang was constructing them on stack, leading to dangling pointers when the function returns. The fix is to explicitly assign static storage duration to the opcode arrays. llvm-svn: 341758
* Revert "Modernize NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode"Pavel Labath2018-09-081-10/+47
| | | | | | | This reverts commit r341487. Jan Kratochvil reports it breaks LLDB when compiling with clang. llvm-svn: 341747
* Modernize NativeProcessProtocol::GetSoftwareBreakpointTrapOpcodePavel Labath2018-09-051-47/+10
| | | | | | | | | | | | return the opcode as a Expected<ArrayRef> instead of a Status+pointer+size combo. I also move the linux implementation to the base class, as the trap opcodes are likely to be the same for all/most implementations of the class (except the arm one, where linux chooses a different opcode than what the arm spec recommends, which I keep linux-specific). llvm-svn: 341487
* Reflow paragraphs in comments.Adrian Prantl2018-04-301-10/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is intended as a clean up after the big clang-format commit (r280751), which unfortunately resulted in many of the comment paragraphs in LLDB being very hard to read. FYI, the script I used was: import textwrap import commands import os import sys import re tmp = "%s.tmp"%sys.argv[1] out = open(tmp, "w+") with open(sys.argv[1], "r") as f: header = "" text = "" comment = re.compile(r'^( *//) ([^ ].*)$') special = re.compile(r'^((([A-Z]+[: ])|([0-9]+ )).*)|(.*;)$') for line in f: match = comment.match(line) if match and not special.match(match.group(2)): # skip intentionally short comments. if not text and len(match.group(2)) < 40: out.write(line) continue if text: text += " " + match.group(2) else: header = match.group(1) text = match.group(2) continue if text: filled = textwrap.wrap(text, width=(78-len(header)), break_long_words=False) for l in filled: out.write(header+" "+l+'\n') text = "" out.write(line) os.rename(tmp, sys.argv[1]) Differential Revision: https://reviews.llvm.org/D46144 llvm-svn: 331197
* Rename Error -> Status.Zachary Turner2017-05-121-36/+37
| | | | | | | | | | | | | | | This renames the LLDB error class to Status, as discussed on the lldb-dev mailing list. A change of this magnitude cannot easily be done without find and replace, but that has potential to catch unwanted occurrences of common strings such as "Error". Every effort was made to find all the obvious things such as the word "Error" appearing in a string, etc, but it's possible there are still some lingering occurences left around. Hopefully nothing too serious. llvm-svn: 302872
* Move Log from Core -> Utility.Zachary Turner2017-03-031-1/+1
| | | | | | | | | All references to Host and Core have been removed, so this class can now safely be lowered into Utility. Differential Revision: https://reviews.llvm.org/D30559 llvm-svn: 296909
* Move classes from Core -> Utility.Zachary Turner2017-02-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | This moves the following classes from Core -> Utility. ConstString Error RegularExpression Stream StreamString The goal here is to get lldbUtility into a state where it has no dependendencies except on itself and LLVM, so it can be the starting point at which to start untangling LLDB's dependencies. These are all low level and very widely used classes, and previously lldbUtility had dependencies up to lldbCore in order to use these classes. So moving then down to lldbUtility makes sense from both the short term and long term perspective in solving this problem. Differential Revision: https://reviews.llvm.org/D29427 llvm-svn: 293941
* Prevent at compile time converting from Error::success() to Expected<T>Mehdi Amini2016-11-111-2/+2
| | | | | | | | This would trigger an assertion at runtime otherwise. Differential Revision: https://reviews.llvm.org/D26482 llvm-svn: 286562
* Make the Error class constructor protectedMehdi Amini2016-11-111-2/+2
| | | | | | | | | This is forcing to use Error::success(), which is in a wide majority of cases a lot more readable. Differential Revision: https://reviews.llvm.org/D26481 llvm-svn: 286561
* Make lldb -Werror clean on Windows.Zachary Turner2016-10-051-24/+24
| | | | | | Differential Revision: https://reviews.llvm.org/D25247 llvm-svn: 283344
* *** This commit represents a complete reformatting of the LLDB source codeKate Stone2016-09-061-261/+297
| | | | | | | | | | | | | | | | | | | | | | | *** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
* remove use of Mutex in favour of std::{,recursive_}mutexSaleem Abdulrasool2016-05-181-1/+0
| | | | | | | | | | This is a pretty straightforward first pass over removing a number of uses of Mutex in favor of std::mutex or std::recursive_mutex. The problem is that there are interfaces which take Mutex::Locker & to lock internal locks. This patch cleans up most of the easy cases. The only non-trivial change is in CommandObjectTarget.cpp where a Mutex::Locker was split into two. llvm-svn: 269877
* Fix a variety of typos.Bruce Mitchener2015-06-181-1/+1
| | | | | | No functional change. llvm-svn: 239995
* Fix compiler warnings regarding size_t not always being 64 bit in the printf.Greg Clayton2015-05-251-8/+8
| | | | llvm-svn: 238127
* Remove trap code from disassembly.Chaoren Lin2015-04-291-17/+21
| | | | | | | | | | | | | | | | | | | | Summary: NativeProcessProtocol uses ReadMemory internally for setting/checking breakpoints but also for generic memory reads (Handle_m), this change adds a ReadMemoryWithoutTrap for that purpose. Also fixes a bunch of misuses of addr_t as size/length. Test Plan: `disassemble` no longer shows the trap code. Reviewers: jingham, vharron, clayborg Reviewed By: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D9330 llvm-svn: 236132
* Moving header files from source/Host/common to proper location.Chaoren Lin2015-02-031-2/+2
| | | | llvm-svn: 227929
* llgs: add logging to Native*Protocol breakpoints around byte values replaced ↵Todd Fiala2014-10-081-1/+18
| | | | | | | | and restored. Useful for verifying what bytes a software breakpoint clobbers/restores. llvm-svn: 219318
* Add lldb-gdbserver support for Linux x86_64.Todd Fiala2014-06-301-0/+296
This change brings in lldb-gdbserver (llgs) specifically for Linux x86_64. (More architectures coming soon). Not every debugserver option is covered yet. Currently the lldb-gdbserver command line can start unattached, start attached to a pid (process-name attach not supported yet), or accept lldb attaching and launching a process or connecting by process id. The history of this large change can be found here: https://github.com/tfiala/lldb/tree/dev-tfiala-native-protocol-linux-x86_64 Until mid/late April, I was not sharing the work and continued to rebase it off of head (developed via id tfiala@google.com). I switched over to user todd.fiala@gmail.com in the middle, and once I went to github, I did merges rather than rebasing so I could share with others. llvm-svn: 212069
OpenPOWER on IntegriCloud