@@ -103,22 +103,19 @@ fn find_cdb(target: &str) -> Option<Utf8PathBuf> {
103103}
104104
105105/// Returns Path to CDB
106- pub ( crate ) fn analyze_cdb (
107- cdb : Option < String > ,
108- target : & str ,
109- ) -> ( Option < Utf8PathBuf > , Option < [ u16 ; 4 ] > ) {
106+ pub ( crate ) fn discover_cdb ( cdb : Option < String > , target : & str ) -> Option < Utf8PathBuf > {
110107 let cdb = cdb. map ( Utf8PathBuf :: from) . or_else ( || find_cdb ( target) ) ;
108+ cdb
109+ }
111110
111+ pub ( crate ) fn query_cdb_version ( cdb : & Utf8Path ) -> Option < [ u16 ; 4 ] > {
112112 let mut version = None ;
113- if let Some ( cdb) = cdb. as_ref ( ) {
114- if let Ok ( output) = Command :: new ( cdb) . arg ( "/version" ) . output ( ) {
115- if let Some ( first_line) = String :: from_utf8_lossy ( & output. stdout ) . lines ( ) . next ( ) {
116- version = extract_cdb_version ( & first_line) ;
117- }
113+ if let Ok ( output) = Command :: new ( cdb) . arg ( "/version" ) . output ( ) {
114+ if let Some ( first_line) = String :: from_utf8_lossy ( & output. stdout ) . lines ( ) . next ( ) {
115+ version = extract_cdb_version ( & first_line) ;
118116 }
119117 }
120-
121- ( cdb, version)
118+ version
122119}
123120
124121pub ( crate ) fn extract_cdb_version ( full_version_line : & str ) -> Option < [ u16 ; 4 ] > {
@@ -132,12 +129,11 @@ pub(crate) fn extract_cdb_version(full_version_line: &str) -> Option<[u16; 4]> {
132129 Some ( [ major, minor, patch, build] )
133130}
134131
135- /// Returns (Path to GDB, GDB Version)
136- pub ( crate ) fn analyze_gdb (
132+ pub ( crate ) fn discover_gdb (
137133 gdb : Option < String > ,
138134 target : & str ,
139135 android_cross_path : & Utf8Path ,
140- ) -> ( Option < String > , Option < u32 > ) {
136+ ) -> Option < String > {
141137 #[ cfg( not( windows) ) ]
142138 const GDB_FALLBACK : & str = "gdb" ;
143139 #[ cfg( windows) ]
@@ -159,6 +155,10 @@ pub(crate) fn analyze_gdb(
159155 Some ( ref s) => s. to_owned ( ) ,
160156 } ;
161157
158+ Some ( gdb)
159+ }
160+
161+ pub ( crate ) fn query_gdb_version ( gdb : & str ) -> Option < u32 > {
162162 let mut version_line = None ;
163163 if let Ok ( output) = Command :: new ( & gdb) . arg ( "--version" ) . output ( ) {
164164 if let Some ( first_line) = String :: from_utf8_lossy ( & output. stdout ) . lines ( ) . next ( ) {
@@ -168,10 +168,10 @@ pub(crate) fn analyze_gdb(
168168
169169 let version = match version_line {
170170 Some ( line) => extract_gdb_version ( & line) ,
171- None => return ( None , None ) ,
171+ None => return None ,
172172 } ;
173173
174- ( Some ( gdb ) , version)
174+ version
175175}
176176
177177pub ( crate ) fn extract_gdb_version ( full_version_line : & str ) -> Option < u32 > {
0 commit comments