Skip to content

Commit

Permalink
Allow debugging 32 bits applications as well as 64 bits applications
Browse files Browse the repository at this point in the history
  • Loading branch information
freedib committed May 23, 2018
1 parent bd72e67 commit 7e5902b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
8 changes: 4 additions & 4 deletions AUTHORS.md
@@ -1,9 +1,9 @@
# LLDBMI2 - An MI2 interface to LLDB

##Author
## Author
Didier Bertrand

##Contributors
Eduard Matveev
## Contributors
Eduard Matveev (CMAKE)

Dmitriy Tarasov
David Jenkins (Lazarus IDE)
4 changes: 3 additions & 1 deletion README.md
Expand Up @@ -2,6 +2,8 @@

A simple MI interface to LLDB.

Usable with Eclipse IDE (C, C++) and Lazarus IDE (Pascal)

# Context

Since Apple has withdrawn its support for GDB. The options to debug an application with CDT on Mac OS X are:
Expand All @@ -10,7 +12,7 @@ Since Apple has withdrawn its support for GDB. The options to debug an applicati
- Natural for Mac OS X, but limited for sharing projects or cross compiling on Linux or Windows.
- Not adequate for multi language programs (eg: C with Java or Perl).
2. Install GNU GDB:
- Easy to install from H-mebrew or Macports.
- Easy to install from Homebrew or Macports.
- Does not support Mac OS X dynamic libraries preventing from debugging code inside these libraries.
3. Install LLDB-MI:
- This program is promising, but is not yet mature.
Expand Down
12 changes: 11 additions & 1 deletion src/engine.cpp
Expand Up @@ -220,7 +220,17 @@ fromCDT (STATE *pstate, const char *commandLine, int linesize) // from cdt
if (strstr(cc.argv[nextarg],"%s")!=NULL)
logprintf (LOG_VARS, "%%s -> %s\n", path);
strlcpy (programpath, path, sizeof(programpath));
target = pstate->debugger.CreateTargetWithFileAndArch (programpath, "x86_64");
// check file type
int fd;
unsigned int magic = 0xfeedfacf; // x86_64
if ((fd = open (programpath, O_RDONLY)) > 0) {
read (fd, (void *)&magic, sizeof(magic));
close (fd);
}
if (magic==0xfeedface)
target = pstate->debugger.CreateTargetWithFileAndArch (programpath, "i386");
else
target = pstate->debugger.CreateTargetWithFileAndArch (programpath, "x86_64");
if (!target.IsValid())
cdtprintf ("%d^error\n(gdb)\n", cc.sequence);
else
Expand Down
6 changes: 4 additions & 2 deletions src/lldbmi2.cpp
Expand Up @@ -25,8 +25,10 @@ void help (STATE *pstate)
fprintf (stderr, "%s", pstate->lldbmi2Prompt);
fprintf (stderr, "Description:\n");
fprintf (stderr, " A MI2 interface to LLDB\n");
fprintf (stderr, "Author:\n");
fprintf (stderr, " Didier Bertrand, 2015, 2016\n");
fprintf (stderr, "Authors:\n");
fprintf (stderr, " Didier Bertrand, 2015, 2016, 2018\n");
fprintf (stderr, " Eduard Matveev, 2016\n");
fprintf (stderr, " David Jenkins, 2018\n");
fprintf (stderr, "Syntax:\n");
fprintf (stderr, " lldbmi2 --version [options]\n");
fprintf (stderr, " lldbmi2 --interpreter mi2 [options]\n");
Expand Down

0 comments on commit 7e5902b

Please sign in to comment.