diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-12-07 22:17:48 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-12-07 22:17:48 (GMT) |
commit | f36b525987442d46c920f76dced29356663ae85b (patch) | |
tree | a8e231bd4cb209a42155e927fdd17f807a42dc68 /src/debug/jdwp/sets | |
parent | 5a85f3d6ee1d6121c0f7bec0eceb677179f5b3de (diff) |
Removed code.
Diffstat (limited to 'src/debug/jdwp/sets')
-rw-r--r-- | src/debug/jdwp/sets/Makefile.am | 19 | ||||
-rw-r--r-- | src/debug/jdwp/sets/list.c | 191 | ||||
-rw-r--r-- | src/debug/jdwp/sets/list.h | 64 | ||||
-rw-r--r-- | src/debug/jdwp/sets/thread.c | 222 | ||||
-rw-r--r-- | src/debug/jdwp/sets/thread.h | 55 | ||||
-rw-r--r-- | src/debug/jdwp/sets/vm.c | 202 | ||||
-rw-r--r-- | src/debug/jdwp/sets/vm.h | 53 |
7 files changed, 0 insertions, 806 deletions
diff --git a/src/debug/jdwp/sets/Makefile.am b/src/debug/jdwp/sets/Makefile.am deleted file mode 100644 index cc149b7..0000000 --- a/src/debug/jdwp/sets/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ - -noinst_LTLIBRARIES = libdebugjdwpsets.la - -libdebugjdwpsets_la_SOURCES = \ - list.h list.c \ - thread.h thread.c \ - vm.h vm.c - -libdebugjdwpsets_la_LDFLAGS = - - -devdir = $(includedir)/chrysalide/$(subdir:src/%=%) - -dev_HEADERS = $(libdebugjdwpsets_la_SOURCES:%c=) - - -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) diff --git a/src/debug/jdwp/sets/list.c b/src/debug/jdwp/sets/list.c deleted file mode 100644 index fcab7be..0000000 --- a/src/debug/jdwp/sets/list.c +++ /dev/null @@ -1,191 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * list.c - ensemble des jeux de commandes de JDWP - * - * Copyright (C) 2010-2017 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * Chrysalide is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * Chrysalide is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Chrysalide. If not, see <http://www.gnu.org/licenses/>. - */ - - -#include "list.h" - - -#include <stddef.h> - - -#include "thread.h" -#include "vm.h" - - -/* Consitue un contenu binaire à partir d'une charge utile. */ -typedef bool (* set_jdwp_payload_fc) (const jdwp_payload *, const jdwp_cmd_vm_id_sizes_reply *, bin_t *, off_t *); - -/* Reconstitue une charge utile à partir d'un contenu binaire. */ -typedef bool (* get_jdwp_payload_fc) (const bin_t *, off_t, const jdwp_cmd_vm_id_sizes_reply *, jdwp_payload *); - -/* Libère le contenu d'une charge utile. */ -typedef void (* free_jdwp_payload_fc) (jdwp_payload *); - - -/* Commandes JDWP */ -typedef struct _jdwp_command -{ - set_jdwp_payload_fc set_payload; /* Constitution du binaire */ - free_jdwp_payload_fc free_set_payload; /* Libération de la mémoire */ - get_jdwp_payload_fc get_payload; /* Constitution de la charge */ - free_jdwp_payload_fc free_got_payload; /* Libération de la mémoire */ - -} jdwp_command; - - -/* Energistrement des différents jeux */ -static jdwp_command _commands[][256] = { - - [JDWP_CST_VIRTUAL_MACHINE] = { - - [JDWP_CMD_VM_VERSION] = { - .set_payload = (set_jdwp_payload_fc)NULL, - .free_set_payload = (free_jdwp_payload_fc)NULL, - .get_payload = (get_jdwp_payload_fc)get_jdwp_vm_version, - .free_got_payload = (free_jdwp_payload_fc)free_jdwp_vm_version - }, - - [JDWP_CMD_VM_ALL_THREADS] = { - .set_payload = (set_jdwp_payload_fc)NULL, - .free_set_payload = (free_jdwp_payload_fc)NULL, - .get_payload = (get_jdwp_payload_fc)get_jdwp_vm_all_threads, - .free_got_payload = (free_jdwp_payload_fc)free_jdwp_all_threads - }, - - [JDWP_CMD_VM_ID_SIZES] = { - .set_payload = (set_jdwp_payload_fc)NULL, - .free_set_payload = (free_jdwp_payload_fc)NULL, - .get_payload = (get_jdwp_payload_fc)get_jdwp_vm_id_sizes, - .free_got_payload = (free_jdwp_payload_fc)NULL - } - - }, - - [JDWP_CST_THREAD_REFERENCE] = { - - [JDWP_CMD_THREAD_NAME] = { - .set_payload = (set_jdwp_payload_fc)set_jdwp_thread_name, - .free_set_payload = (free_jdwp_payload_fc)NULL, - .get_payload = (get_jdwp_payload_fc)get_jdwp_thread_name, - .free_got_payload = (free_jdwp_payload_fc)free_jdwp_thread_name_reply - }, - - [JDWP_CMD_THREAD_FRAMES] = { - .set_payload = (set_jdwp_payload_fc)set_jdwp_thread_frames, - .free_set_payload = (free_jdwp_payload_fc)NULL, - .get_payload = (get_jdwp_payload_fc)get_jdwp_thread_frames, - .free_got_payload = (free_jdwp_payload_fc)free_jdwp_thread_frames_reply - } - - } - -}; - - - -/****************************************************************************** -* * -* Paramètres : payload = charge utile à transcrire. * -* set = jeu de commandes concerné. * -* cmd = identifiant d'une commande donnée. * -* sizes = références pour la valeur des tailles dynamiques. * -* blob = futures données binaires brutes. [OUT] * -* len = quantité de données valides. [OUT] * -* * -* Description : Reconstitue un contenu binaire à partir d'une charge utile. * -* * -* Retour : Bilan de l'opération. * -* * -* Remarques : - * -* * -******************************************************************************/ - -bool set_jdwp_payload(const jdwp_payload *payload, uint8_t set, uint8_t cmd, const jdwp_cmd_vm_id_sizes_reply *sizes, bin_t *blob, off_t *len) -{ - bool result; /* Bilan à retourner */ - - if (_commands[set][cmd].set_payload == NULL) result = false; - else result = _commands[set][cmd].set_payload(payload, sizes, blob, len); - - return result; - -} - - -/****************************************************************************** -* * -* Paramètres : blob = ensemble de données binaires brutes. * -* len = quantité de données valides. * -* set = jeu de commandes concerné. * -* cmd = identifiant d'une commande donnée. * -* sizes = références pour la valeur des tailles dynamiques. * -* payload = charge utile à reconstituer. [OUT] * -* * -* Description : Reconstitue une charge utile à partir d'un contenu binaire. * -* * -* Retour : Bilan de l'opération. * -* * -* Remarques : - * -* * -******************************************************************************/ - -bool get_jdwp_payload(const bin_t *blob, off_t len, uint8_t set, uint8_t cmd, const jdwp_cmd_vm_id_sizes_reply *sizes, jdwp_payload *payload) -{ - bool result; /* Bilan à retourner */ - - if (_commands[set][cmd].get_payload == NULL) result = false; - else result = _commands[set][cmd].get_payload(blob, len, sizes, payload); - - return result; - -} - - -/****************************************************************************** -* * -* Paramètres : payload = charge utile à supprimer de la mémoire. * -* got = type de charge utile à traiter. * -* set = jeu de commandes concerné. * -* cmd = identifiant d'une commande donnée. * -* * -* Description : Libère le contenu d'une charge utile. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void free_jdwp_payload(jdwp_payload *payload, bool got, uint8_t set, uint8_t cmd) -{ - if (got) - { - if (_commands[set][cmd].free_got_payload != NULL) - _commands[set][cmd].free_got_payload(payload); - } - else - { - if (_commands[set][cmd].free_set_payload != NULL) - _commands[set][cmd].free_set_payload(payload); - } - -} diff --git a/src/debug/jdwp/sets/list.h b/src/debug/jdwp/sets/list.h deleted file mode 100644 index 02a6fac..0000000 --- a/src/debug/jdwp/sets/list.h +++ /dev/null @@ -1,64 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * list.h - prototypes pour l'ensemble des jeux de commandes de JDWP - * - * Copyright (C) 2010-2017 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * Chrysalide is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * Chrysalide is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Chrysalide. If not, see <http://www.gnu.org/licenses/>. - */ - - -#ifndef _DEBUG_JDWP_SETS_LIST_H -#define _DEBUG_JDWP_SETS_LIST_H - - -#include <stdbool.h> - - -#include "../jdwp_def.h" -#include "../../../arch/archbase.h" - - - -/* Ensemble des contenus pris en compte */ -typedef union _jdwp_payload -{ - jdwp_cmd_vm_version_reply vs_reply; /* Infos. sur la version */ - jdwp_cmd_vm_allthreads_reply th_reply; /* Liste des threads */ - jdwp_cmd_vm_id_sizes_reply sz_reply; /* Tailles dynamiques */ - - jdwp_cmd_thread_name_request th_ident; /* Identification d'un thread */ - jdwp_cmd_thread_name_reply th_name; /* Désignation d'un thread */ - jdwp_cmd_thread_frames_request __nu0; /* Inutilisé */ - jdwp_cmd_thread_frames_reply th_frames; /* Pile des frames courantes */ - - bin_t padding[500]; - -} jdwp_payload; - - -/* Reconstitue un contenu binaire à partir d'une charge utile. */ -bool set_jdwp_payload(const jdwp_payload *, uint8_t, uint8_t, const jdwp_cmd_vm_id_sizes_reply *, bin_t *, off_t *); - -/* Reconstitue une charge utile à partir d'un contenu binaire. */ -bool get_jdwp_payload(const bin_t *, off_t, uint8_t, uint8_t, const jdwp_cmd_vm_id_sizes_reply *, jdwp_payload *); - -/* Libère le contenu d'une charge utile. */ -void free_jdwp_payload(jdwp_payload *, bool, uint8_t, uint8_t); - - - -#endif /* _DEBUG_JDWP_SETS_LIST_H */ diff --git a/src/debug/jdwp/sets/thread.c b/src/debug/jdwp/sets/thread.c deleted file mode 100644 index bac30ec..0000000 --- a/src/debug/jdwp/sets/thread.c +++ /dev/null @@ -1,222 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * thread.c - interactions avec les différents threads - * - * Copyright (C) 2012-2017 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * Chrysalide is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * Chrysalide is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Chrysalide. If not, see <http://www.gnu.org/licenses/>. - */ - - -#include "thread.h" - - -#include <malloc.h> -#include <string.h> - - -#include "../misc/id.h" -#include "../misc/location.h" -#include "../misc/types.h" -#include "../../../common/endianness.h" - - - -/****************************************************************************** -* * -* Paramètres : req = structure de réponse à constituer. * -* sizes = références pour la valeur des tailles dynamiques. * -* blob = ensemble de données binaires brutes. [OUT] * -* len = quantité de données disponibles, puis écrites. [OUT] * -* * -* Description : Prépare une requête demandant le nom d'un thread. * -* * -* Retour : Bilan de l'opération. * -* * -* Remarques : - * -* * -******************************************************************************/ - -bool set_jdwp_thread_name(const jdwp_cmd_thread_name_request *req, const jdwp_cmd_vm_id_sizes_reply *sizes, bin_t *blob, off_t *len) -{ - bool result; /* Bilan à retourner */ - off_t pos; /* Tête de lecture */ - - pos = 0; - memset(blob, 0, sizeof(jdwp_cmd_thread_name_request)); - - result = set_jdwp_thread_id(&req->id, sizes, blob, &pos, *len); - if (!result) return false; - - *len = pos; - - return true; - -} - - -/****************************************************************************** -* * -* Paramètres : blob = ensemble de données binaires brutes. * -* len = quantité de données valides. * -* sizes = références pour la valeur des tailles dynamiques. * -* reply = structure de réponse à constituer. [OUT] * -* * -* Description : Reconstitue une réponse fournissant le nom d'un thread. * -* * -* Retour : Bilan de l'opération. * -* * -* Remarques : - * -* * -******************************************************************************/ - -bool get_jdwp_thread_name(const bin_t *blob, off_t len, const jdwp_cmd_vm_id_sizes_reply *sizes, jdwp_cmd_thread_name_reply *reply) -{ - bool result; /* Bilan à retourner */ - off_t pos; /* Tête de lecture */ - - pos = 0; - memset(reply, 0, sizeof(jdwp_cmd_thread_name_reply)); - - result = get_jdwp_string(blob, &pos, len, &reply->name); - if (!result) return false; - - return true; - -} - - -/****************************************************************************** -* * -* Paramètres : reply = structure de réponse à supprimer de la mémoire. * -* * -* Description : Libère le nom donné à un thread. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void free_jdwp_thread_name_reply(jdwp_cmd_thread_name_reply *reply) -{ - free_jdwp_string(&reply->name); - -} - - -/****************************************************************************** -* * -* Paramètres : req = structure de réponse à constituer. * -* sizes = références pour la valeur des tailles dynamiques. * -* blob = ensemble de données binaires brutes. [OUT] * -* len = quantité de données disponibles, puis écrites. [OUT] * -* * -* Description : Prépare une requête demandant les frames d'un thread. * -* * -* Retour : Bilan de l'opération. * -* * -* Remarques : - * -* * -******************************************************************************/ - -bool set_jdwp_thread_frames(const jdwp_cmd_thread_frames_request *req, const jdwp_cmd_vm_id_sizes_reply *sizes, bin_t *blob, off_t *len) -{ - bool result; /* Bilan à retourner */ - off_t pos; /* Tête de lecture */ - - pos = 0; - memset(blob, 0, sizeof(jdwp_cmd_thread_frames_request)); - - result = set_jdwp_frame_id(&req->id, sizes, blob, &pos, *len); - if (!result) return false; - - result = write_u32(&req->start, blob, &pos, *len, SRE_BIG); - if (!result) return false; - - result = write_u32(&req->length, blob, &pos, *len, SRE_BIG); - if (!result) return false; - - *len = pos; - - return true; - -} - - -/****************************************************************************** -* * -* Paramètres : blob = ensemble de données binaires brutes. * -* len = quantité de données valides. * -* sizes = références pour la valeur des tailles dynamiques. * -* reply = structure de réponse à constituer. [OUT] * -* * -* Description : Reconstitue une réponse fournissant les frames d'un thread. * -* * -* Retour : Bilan de l'opération. * -* * -* Remarques : - * -* * -******************************************************************************/ - -bool get_jdwp_thread_frames(const bin_t *blob, off_t len, const jdwp_cmd_vm_id_sizes_reply *sizes, jdwp_cmd_thread_frames_reply *reply) -{ - bool result; /* Bilan à retourner */ - off_t pos; /* Tête de lecture */ - uint32_t i; /* Boucle de parcours */ - - pos = 0; - memset(reply, 0, sizeof(jdwp_cmd_thread_frames_reply)); - - result = read_u32(&reply->count, blob, &pos, len, SRE_BIG); - if (!result) return false; - - reply->frames = (jdwp_thread_frame *)calloc(reply->count, sizeof(jdwp_thread_frame)); - - for (i = 0; i < reply->count && result; i++) - { - result = get_jdwp_frame_id(blob, &pos, len, sizes, &reply->frames[i].frame_id); - - result &= get_jdwp_location(blob, &pos, len, sizes, &reply->frames[i].location); - - } - - if (!result) - free_jdwp_thread_frames_reply(reply); - - return result; - -} - - -/****************************************************************************** -* * -* Paramètres : reply = structure de réponse à supprimer de la mémoire. * -* * -* Description : Libère une liste de frames d'un thread. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void free_jdwp_thread_frames_reply(jdwp_cmd_thread_frames_reply *reply) -{ - if (reply->frames != NULL) - free(reply->frames); - -} diff --git a/src/debug/jdwp/sets/thread.h b/src/debug/jdwp/sets/thread.h deleted file mode 100644 index b0df015..0000000 --- a/src/debug/jdwp/sets/thread.h +++ /dev/null @@ -1,55 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * thread.h - prototypes pour les interactions avec les différents threads - * - * Copyright (C) 2012-2017 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * Chrysalide is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * Chrysalide is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Chrysalide. If not, see <http://www.gnu.org/licenses/>. - */ - - -#ifndef _DEBUG_JDWP_SETS_THREAD_H -#define _DEBUG_JDWP_SETS_THREAD_H - - -#include <stdbool.h> - - -#include "../jdwp_def.h" -#include "../../../arch/archbase.h" - - -/* Prépare une requête demandant le nom d'un thread. */ -bool set_jdwp_thread_name(const jdwp_cmd_thread_name_request *, const jdwp_cmd_vm_id_sizes_reply *, bin_t *, off_t *); - -/* Reconstitue une réponse fournissant le nom d'un thread. */ -bool get_jdwp_thread_name(const bin_t *, off_t, const jdwp_cmd_vm_id_sizes_reply *, jdwp_cmd_thread_name_reply *); - -/* Libère le nom donné à un thread. */ -void free_jdwp_thread_name_reply(jdwp_cmd_thread_name_reply *); - -/* Prépare une requête demandant les frames d'un thread. */ -bool set_jdwp_thread_frames(const jdwp_cmd_thread_frames_request *, const jdwp_cmd_vm_id_sizes_reply *, bin_t *, off_t *); - -/* Reconstitue une réponse fournissant les frames d'un thread. */ -bool get_jdwp_thread_frames(const bin_t *, off_t, const jdwp_cmd_vm_id_sizes_reply *, jdwp_cmd_thread_frames_reply *); - -/* Libère une liste de frames d'un thread. */ -void free_jdwp_thread_frames_reply(jdwp_cmd_thread_frames_reply *); - - - -#endif /* _DEBUG_JDWP_SETS_THREAD_H */ diff --git a/src/debug/jdwp/sets/vm.c b/src/debug/jdwp/sets/vm.c deleted file mode 100644 index 3ff28d6..0000000 --- a/src/debug/jdwp/sets/vm.c +++ /dev/null @@ -1,202 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * vm.c - constitution des charges utiles liées à la VM - * - * Copyright (C) 2010-2017 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * Chrysalide is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * Chrysalide is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Chrysalide. If not, see <http://www.gnu.org/licenses/>. - */ - - -#include "vm.h" - - -#include <malloc.h> -#include <string.h> - - -#include "../misc/id.h" -#include "../misc/types.h" -#include "../../../common/endianness.h" - - - -/****************************************************************************** -* * -* Paramètres : blob = ensemble de données binaires brutes. * -* len = quantité de données valides. * -* sizes = références pour la valeur des tailles dynamiques. * -* reply = structure de réponse à constituer. [OUT] * -* * -* Description : Reconstitue une réponse quant à une version de serveur. * -* * -* Retour : Bilan de l'opération. * -* * -* Remarques : - * -* * -******************************************************************************/ - -bool get_jdwp_vm_version(const bin_t *blob, off_t len, const jdwp_cmd_vm_id_sizes_reply *sizes, jdwp_cmd_vm_version_reply *reply) -{ - bool result; /* Bilan à retourner */ - off_t pos; /* Tête de lecture */ - - pos = 0; - memset(reply, 0, sizeof(jdwp_cmd_vm_version_reply)); - - result = get_jdwp_string(blob, &pos, len, &reply->description); - if (!result) return false; - - result = read_u32(&reply->jdwp_major, blob, &pos, len, SRE_BIG); - if (!result) return false; - - result = read_u32(&reply->jdwp_minor, blob, &pos, len, SRE_BIG); - if (!result) return false; - - result = get_jdwp_string(blob, &pos, len, &reply->vm_version); - if (!result) return false; - - result = get_jdwp_string(blob, &pos, len, &reply->vm_name); - if (!result) return false; - - return true; - -} - - -/****************************************************************************** -* * -* Paramètres : reply = structure de réponse à supprimer de la mémoire. * -* * -* Description : Libère le contenu d'une réponse quant à une version. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void free_jdwp_vm_version(jdwp_cmd_vm_version_reply *reply) -{ - free_jdwp_string(&reply->description); - - free_jdwp_string(&reply->vm_version); - - free_jdwp_string(&reply->vm_name); - -} - - -/****************************************************************************** -* * -* Paramètres : blob = ensemble de données binaires brutes. * -* len = quantité de données valides. * -* sizes = références pour la valeur des tailles dynamiques. * -* reply = structure de réponse à constituer. [OUT] * -* * -* Description : Reconstitue une réponse fournissant la liste des threads. * -* * -* Retour : Bilan de l'opération. * -* * -* Remarques : - * -* * -******************************************************************************/ - -bool get_jdwp_vm_all_threads(const bin_t *blob, off_t len, const jdwp_cmd_vm_id_sizes_reply *sizes, jdwp_cmd_vm_allthreads_reply *reply) -{ - bool result; /* Bilan à retourner */ - off_t pos; /* Tête de lecture */ - uint32_t i; /* Boucle de parcours */ - - pos = 0; - memset(reply, 0, sizeof(jdwp_cmd_vm_id_sizes_reply)); - - result = read_u32(&reply->count, blob, &pos, len, SRE_BIG); - if (!result) return false; - - reply->threads = (jdwp_dynsized_id *)calloc(reply->count, sizeof(jdwp_dynsized_id)); - - for (i = 0; i < reply->count && result; i++) - result = get_jdwp_thread_id(blob, &pos, len, sizes, &reply->threads[i]); - - if (!result) - free_jdwp_all_threads(reply); - - return result; - -} - - -/****************************************************************************** -* * -* Paramètres : reply = structure de réponse à supprimer de la mémoire. * -* * -* Description : Libère le contenu d'une réponse offrant une liste de threads.* -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void free_jdwp_all_threads(jdwp_cmd_vm_allthreads_reply *reply) -{ - free(reply->threads); - -} - - -/****************************************************************************** -* * -* Paramètres : blob = ensemble de données binaires brutes. * -* len = quantité de données valides. * -* sizes = références pour la valeur des tailles dynamiques. * -* reply = structure de réponse à constituer. [OUT] * -* * -* Description : Reconstitue une réponse quant aux tailles spécifiques. * -* * -* Retour : Bilan de l'opération. * -* * -* Remarques : - * -* * -******************************************************************************/ - -bool get_jdwp_vm_id_sizes(const bin_t *blob, off_t len, const jdwp_cmd_vm_id_sizes_reply *sizes, jdwp_cmd_vm_id_sizes_reply *reply) -{ - bool result; /* Bilan à retourner */ - off_t pos; /* Tête de lecture */ - - pos = 0; - memset(reply, 0, sizeof(jdwp_cmd_vm_id_sizes_reply)); - - result = read_u32(&reply->field_id_size, blob, &pos, len, SRE_BIG); - if (!result) return false; - - result = read_u32(&reply->method_id_size, blob, &pos, len, SRE_BIG); - if (!result) return false; - - result = read_u32(&reply->object_id_size, blob, &pos, len, SRE_BIG); - if (!result) return false; - - result = read_u32(&reply->reference_type_id_size, blob, &pos, len, SRE_BIG); - if (!result) return false; - - result = read_u32(&reply->frame_id_size, blob, &pos, len, SRE_BIG); - if (!result) return false; - - return true; - -} diff --git a/src/debug/jdwp/sets/vm.h b/src/debug/jdwp/sets/vm.h deleted file mode 100644 index a63adc7..0000000 --- a/src/debug/jdwp/sets/vm.h +++ /dev/null @@ -1,53 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * vm.h - prototypes pour la constitution des charges utiles liées à la VM - * - * Copyright (C) 2010-2017 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * Chrysalide is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * Chrysalide is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Chrysalide. If not, see <http://www.gnu.org/licenses/>. - */ - - -#ifndef _DEBUG_JDWP_SETS_VM_H -#define _DEBUG_JDWP_SETS_VM_H - - -#include <stdbool.h> - - -#include "../jdwp_def.h" -#include "../../../arch/archbase.h" - - - -/* Reconstitue une réponse quant à une version de serveur. */ -bool get_jdwp_vm_version(const bin_t *, off_t, const jdwp_cmd_vm_id_sizes_reply *, jdwp_cmd_vm_version_reply *); - -/* Libère le contenu d'une réponse quant à une version. */ -void free_jdwp_vm_version(jdwp_cmd_vm_version_reply *); - -/* Reconstitue une réponse fournissant la liste des threads. */ -bool get_jdwp_vm_all_threads(const bin_t *, off_t, const jdwp_cmd_vm_id_sizes_reply *, jdwp_cmd_vm_allthreads_reply *); - -/* Libère le contenu d'une réponse offrant une liste de threads. */ -void free_jdwp_all_threads(jdwp_cmd_vm_allthreads_reply *); - -/* Reconstitue une réponse quant aux tailles spécifiques. */ -bool get_jdwp_vm_id_sizes(const bin_t *, off_t, const jdwp_cmd_vm_id_sizes_reply *, jdwp_cmd_vm_id_sizes_reply *); - - - -#endif /* _DEBUG_JDWP_SETS_VM_H */ |