Skip to content

Commit 6079418

Browse files
radaretrufae
authored andcommitted
Simplify the JSON handling in the 'i' subcommands ##bin
1 parent b037208 commit 6079418

File tree

10 files changed

+479
-490
lines changed

10 files changed

+479
-490
lines changed

libr/bin/format/pdb/pdb_downloader.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
/* radare - LGPL - Copyright 2014-2022 - inisider */
1+
/* radare - LGPL - Copyright 2014-2025 - inisider */
22

3-
#include <string.h>
4-
#include <r_util.h>
53
#include <r_core.h>
64
#include "pdb_downloader.h"
75

@@ -170,8 +168,7 @@ static bool is_valid_guid(const char *guid) {
170168
return i >= 33; // len of GUID and age
171169
}
172170

173-
int r_bin_pdb_download(RCore *core, PJ *pj, int isradjson, SPDBOptions *options) {
174-
int ret;
171+
int r_bin_pdb_download(RCore *core, PJ *pj, SPDBOptions *options) {
175172
SPDBDownloaderOpt opt;
176173
SPDBDownloader pdb_downloader;
177174
RBinInfo *info = r_bin_get_info (core->bin);
@@ -199,9 +196,10 @@ int r_bin_pdb_download(RCore *core, PJ *pj, int isradjson, SPDBOptions *options)
199196
opt.extract = options->extract;
200197

201198
init_pdb_downloader (&opt, &pdb_downloader);
202-
ret = pdb_downloader.download? pdb_downloader.download (&pdb_downloader): 0;
203-
if (isradjson) {
204-
pj_ko (pj, "pdb");
199+
int ret = pdb_downloader.download? pdb_downloader.download (&pdb_downloader): 0;
200+
if (pj) {
201+
// pj_ko (pj, "pdb");
202+
pj_o (pj);
205203
pj_ks (pj, "file", opt.dbg_file);
206204
pj_kb (pj, "download", (bool) ret);
207205
pj_end (pj);

libr/bin/format/pdb/pdb_downloader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void deinit_pdb_downloader(SPDBDownloader *pdb_downloader);
4545

4646
///
4747
/// \brief download PDB file
48-
R_API int r_bin_pdb_download(RCore *core, PJ *pj, int isradjson, SPDBOptions *options);
48+
R_API int r_bin_pdb_download(RCore *core, PJ *pj, SPDBOptions *options);
4949

5050
#ifdef __cplusplus
5151
}

libr/core/cbin.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,19 +1329,19 @@ R_API bool r_core_pdb_info(RCore *core, const char *file, PJ *pj, int mode) {
13291329
mode = 'd'; // default
13301330
break;
13311331
}
1332-
if (pj || mode == 'j') {
1332+
1333+
if (mode == 'j') {
13331334
pj_o (pj);
13341335
}
1335-
13361336
pdb.print_types (&pdb, pj, mode);
13371337
pdb.print_gvars (&pdb, baddr, pj, mode);
13381338
// Save compound types into SDB
13391339
r_parse_pdb_types (core->anal, &pdb);
13401340
pdb.finish_pdb_parse (&pdb);
1341-
1342-
if (pj || mode == 'j') {
1341+
if (mode == 'j') {
13431342
pj_end (pj);
13441343
}
1344+
13451345
return true;
13461346
}
13471347

@@ -4824,7 +4824,7 @@ R_API bool r_core_bin_info(RCore *core, int action, PJ *pj, int mode, int va, RC
48244824
if ((action & R_CORE_BIN_ACC_MAIN)) {
48254825
ret &= bin_main (core, pj, mode, va);
48264826
}
4827-
if ((action & R_CORE_BIN_ACC_DWARF)) { // R2_600 : Rename R_CORE_BIN_ACC_DWARF to _ADDRLINE
4827+
if ((action & R_CORE_BIN_ACC_ADDRLINE)) {
48284828
ret &= bin_addrline (core, pj, mode);
48294829
}
48304830
if ((action & R_CORE_BIN_ACC_PDB)) {

0 commit comments

Comments
 (0)