mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-07 05:41:43 +00:00
Show line information in rasm2 assemble errors /Ref #271
This commit is contained in:
parent
409fcd898a
commit
6637be7a7d
@ -406,6 +406,7 @@ R_API RAsmCode* r_asm_massemble(RAsm *a, const char *buf) {
|
||||
RAsmOp op;
|
||||
ut64 off;
|
||||
RAsmCode *acode = NULL;
|
||||
int linenum = 0;
|
||||
int labels = 0, stage, ret, idx, ctr, i, j;
|
||||
char *lbuf = NULL, *ptr2, *ptr = NULL, *ptr_start = NULL,
|
||||
*tokens[R_ASM_BUFSIZE], buf_token[R_ASM_BUFSIZE];
|
||||
@ -483,6 +484,7 @@ R_API RAsmCode* r_asm_massemble(RAsm *a, const char *buf) {
|
||||
if (!*ptr_start)
|
||||
continue;
|
||||
//eprintf ("LINE %d %s\n", stage, ptr_start);
|
||||
linenum ++;
|
||||
if (labels) /* Labels */
|
||||
if ((ptr = strchr (ptr_start, ':'))) {
|
||||
char food[64];
|
||||
@ -584,7 +586,7 @@ R_API RAsmCode* r_asm_massemble(RAsm *a, const char *buf) {
|
||||
}
|
||||
if (stage == 2) {
|
||||
if (ret < 1) {
|
||||
//eprintf ("Cannot assemble '%s'\n", ptr_start);
|
||||
eprintf ("Cannot assemble '%s' at line %d\n", ptr_start, linenum);
|
||||
return r_asm_code_free (acode);
|
||||
}
|
||||
acode->len = idx + ret;
|
||||
|
Loading…
Reference in New Issue
Block a user