create main binary
This commit is contained in:
parent
e5803f3b17
commit
38984339fc
|
@ -4,3 +4,4 @@ build/
|
|||
Makefile
|
||||
.qmake.stash
|
||||
.vscode/settings.json
|
||||
qtdebugger
|
||||
|
|
|
@ -36,3 +36,18 @@ HEADERS += \
|
|||
|
||||
FORMS += \
|
||||
ui/debugwindow.ui
|
||||
|
||||
# main binary target
|
||||
qtdebugger.depends = src/main.c
|
||||
qtdebugger.commands = $$QMAKE_CC src/main.c -o qtdebugger
|
||||
qtdebugger.path = /usr/local/bin/
|
||||
qtdebugger.files = qtdebugger
|
||||
QMAKE_EXTRA_TARGETS += qtdebugger
|
||||
PRE_TARGETDEPS += qtdebugger
|
||||
|
||||
# install targets
|
||||
target.path = /usr/local/lib/
|
||||
|
||||
INSTALLS += \
|
||||
qtdebugger \
|
||||
target
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
if( argc < 2 ) {
|
||||
fprintf(stderr, "missing arguments\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
setenv("LD_PRELOAD", "/usr/local/lib/libqtdebugger.so", 1);
|
||||
|
||||
// should never return
|
||||
execv(argv[1], argv+1);
|
||||
|
||||
fprintf(stderr, "exec failed: %s\n", strerror(errno));
|
||||
return 2;
|
||||
}
|
Loading…
Reference in New Issue